From 4f8e258710ad99742dd3a2462864b33a55bee285 Mon Sep 17 00:00:00 2001 From: david Date: Wed, 24 Jun 2009 09:27:00 +0200 Subject: [PATCH] add some irq testing in c code --- snes/fatfstest/StartupSnes.asm | 23 ++++++++++++++++++++--- snes/fatfstest/main.c | 25 +++++++++++++++++++------ tools/bsnes/chip/cmmio/cmmio.cpp | 7 +++++-- 3 files changed, 44 insertions(+), 11 deletions(-) diff --git a/snes/fatfstest/StartupSnes.asm b/snes/fatfstest/StartupSnes.asm index 58f91d5..2bf9075 100644 --- a/snes/fatfstest/StartupSnes.asm +++ b/snes/fatfstest/StartupSnes.asm @@ -124,8 +124,8 @@ START: cli ; Enable interrupts - ;lda #$81 - ;sta $4200 + ;;lda #$01 + ;;sta $4200 rep #$30 longa on @@ -136,7 +136,19 @@ START: XDEF IRQ IRQ: - XREF ~~IRQHandler + ;LONGA ON + ;LONGI ON + rep #$10 + sep #$20 + lda #65 + sta $3000 + rep #$30 + ;LONGA OFF + ;LONGI OFF + rti + + + XREF ~~IRQHandler LONGA ON LONGI ON rep #$30 @@ -151,6 +163,11 @@ IRQ: XDEF NMI NMI: + rep #$30 + lda #66 + sta $3000 + sep #$30 ; X,Y,A are 8 bit numbers + rti XREF ~~NMIHandler LONGA ON LONGI ON diff --git a/snes/fatfstest/main.c b/snes/fatfstest/main.c index 7ff04c0..83c2435 100644 --- a/snes/fatfstest/main.c +++ b/snes/fatfstest/main.c @@ -94,7 +94,9 @@ void preInit(void) // For testing purpose ... // Insert code here to be executed before register init -} DWORD get_fattime() +} + +DWORD get_fattime() { time_t rawtime; struct tm *ptm; @@ -184,19 +186,30 @@ void boot(DWORD addr) *(byte *) 0x2100 = 0x0f; // enable background debug_enable(); - printfc("SNES::main: Try to init disk\n"); - put_rc(f_mount((BYTE) 0, &fatfs[0])); - + printfc("SNES::main: init\n"); #if 0 + i = 0; + printfc("SNES::main: wait for irq\n"); while(1){ if (irq_triggered) handle_irq(); if (nmi_triggered) handle_nmi(); + /* + if (i++==30){ + printfc("SNES::main: poll\n"); + i=0; + } + waitForVBlank(); + */ } #endif -#if 0 + printfc("SNES::main: Try to init disk\n"); + put_rc(f_mount((BYTE) 0, &fatfs[0])); + + +#if 1 printfs(0, "FATFS OPTIXX.ORG "); printfc("SNES::main: Try to get free\n"); @@ -236,7 +249,7 @@ void boot(DWORD addr) #if 0 printfc("SNES::main: read dir\n"); for (;;) { - res = f_readdir(&dir, &finfo); + res = f_readdir(&dir, &finfo);make if ((res != FR_OK) || !finfo.fname[0]) break; if (finfo.fattrib & AM_DIR) { diff --git a/tools/bsnes/chip/cmmio/cmmio.cpp b/tools/bsnes/chip/cmmio/cmmio.cpp index 6a1c791..0ed13c9 100644 --- a/tools/bsnes/chip/cmmio/cmmio.cpp +++ b/tools/bsnes/chip/cmmio/cmmio.cpp @@ -28,19 +28,22 @@ uint8 CMMIO::mmio_read(unsigned addr) { void CMMIO::mmio_write(unsigned addr, uint8 data) { addr &= 0xffff; - //printf("CMMIO::mmio_write 0x%04x 0x%02x (%i)\n",addr,data,data); //fflush(stdout); + //printf("CMMIO::mmio_write 0x%04x 0x%02x (%i)\n",addr,data,data); /* debug to stderr */ if (addr == 0x3000){ fprintf(stderr,"%c",data); fflush(stderr); + } + +#if 0 if (addr == 0x3001){ fprintf(stderr,"Trigger IRQ\n"); fflush(stderr); cpu.triggerIRQ(); } - +#endif } CMMIO::CMMIO() {