o can boot turrican

This commit is contained in:
david 2009-06-09 15:32:56 +02:00
parent 66a592eeff
commit c30e626a3f
5 changed files with 33 additions and 23 deletions

View File

@ -33,7 +33,7 @@ OBJS=hook.obj StartupSnes.obj main.obj pad.obj PPU.obj debug.obj ressource.obj d
APP=fatfs.smc APP=fatfs.smc
GFX=debugfont GFX=debugfont
all: $(APP) all: $(APP) repair
run: run:
$(EMU) $(APP) $(EMU) $(APP)

View File

@ -20,4 +20,4 @@
#define SHARED_ADDR 0x3d0000 #define SHARED_ADDR 0x3d0000
#define MMIO_DEBUG #undef MMIO_DEBUG

View File

@ -36,8 +36,8 @@ void debug_enable(void){
// Font Color // Font Color
// hex(24 << 10 | 24 << 5 | 24 ) = '0x6318' // hex(24 << 10 | 24 << 5 | 24 ) = '0x6318'
*(byte*) 0x2121 = 0x02; *(byte*) 0x2121 = 0x02;
*(byte*) 0x2122 = 0x18; *(byte*) 0x2122 = 0xff;
*(byte*) 0x2122 = 0x63; *(byte*) 0x2122 = 0x7f;
// Font Border Color // Font Border Color
*(byte*) 0x2121 = 0x00; *(byte*) 0x2121 = 0x00;
@ -45,10 +45,9 @@ void debug_enable(void){
*(byte*) 0x2122 = 0x00; *(byte*) 0x2122 = 0x00;
// Background Color // Background Color
//hex( 32 << 10 | 10 << 5 | 10) = '0x814a'
*(byte*) 0x2121 = 0x01; *(byte*) 0x2121 = 0x01;
*(byte*) 0x2122 = 0x4a; *(byte*) 0x2122 = 0x05;
*(byte*) 0x2122 = 0x81; *(byte*) 0x2122 = 0x29;
} }
@ -93,7 +92,9 @@ void _print_screen(word y, char *buffer){
*(byte*)0x2118 = *buffer-32; *(byte*)0x2118 = *buffer-32;
x++; x++;
buffer++; buffer++;
#if 0
waitForVBlank(); waitForVBlank();
#endif
} }
} }
void _print_console(const char *buffer){ void _print_console(const char *buffer){

View File

@ -26,12 +26,14 @@ o direct writeto mempage
*/ */
#define ROM_NAME "MRDO.SMC" #define ROM_NAME "TURRICAN.SMC"
#define BLOCK_SIZE 512 #define BLOCK_SIZE 512
#define BANK_SIZE 32768L #define BANK_SIZE 32768L
#define BANK_COUNT 8 #define BANK_COUNT 16
#define BASE_ADDR 0x008000 #define BASE_ADDR 0x008000
typedef void (*FUNC)(void);
padStatus pad1; padStatus pad1;
DWORD acc_size; /* Work register for fs command */ DWORD acc_size; /* Work register for fs command */
WORD acc_files, acc_dirs; WORD acc_files, acc_dirs;
@ -132,12 +134,13 @@ void wait(void)
printfc("SNES::wait: done\n"); printfc("SNES::wait: done\n");
} }
void boot(void) void boot(DWORD addr)
{ {
FUNC fn;
printfc("SNES::boot addr=%lx\n",addr);
fn = (FUNC) addr;
fn();
#asm
jsl $008000
#endasm
} void main(void) } void main(void)
{ {
word i, j; word i, j;
@ -152,7 +155,6 @@ void boot(void)
printfc("SNES::main: Try to init disk\n"); printfc("SNES::main: Try to init disk\n");
put_rc(f_mount((BYTE)0, &fatfs[0])); put_rc(f_mount((BYTE)0, &fatfs[0]));
#if 0
printfs(0, "FATFS OPTIXX.ORG "); printfs(0, "FATFS OPTIXX.ORG ");
printfc("SNES::main: Try to get free\n"); printfc("SNES::main: Try to get free\n");
res = f_getfree("", &p2, &fs); res = f_getfree("", &p2, &fs);
@ -182,6 +184,7 @@ void boot(void)
cnt = 0; cnt = 0;
wait(); wait();
clears(); clears();
#if 0
printfc("SNES::main: read dir\n"); printfc("SNES::main: read dir\n");
for (;;) { for (;;) {
res = f_readdir(&dir, &finfo); res = f_readdir(&dir, &finfo);
@ -237,8 +240,6 @@ void boot(void)
cnt = BLOCK_SIZE; cnt = BLOCK_SIZE;
p1 -= BLOCK_SIZE; p1 -= BLOCK_SIZE;
res = f_read(&file1, (byte *) (addr), cnt, &s2); res = f_read(&file1, (byte *) (addr), cnt, &s2);
printfc("SNES::main: read cnt=%i p1=%li p2=%li s2=%i\n", cnt,
p1, p2, s2);
if (res != FR_OK) { if (res != FR_OK) {
@ -251,7 +252,6 @@ void boot(void)
printfc("SNES::main: read cnt=%i s2=%i\n", cnt, s2); printfc("SNES::main: read cnt=%i s2=%i\n", cnt, s2);
break; break;
} }
printfs(1 + bank, "CRC 0000 BANK %X ADDR %lX",bank, addr);
#if 0 #if 0
printc_packet(addr, 512, (byte *) (addr)); printc_packet(addr, 512, (byte *) (addr));
@ -259,17 +259,26 @@ void boot(void)
#endif #endif
addr += s2; addr += s2;
if (addr % 0x10000 == 0) { if (addr % 0x10000 == 0) {
printfc("SNES::main: read cnt=%u p1=%lu p2=%lu s2=%u \n", cnt,
p1, p2, s2);
#if 0
crc = crc_update_mem(crc_addr,0x8000); crc = crc_update_mem(crc_addr,0x8000);
printfc("addr=%lx crc=%x\n",crc_addr,crc); printfc("addr=%lx crc=%x\n",crc_addr,crc);
printfs(1 + bank, "CRC %X BANK %X ADDR %LX",crc, bank, addr);
addr += 0x8000;
crc_addr+=0x8000; crc_addr+=0x8000;
#endif
printfs(1 + bank, "BANK %i ADDR 0X%lx ", bank, addr);
addr += 0x8000;
bank++; bank++;
} }
} }
put_rc(f_close(&file1)); put_rc(f_close(&file1));
boot(); addr = *(byte *)0xFFFD;
addr = addr << 8;
addr |= (*(byte *)0xFFFC);
boot(addr);
while (1) { while (1) {
wait(); wait();
} }

View File

@ -19,4 +19,4 @@
#undef MMIO_DEBUG #undef MMIO_DEBUG
#undef FATFS_DEBUG #undef FATFS_DEBUG
#define DISKIO_DEBUG 1 #undef DISKIO_DEBUG 1