From f0b0265b7f6015e73728ba9003fa23e4b1ca275f Mon Sep 17 00:00:00 2001 From: n-a-c-h <> Date: Fri, 7 Oct 2005 03:05:04 +0000 Subject: [PATCH] SPC700 fixes [pagefault]. DMA fix [pagefault]. cleanup [Nach]. --- zsnes/src/cpu/dma.asm | 4 +-- zsnes/src/cpu/execute.asm | 5 ++- zsnes/src/cpu/regs.inc | 12 +++----- zsnes/src/cpu/spc700.asm | 64 ++------------------------------------- 4 files changed, 11 insertions(+), 74 deletions(-) diff --git a/zsnes/src/cpu/dma.asm b/zsnes/src/cpu/dma.asm index 05c4646c..7b023aab 100644 --- a/zsnes/src/cpu/dma.asm +++ b/zsnes/src/cpu/dma.asm @@ -22,7 +22,7 @@ EXTSYM memtabler8,regptw,snesmap2,snesmmap,memtablew8,regptr,memtabler16 EXTSYM dmadata,hdmatype,nexthdma,resolutn -EXTSYM curhdma,curypos,disablehdma,hdmadata,hdmadelay,hdmaearlstart +EXTSYM curhdma,curypos,disablehdma,hdmadata,hdmadelay ;******************************************************* ; Transfer DMA Inits & Transfers DMA @@ -859,7 +859,7 @@ NEWSYM reg420Cw jz .notransh call setuphdma .notransh - mov bl,[hdmaearlstart] + mov bl,1 mov [hdmadelay],bl pop edx pop ecx diff --git a/zsnes/src/cpu/execute.asm b/zsnes/src/cpu/execute.asm index 67fbf9da..c402f8dd 100644 --- a/zsnes/src/cpu/execute.asm +++ b/zsnes/src/cpu/execute.asm @@ -33,7 +33,7 @@ EXTSYM SetupPreGame,memtablew8,regaccessbankr8,showmenu,snesmap2,snesmmap EXTSYM DeInitPostGame,spcPCRam,startdebugger,xp,xpb,xpc,tablead,tableadb EXTSYM tableadc,SA1UpdateDPage,Makemode7Table,nextmenupopup,MovieProcessing EXTSYM OSExit,DosExit,InitDir,InitDrive,createnewcfg,sfxramdata,deinitvideo -EXTSYM SFXEnable,wramdata,cycpbl,cycpblt,irqon,spcnumread,spchalted,spcon +EXTSYM SFXEnable,wramdata,cycpbl,cycpblt,irqon,spcnumread,spcon EXTSYM multchange,romispal,scrndis,sprlefttot,sprleftpr,processsprites EXTSYM cachesprites,NextLineStart,FlipWait,LastLineStart,opcjmptab,CheatOn EXTSYM INTEnab,JoyCRead,NMIEnab,NumCheats,CurrentExecSA1,ReadInputDevice @@ -80,8 +80,7 @@ NEWSYM ResetExecStuff mov dword[nmiprevline],224 mov dword[nmistatus],0 mov byte[NextLineCache],0 - mov dword[spcnumread],0 - mov dword[spchalted],-1 + mov byte[spcnumread],0 mov dword[timer2upd],0 mov dword[HIRQCycNext],0 mov byte[HIRQNextExe],0 diff --git a/zsnes/src/cpu/regs.inc b/zsnes/src/cpu/regs.inc index 6f443c43..034b26d8 100644 --- a/zsnes/src/cpu/regs.inc +++ b/zsnes/src/cpu/regs.inc @@ -746,8 +746,7 @@ reg2140r: je .nosound inc dword[SPC700read] mov al,[reg1read] - mov dword[spcnumread],0 -; mov dword[spchalted],-1 + mov byte[spcnumread],0 ret .nosound ; Find for D0 @@ -786,8 +785,7 @@ reg2141r: je .nosound inc dword[SPC700read] mov al,[reg2read] - mov dword[spcnumread],0 -; mov dword[spchalted],-1 + mov byte[spcnumread],0 ret .nosound ; Find for D0 @@ -818,8 +816,7 @@ reg2142r: je .nosound inc dword[SPC700read] mov al,[reg3read] - mov dword[spcnumread],0 -; mov dword[spchalted],-1 + mov byte[spcnumread],0 ret .nosound ; Find for D0 @@ -849,8 +846,7 @@ reg2143r: je .nosound inc dword[SPC700read] mov al,[reg4read] - mov dword[spcnumread],0 -; mov dword[spchalted],-1 + mov byte[spcnumread],0 ret .nosound ; Find for D0 diff --git a/zsnes/src/cpu/spc700.asm b/zsnes/src/cpu/spc700.asm index 5f15b4e7..8e5449bc 100644 --- a/zsnes/src/cpu/spc700.asm +++ b/zsnes/src/cpu/spc700.asm @@ -22,8 +22,8 @@ %include "macros.mac" -EXTSYM DSPMem,spcWptr,disablespcclr,SPCSkipXtraROM,SPC700sh,cycpbl,spcRptr -EXTSYM spc700read,dspWptr,curexecstate,tableadb +EXTSYM DSPMem,spcWptr,disablespcclr,SPCSkipXtraROM,cycpbl,spcRptr +EXTSYM spc700read,dspWptr,curexecstate %include "cpu/regsw.mac" %include "cpu/spcdef.inc" @@ -224,8 +224,6 @@ NEWSYM updatetimer mov [timinl0],al cmp byte[SPCRAM+0FDh],1 jne .noin0 -; cmp byte[spchalted],0 -; jz .noin0 reenablespc mov dword[cycpbl],0 .noin0 @@ -238,8 +236,6 @@ NEWSYM updatetimer mov [timinl1],al cmp byte[SPCRAM+0FEh],1 jne .noin1 -; cmp byte[spchalted+1],0 -; jz .noin1 reenablespc mov dword[cycpbl],0 .noin1 @@ -253,8 +249,6 @@ NEWSYM updatetimer mov [timinl2],al cmp byte[SPCRAM+0FFh],1 jne .noin2 -; cmp byte[spchalted+2],0 -; jz .noin2 reenablespc mov dword[cycpbl],0 .noin2 @@ -265,8 +259,6 @@ NEWSYM updatetimer mov [timinl2],al cmp byte[SPCRAM+0FFh],1 jne .noin2b -; cmp byte[spchalted+2],0 -; jz .noin2b reenablespc mov dword[cycpbl],0 .noin2b @@ -277,8 +269,6 @@ NEWSYM updatetimer mov [timinl2],al cmp byte[SPCRAM+0FFh],1 jne .noin2c -; cmp byte[spchalted+2],0 -; jz .noin2c reenablespc mov dword[cycpbl],0 .noin2c @@ -289,8 +279,6 @@ NEWSYM updatetimer mov [timinl2],al cmp byte[SPCRAM+0FFh],1 jne .noin2d -; cmp byte[spchalted+2],0 -; jz .noin2d reenablespc mov dword[cycpbl],0 .noin2d @@ -479,75 +467,29 @@ NEWSYM RSPCRegFC mov al,[SPCRAM+0fch] ret -%macro skipmacro 1 -.spcnextskip - test byte[timeron],1<<%1 - je .ret - cmp byte[timincr0+%1],0 - je .ret - ;cmp byte[SpeedHack],0 - ;je .ret - inc byte[spcnumread+%1] - cmp byte[spcnumread+%1],8h - je near haltspc -.ret - ret -%endmacro - -ALIGN16 -NEWSYM haltspc - cmp byte[SPC700sh],1 - je .nochangestate - mov dword[cycpbl],0FFFFFFFFh - test byte[curexecstate],02h - jz .nochangestate - and byte[curexecstate],0FDh - push ebx - - mov ebx,[spcnumread] - mov [spchalted],ebx - - xor ebx,ebx - mov bl,dl - mov edi,[tableadb+ebx*4] - pop ebx -.nochangestate - mov dword[spcnumread],0 - ret - NEWSYM RSPCRegFD mov al,[SPCRAM+0fdh] and al,0Fh - cmp byte[SPCRAM+0fdh],0 - je .spcnextskip mov byte[SPCRAM+0fdh],0 mov byte[spcnumread],0 ret - skipmacro 0 NEWSYM RSPCRegFE mov al,[SPCRAM+0feh] and al,0Fh - cmp byte[SPCRAM+0feh],0 - je .spcnextskip mov byte[SPCRAM+0feh],0 mov byte[spcnumread],0 ret - skipmacro 1 NEWSYM RSPCRegFF mov al,[SPCRAM+0ffh] and al,0Fh - cmp byte[SPCRAM+0ffh],0 - je .spcnextskip mov byte[SPCRAM+0ffh],0 mov byte[spcnumread],0 ret - skipmacro 2 SECTION .data -NEWSYM spcnumread, dd 0 -NEWSYM spchalted, dd 0 +NEWSYM spcnumread, db 0 SECTION .text %macro SPCSetFlagnzc 0