X-Git-Url: https://notaz.gp2x.de/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=x6502.c;h=786af607083aae743c42dafd5cca2c675f72b3ac;hb=a384bf449483e62637ce05a60ff4b06730a19934;hp=57f8a009280baa2e3169ea446edae887416bb64c;hpb=0b65fdb3548fd54670265adfb80706e63da6b641;p=fceu.git diff --git a/x6502.c b/x6502.c index 57f8a00..786af60 100644 --- a/x6502.c +++ b/x6502.c @@ -24,6 +24,7 @@ #include "x6502.h" #include "fce.h" #include "sound.h" +#include "sound098.h" #include "cart.h" #include "dprintf.h" @@ -64,13 +65,21 @@ uint32 timestamp; static INLINE uint8 RdMem(unsigned int A) { int _DB1=ARead[A](A); - /*if (A >= 0x2000)*/ _DB=_DB1; #ifdef DEBUG_ASM_6502 + //_DB=_DB1; //printf("a == %x, pc == %x\n", A, _PC); - if (A >= 0x2000 && A != _PC && A != _PC - 1 && A != _PC + 1) { + if (A >= 0x2000) { + if (A == _PC || A == _PC - 1 || A == _PC + 1) { + //printf("fr: %02x\n", _DB1); + } + _DB=_DB1; + } + if (A >= 0x2000 && A != _PC - 1) { dreads[dread_count_c++] = _DB1; if (dread_count_c > 4) { printf("dread_count out of range\n"); exit(1); } } +#else + _DB=_DB1; #endif return _DB1; } @@ -92,7 +101,11 @@ static INLINE void WrMem(unsigned int A, uint8 V) static INLINE uint8 RdRAM(unsigned int A) { //return((_DB=RAM[A])); - return((_DB=RAM[A])); + int _DB1=RAM[A]; +#ifndef DEBUG_ASM_6502 + _DB=_DB1; +#endif + return _DB1; } static INLINE void WrRAM(unsigned int A, uint8 V) @@ -367,6 +380,7 @@ static uint8 ZNTable[256] = { static uint8 CycTable[256] = { +/* 0 1 2 3 4 5 6 7 8 9 a b c d e f */ /*0x00*/ 7,6,2,8,3,3,5,5,3,2,2,2,4,4,6,6, /*0x10*/ 2,5,2,8,4,4,6,6,2,4,2,7,4,4,7,7, /*0x20*/ 6,6,2,8,3,3,5,5,4,2,2,2,4,4,6,6, @@ -402,15 +416,6 @@ void TriggerIRQ_c(void) /* This function should probably be phased out. */ _IRQlow|=FCEU_IQTEMP; } -void TriggerNMINSF_c(void) -{ - ADDCYC(7); - PUSH(_PC>>8); - PUSH(_PC); - PUSH((_P&~B_FLAG)|(U_FLAG)); - _PC=0x3800; -} - void TriggerNMI_c(void) { _IRQlow|=FCEU_IQNMI; @@ -508,10 +513,18 @@ void X6502_Run_c(void/*int32 cycles*/) } } _PI=_P; +#ifdef DEBUG_ASM_6502 + b1=RdMem(_PC++); _PC--; +#else b1=RdMem(_PC); +#endif ADDCYC(CycTable[b1]); temp=_tcount; + if (use098code) + FCEU_SoundCPUHook098(temp); + else + { temp*=48; fhcnt-=temp; @@ -531,10 +544,11 @@ void X6502_Run_c(void/*int32 cycles*/) { extern uint8 SIRQStat; SIRQStat|=0x80; - X6502_IRQBegin_c(FCEU_IQDPCM); + X6502_IRQBegin(FCEU_IQDPCM); } } } + } #ifdef DEBUG_ASM_6502 PC_prev = _PC;