From c30e626a3ff2c4428bed5022bace6b332868d45c Mon Sep 17 00:00:00 2001 From: david Date: Tue, 9 Jun 2009 15:32:56 +0200 Subject: [PATCH] o can boot turrican --- snes/fatfstest/Makefile | 2 +- snes/fatfstest/config.h | 2 +- snes/fatfstest/debug.c | 11 ++++++----- snes/fatfstest/main.c | 35 +++++++++++++++++++++------------ tools/bsnes/chip/fatfs/config.h | 6 +++--- 5 files changed, 33 insertions(+), 23 deletions(-) diff --git a/snes/fatfstest/Makefile b/snes/fatfstest/Makefile index 52cc157..88aa9cc 100644 --- a/snes/fatfstest/Makefile +++ b/snes/fatfstest/Makefile @@ -33,7 +33,7 @@ OBJS=hook.obj StartupSnes.obj main.obj pad.obj PPU.obj debug.obj ressource.obj d APP=fatfs.smc GFX=debugfont -all: $(APP) +all: $(APP) repair run: $(EMU) $(APP) diff --git a/snes/fatfstest/config.h b/snes/fatfstest/config.h index 83c4e82..60ed27a 100644 --- a/snes/fatfstest/config.h +++ b/snes/fatfstest/config.h @@ -20,4 +20,4 @@ #define SHARED_ADDR 0x3d0000 -#define MMIO_DEBUG +#undef MMIO_DEBUG diff --git a/snes/fatfstest/debug.c b/snes/fatfstest/debug.c index a53ff70..b7d70c9 100644 --- a/snes/fatfstest/debug.c +++ b/snes/fatfstest/debug.c @@ -36,8 +36,8 @@ void debug_enable(void){ // Font Color // hex(24 << 10 | 24 << 5 | 24 ) = '0x6318' *(byte*) 0x2121 = 0x02; - *(byte*) 0x2122 = 0x18; - *(byte*) 0x2122 = 0x63; + *(byte*) 0x2122 = 0xff; + *(byte*) 0x2122 = 0x7f; // Font Border Color *(byte*) 0x2121 = 0x00; @@ -45,10 +45,9 @@ void debug_enable(void){ *(byte*) 0x2122 = 0x00; // Background Color - //hex( 32 << 10 | 10 << 5 | 10) = '0x814a' *(byte*) 0x2121 = 0x01; - *(byte*) 0x2122 = 0x4a; - *(byte*) 0x2122 = 0x81; + *(byte*) 0x2122 = 0x05; + *(byte*) 0x2122 = 0x29; } @@ -93,7 +92,9 @@ void _print_screen(word y, char *buffer){ *(byte*)0x2118 = *buffer-32; x++; buffer++; +#if 0 waitForVBlank(); +#endif } } void _print_console(const char *buffer){ diff --git a/snes/fatfstest/main.c b/snes/fatfstest/main.c index 31b8c8e..6f7ad6e 100644 --- a/snes/fatfstest/main.c +++ b/snes/fatfstest/main.c @@ -26,12 +26,14 @@ o direct writeto mempage */ -#define ROM_NAME "MRDO.SMC" +#define ROM_NAME "TURRICAN.SMC" #define BLOCK_SIZE 512 #define BANK_SIZE 32768L -#define BANK_COUNT 8 +#define BANK_COUNT 16 #define BASE_ADDR 0x008000 +typedef void (*FUNC)(void); + padStatus pad1; DWORD acc_size; /* Work register for fs command */ WORD acc_files, acc_dirs; @@ -132,12 +134,13 @@ void wait(void) 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) { word i, j; @@ -152,7 +155,6 @@ void boot(void) printfc("SNES::main: Try to init disk\n"); put_rc(f_mount((BYTE)0, &fatfs[0])); -#if 0 printfs(0, "FATFS OPTIXX.ORG "); printfc("SNES::main: Try to get free\n"); res = f_getfree("", &p2, &fs); @@ -182,6 +184,7 @@ void boot(void) cnt = 0; wait(); clears(); +#if 0 printfc("SNES::main: read dir\n"); for (;;) { res = f_readdir(&dir, &finfo); @@ -237,8 +240,6 @@ void boot(void) cnt = BLOCK_SIZE; p1 -= BLOCK_SIZE; 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) { @@ -251,7 +252,6 @@ void boot(void) printfc("SNES::main: read cnt=%i s2=%i\n", cnt, s2); break; } - printfs(1 + bank, "CRC 0000 BANK %X ADDR %lX",bank, addr); #if 0 printc_packet(addr, 512, (byte *) (addr)); @@ -259,17 +259,26 @@ void boot(void) #endif addr += s2; + 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); 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; +#endif + printfs(1 + bank, "BANK %i ADDR 0X%lx ", bank, addr); + + addr += 0x8000; bank++; } } put_rc(f_close(&file1)); - boot(); + addr = *(byte *)0xFFFD; + addr = addr << 8; + addr |= (*(byte *)0xFFFC); + boot(addr); while (1) { wait(); } diff --git a/tools/bsnes/chip/fatfs/config.h b/tools/bsnes/chip/fatfs/config.h index ff78237..c0f00db 100644 --- a/tools/bsnes/chip/fatfs/config.h +++ b/tools/bsnes/chip/fatfs/config.h @@ -17,6 +17,6 @@ #define SHARED_MAX_SIZE 32768 #define SHARED_ADDR 0x3d0000 -#undef MMIO_DEBUG -#undef FATFS_DEBUG -#define DISKIO_DEBUG 1 \ No newline at end of file +#undef MMIO_DEBUG +#undef FATFS_DEBUG +#undef DISKIO_DEBUG 1 \ No newline at end of file