Revision 63
Added by markw about 11 years ago
firmware/fat/pff_file.c | ||
---|---|---|
return sizeof(struct SimpleFile);
|
||
}
|
||
|
||
enum SimpleFileStatus file_open_name(char const * path, struct SimpleFile * file)
|
||
enum SimpleFileStatus file_open_name_in_dir(struct SimpleDirEntry * entry, char const * filename, struct SimpleFile * file)
|
||
{
|
||
char dirname[MAX_DIR_LENGTH];
|
||
char const * filename = file_of(path);
|
||
dir_of(&dirname[0], path);
|
||
|
||
file_write_flush();
|
||
|
||
//printf("filename:%s dirname:%s ", filename,&dirname[0]);
|
||
|
||
struct SimpleDirEntry * entry = dir_entries(&dirname[0]);
|
||
while (entry)
|
||
{
|
||
//printf("%s ",entry->filename_ptr);
|
||
... | ... | |
return SimpleFile_FAIL;
|
||
}
|
||
|
||
enum SimpleFileStatus file_open_name(char const * path, struct SimpleFile * file)
|
||
{
|
||
char dirname[MAX_DIR_LENGTH];
|
||
char const * filename = file_of(path);
|
||
dir_of(&dirname[0], path);
|
||
|
||
file_write_flush();
|
||
|
||
//printf("filename:%s dirname:%s ", filename,&dirname[0]);
|
||
|
||
struct SimpleDirEntry * entry = dir_entries(&dirname[0]);
|
||
return file_open_name_in_dir(entry,filename, file);
|
||
}
|
||
|
||
enum SimpleFileStatus file_open_dir(struct SimpleDirEntry * dir, struct SimpleFile * file)
|
||
{
|
||
FRESULT res;
|
||
... | ... | |
begin = begin->next;
|
||
}*/
|
||
|
||
sort_ll((struct SimpleDirEntry *) dir_cache);
|
||
if (filter)
|
||
{
|
||
sort_ll((struct SimpleDirEntry *) dir_cache);
|
||
}
|
||
return (struct SimpleDirEntry *) dir_cache;
|
||
}
|
||
|
firmware/main.c | ||
---|---|---|
// 0x420000-0x43FFFF (0xc20000 in zpu space) = freeze backup
|
||
|
||
struct SimpleFile * files[5];
|
||
void loadromfile(struct SimpleFile * file, int size, void * ram_address)
|
||
{
|
||
ram_address += 0x800000;
|
||
int read = 0;
|
||
file_read(file, ram_address, size, &read);
|
||
}
|
||
|
||
void loadrom(char const * path, int size, void * ram_address)
|
||
{
|
||
ram_address += 0x800000;
|
||
if (SimpleFile_OK == file_open_name(path, files[4]))
|
||
{
|
||
int read = 0;
|
||
file_read(files[4], ram_address, size, &read);
|
||
loadromfile(files[4], size, ram_address);
|
||
}
|
||
}
|
||
|
||
void loadrom_indir(struct SimpleDirEntry * entries, char const * filename, int size, void * ram_address)
|
||
{
|
||
if (SimpleFile_OK == file_open_name_in_dir(entries, filename, files[4]))
|
||
{
|
||
loadromfile(files[4], size, ram_address);
|
||
}
|
||
}
|
||
|
||
int main(void)
|
||
{
|
||
/* spiInit();
|
||
set_spi_clock_freq();
|
||
mmcReadLoop();*/
|
||
|
||
/* spiInit();
|
||
set_spi_clock_freq();
|
||
char buffer[512];
|
||
while (1)
|
||
{
|
||
mmcReadLoop();
|
||
wait_us(500);
|
||
}*/
|
||
|
||
int i;
|
||
for (i=0; i!=5; ++i)
|
||
{
|
||
... | ... | |
// printf("DIR init ok\n");
|
||
init_drive_emulator();
|
||
|
||
loadrom("xlorig.rom",0x4000, (void *)0x704000);
|
||
loadrom("xlhias.rom",0x4000, (void *)0x708000);
|
||
loadrom("ultimon.rom",0x4000, (void *)0x70c000);
|
||
loadrom("osbhias.rom",0x4000, (void *)0x710000);
|
||
loadrom("osborig.rom",0x2800, (void *)0x715800);
|
||
loadrom("osaorig.rom",0x2800, (void *)0x719800);
|
||
loadrom("ataribas.rom",0x2000,(void *)0x700000);
|
||
|
||
struct SimpleDirEntry * entries = dir_entries("");
|
||
|
||
loadrom_indir(entries,"xlorig.rom",0x4000, (void *)0x704000);
|
||
loadrom_indir(entries,"xlhias.rom",0x4000, (void *)0x708000);
|
||
loadrom_indir(entries,"ultimon.rom",0x4000, (void *)0x70c000);
|
||
loadrom_indir(entries,"osbhias.rom",0x4000, (void *)0x710000);
|
||
loadrom_indir(entries,"osborig.rom",0x2800, (void *)0x715800);
|
||
loadrom_indir(entries,"osaorig.rom",0x2800, (void *)0x719800);
|
||
loadrom_indir(entries,"ataribas.rom",0x2000,(void *)0x700000);
|
||
|
||
//ROM = xlorig.rom,0x4000, (void *)0x704000
|
||
//ROM = xlhias.rom,0x4000, (void *)0x708000
|
firmware/native/mmc.c | ||
---|---|---|
/// Returns zero if successful.
|
||
u08 mmcRead(u32 sector)
|
||
{
|
||
fprintf(stderr,"mmcRead:%x\n",sector);
|
||
//fprintf(stderr,"mmcRead:%x\n",sector);
|
||
|
||
fseek(disk_image, sector*512, SEEK_SET);
|
||
fread(&mmc_sector_buffer,512,1,disk_image);
|
firmware/regs.c | ||
---|---|---|
|
||
int volatile * zpu_board = (int *)(12*4+config_regbase);
|
||
|
||
int volatile * zpu_spi_dma = (int *)(13*4+config_regbase);
|
||
|
||
unsigned char volatile * zpu_pokey_audf0 = (unsigned char *)(0x10*4+config_regbase);
|
||
unsigned char volatile * zpu_pokey_audc0 = (unsigned char *)(0x11*4+config_regbase);
|
||
unsigned char volatile * zpu_pokey_audf1 = (unsigned char *)(0x12*4+config_regbase);
|
firmware/regs.h | ||
---|---|---|
extern int volatile * zpu_spi_state;
|
||
extern int volatile * zpu_sio;
|
||
extern int volatile * zpu_board;
|
||
|
||
extern int volatile * zpu_spi_dma;
|
||
|
||
extern unsigned char volatile * zpu_pokey_audf0;
|
||
extern unsigned char volatile * zpu_pokey_audc0;
|
firmware/sd_direct/mmc.c | ||
---|---|---|
u16 i;
|
||
u08 *buffer=mmc_sector_buffer; //natvrdo!
|
||
|
||
i=0x80; //512
|
||
spiReceiveData(buffer,buffer+512);
|
||
//spiReceiveData(buffer,buffer+3);
|
||
|
||
/* i=0x80; //512
|
||
do { *buffer++ = spiTransferFF(); i--; } while(i);
|
||
|
||
//spiDisplay(1);
|
||
... | ... | |
do { *buffer++ = spiTransferFF(); i--; } while(i);
|
||
|
||
i=0x80; //512
|
||
do { *buffer++ = spiTransferFF(); i--; } while(i);
|
||
do { *buffer++ = spiTransferFF(); i--; } while(i);*/
|
||
|
||
//spiDisplay(0);
|
||
|
firmware/sd_direct/spi.c | ||
---|---|---|
display = i;
|
||
}
|
||
|
||
void spiReceiveData(u08 * from, u08 * to)
|
||
{
|
||
u32 from32 = (u32)from;
|
||
u32 to32 = (u32)to;
|
||
u32 val = to32<<16 | from32;
|
||
*zpu_spi_dma = val;
|
||
}
|
||
|
firmware/sd_direct/spi.h | ||
---|---|---|
|
||
void spiDisplay(int i);
|
||
|
||
void spiReceiveData(u08 * from, u08 * to);
|
||
|
||
#endif
|
firmware/simpledir.h | ||
---|---|---|
struct SimpleDirEntry;
|
||
|
||
enum SimpleFileStatus file_open_name(char const * path, struct SimpleFile * file);
|
||
enum SimpleFileStatus file_open_name_in_dir(struct SimpleDirEntry * entries, char const * filename, struct SimpleFile * file);
|
||
enum SimpleFileStatus file_open_dir(struct SimpleDirEntry * filename, struct SimpleFile * file);
|
||
|
||
// Reads entire dir into memory (i.e. give it a decent chunk of sdram)
|
firmware/test_file.c | ||
---|---|---|
|
||
struct SimpleFile * temp_file;
|
||
|
||
void loadrom(char const * path, int size, void * ram_address)
|
||
/*void loadrom(char const * path, int size, void * ram_address)
|
||
{
|
||
filter = 0;
|
||
fprintf(stderr,"loadrom:%s\n",path);
|
||
... | ... | |
if (SimpleFile_OK == file_open_name(path, temp_file))
|
||
{
|
||
int read = 0;
|
||
//file_read(files[4], ram_address, size, &read);
|
||
//file_read(temp_file, ram_address, size, &read);
|
||
printf("file_read:%s %x %x\n",file_name(temp_file), ram_address,size);
|
||
}
|
||
else
|
||
{
|
||
printf("%s:FAILED\n",path);
|
||
}
|
||
}*/
|
||
|
||
void loadromfile(struct SimpleFile * file, int size, void * ram_address)
|
||
{
|
||
ram_address += 0x800000;
|
||
int read = 0;
|
||
//file_read(file, ram_address, size, &read);
|
||
printf("file_read:%s %x %x\n",file_name(temp_file), ram_address,size);
|
||
}
|
||
|
||
void loadrom(char const * path, int size, void * ram_address)
|
||
{
|
||
if (SimpleFile_OK == file_open_name(path, temp_file))
|
||
{
|
||
loadromfile(temp_file, size, ram_address);
|
||
}
|
||
else
|
||
{
|
||
printf("%s:FAILED\n",path);
|
||
}
|
||
}
|
||
|
||
void loadrom_indir(struct SimpleDirEntry * entries, char const * filename, int size, void * ram_address)
|
||
{
|
||
if (SimpleFile_OK == file_open_name_in_dir(entries, filename, temp_file))
|
||
{
|
||
loadromfile(temp_file, size, ram_address);
|
||
}
|
||
else
|
||
{
|
||
printf("FAILED\n");
|
||
}
|
||
}
|
||
... | ... | |
loadrom("osaorig.rom",0x2800, (void *)0x719800);
|
||
loadrom("ataribas.rom",0x2000,(void *)0x700000);
|
||
|
||
{
|
||
printf("WTF\n");
|
||
struct SimpleDirEntry * entries = dir_entries("");
|
||
|
||
loadrom_indir(entries,"xlorig.rom",0x4000, (void *)0x704000);
|
||
loadrom_indir(entries,"xlhias.rom",0x4000, (void *)0x708000);
|
||
loadrom_indir(entries,"ultimon.rom",0x4000, (void *)0x70c000);
|
||
loadrom_indir(entries,"osbhias.rom",0x4000, (void *)0x710000);
|
||
loadrom_indir(entries,"osborig.rom",0x2800, (void *)0x715800);
|
||
loadrom_indir(entries,"osaorig.rom",0x2800, (void *)0x719800);
|
||
loadrom_indir(entries,"ataribas.rom",0x2000,(void *)0x700000);
|
||
}
|
||
|
||
entry = dir_entries("/DCIM");
|
||
entry = dir_next(entry);
|
||
fprintf(stderr, " Name:%s", dir_filename(entry));
|
Also available in: Unified diff
Booting 1 second slower than Atari - not bad given also loading several ROMS from SD - can of course be further improved