📄 fxemu2b.asm
字号:
;Copyright (C) 1997-2007 ZSNES Team ( zsKnight, _Demo_, pagefault, Nach );;http://www.zsnes.com;http://sourceforge.net/projects/zsnes;https://zsnes.bountysource.com;;This program is free software; you can redistribute it and/or;modify it under the terms of the GNU General Public License;version 2 as published by the Free Software Foundation.;;This program is distributed in the hope that it will be useful,;but WITHOUT ANY WARRANTY; without even the implied warranty of;MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the;GNU General Public License for more details.;;You should have received a copy of the GNU General Public License;along with this program; if not, write to the Free Software;Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.%include "macros.mac"EXTSYM FxTable,FxTableb,FxTablec,SfxB,SfxCPB,SfxCROM,SfxCarry,SfxOverflowEXTSYM SfxR0,SfxR14,SfxR15,SfxRomBuffer,SfxSignZero,withr15sk%include "chips/fxemu2.mac"%include "chips/fxemu2b.mac"SECTION .textNEWSYM FxOpb05 ; BRA branch always ; Verified. movsx eax,byte[ebp] mov cl,[ebp+1] inc ebp add ebp,eax call [FxTableb+ecx*4] retNEWSYM FxOpb06 ; BGE branch on greater or equals ; Verified. movsx eax,byte[ebp] mov ebx,[SfxSignZero] shr ebx,15 inc ebp xor bl,[SfxOverflow] mov cl,[ebp] test bl,01h jnz .nojump add ebp,eax call [FxTableb+ecx*4] ret.nojump inc ebp call [FxTableb+ecx*4] retNEWSYM FxOpb07 ; BLT branch on lesss than ; Verified. movsx eax,byte[ebp] mov ebx,[SfxSignZero] shr ebx,15 inc ebp xor bl,[SfxOverflow] mov cl,[ebp] test bl,01h jz .nojump add ebp,eax call [FxTableb+ecx*4] ret.nojump inc ebp call [FxTableb+ecx*4] retNEWSYM FxOpb08 ; BNE branch on not equal ; Verified. movsx eax,byte[ebp] inc ebp test dword[SfxSignZero],0FFFFh mov cl,[ebp] jz .nojump add ebp,eax call [FxTableb+ecx*4] ret.nojump inc ebp call [FxTableb+ecx*4] retNEWSYM FxOpb09 ; BEQ branch on equal (z=1) ; Verified. movsx eax,byte[ebp] inc ebp test dword[SfxSignZero],0FFFFh mov cl,[ebp] jnz .nojump add ebp,eax call [FxTableb+ecx*4] ret.nojump inc ebp call [FxTableb+ecx*4] retNEWSYM FxOpb0A ; BPL branch on plus ; Verified. movsx eax,byte[ebp] inc ebp test dword[SfxSignZero],088000h mov cl,[ebp] jnz .nojump add ebp,eax call [FxTableb+ecx*4] ret.nojump inc ebp call [FxTableb+ecx*4] retNEWSYM FxOpb0B ; BMI branch on minus ; Verified. movsx eax,byte[ebp] inc ebp test dword[SfxSignZero],088000h mov cl,[ebp] jz .nojump add ebp,eax call [FxTableb+ecx*4] ret.nojump inc ebp call [FxTableb+ecx*4] retNEWSYM FxOpb0C ; BCC branch on carry clear ; Verified. movsx eax,byte[ebp] inc ebp test byte[SfxCarry],01h mov cl,[ebp] jnz .nojump add ebp,eax call [FxTableb+ecx*4] ret.nojump inc ebp call [FxTableb+ecx*4] retNEWSYM FxOpb0D ; BCS branch on carry set ; Verified. movsx eax,byte[ebp] inc ebp test byte[SfxCarry],01h mov cl,[ebp] jz .nojump add ebp,eax call [FxTableb+ecx*4] ret.nojump inc ebp call [FxTableb+ecx*4] retNEWSYM FxOpb0E ; BVC branch on overflow clear ; Verified. movsx eax,byte[ebp] inc ebp test byte[SfxOverflow],01h mov cl,[ebp] jnz .nojump add ebp,eax call [FxTableb+ecx*4] ret.nojump inc ebp call [FxTableb+ecx*4] retNEWSYM FxOpb0F ; BVS branch on overflow set ; Verified. movsx eax,byte[ebp] inc ebp test byte[SfxOverflow],01h mov cl,[ebp] jz .nojump add ebp,eax call [FxTableb+ecx*4] ret.nojump inc ebp call [FxTableb+ecx*4] retNEWSYM FxOpb10 ; TO RN set register n as destination register TORNb 0NEWSYM FxOpb11 ; TO RN set register n as destination register TORNb 1NEWSYM FxOpb12 ; TO RN set register n as destination register TORNb 2NEWSYM FxOpb13 ; TO RN set register n as destination register TORNb 3NEWSYM FxOpb14 ; TO RN set register n as destination register TORNb 4NEWSYM FxOpb15 ; TO RN set register n as destination register TORNb 5NEWSYM FxOpb16 ; TO RN set register n as destination register TORNb 6NEWSYM FxOpb17 ; TO RN set register n as destination register TORNb 7NEWSYM FxOpb18 ; TO RN set register n as destination register TORNb 8NEWSYM FxOpb19 ; TO RN set register n as destination register TORNb 9NEWSYM FxOpb1A ; TO RN set register n as destination register TORNb 10NEWSYM FxOpb1B ; TO RN set register n as destination register TORNb 11NEWSYM FxOpb1C ; TO RN set register n as destination register TORNb 12NEWSYM FxOpb1D ; TO RN set register n as destination register TORNb 13NEWSYM FxOpb1E ; TO RN set register n as destination register FETCHPIPE test dword[SfxB],1 jnz .VersionB mov edi,SfxR0+14*4 inc ebp mov eax,ebp sub eax,[SfxCPB] mov dword[withr15sk],1 mov [SfxR15],eax call [FxTableb+ecx*4] mov edi,SfxR0 UpdateR14 ret.VersionB mov eax,[esi] ; Read Source mov dword[withr15sk],1 mov [SfxR0+14*4],eax ; Write CLRFLAGS UpdateR14 inc ebp ; Increase program counter retNEWSYM FxOpb1F ; TO RN set register n as destination register FETCHPIPE test dword[SfxB],1 jnz .VersionB mov edi,SfxR0+15*4 inc ebp mov eax,ebp sub eax,[SfxCPB] mov [SfxR15],eax call [FxTableb+ecx*4] mov ebp,[SfxCPB] mov dword[withr15sk],1 add ebp,[SfxR15] mov edi,SfxR0 ret.VersionB mov eax,[esi] ; Read Source mov ebp,[SfxCPB] mov dword[withr15sk],1 add ebp,eax CLRFLAGS retNEWSYM FxOpb3D ; ALT1 set alt1 mode ; Verified. FETCHPIPE mov dword[SfxB],0 or ch,01h inc ebp mov eax,ebp sub eax,[SfxCPB] mov [SfxR15],eax call [FxTableb+ecx*4] xor ch,ch retNEWSYM FxOpb3E ; ALT2 set alt1 mode ; Verified. FETCHPIPE mov dword[SfxB],0 or ch,02h inc ebp mov eax,ebp sub eax,[SfxCPB] mov [SfxR15],eax call [FxTable+ecx*4] xor ch,ch retNEWSYM FxOpb3F ; ALT3 set alt3 mode ; Verified. FETCHPIPE mov dword[SfxB],0 or ch,03h inc ebp mov eax,ebp sub eax,[SfxCPB] mov [SfxR15],eax call [FxTable+ecx*4] xor ch,ch retNEWSYM FxOpbB0 ; FROM rn set source register FROMRNb 0NEWSYM FxOpbB1 ; FROM rn set source register FROMRNb 1NEWSYM FxOpbB2 ; FROM rn set source register FROMRNb 2NEWSYM FxOpbB3 ; FROM rn set source register FROMRNb 3NEWSYM FxOpbB4 ; FROM rn set source register FROMRNb 4NEWSYM FxOpbB5 ; FROM rn set source register FROMRNb 5NEWSYM FxOpbB6 ; FROM rn set source register FROMRNb 6NEWSYM FxOpbB7 ; FROM rn set source register FROMRNb 7NEWSYM FxOpbB8 ; FROM rn set source register FROMRNb 8NEWSYM FxOpbB9 ; FROM rn set source register FROMRNb 9NEWSYM FxOpbBA ; FROM rn set source register FROMRNb 10NEWSYM FxOpbBB ; FROM rn set source register FROMRNb 11NEWSYM FxOpbBC ; FROM rn set source register FROMRNb 12NEWSYM FxOpbBD ; FROM rn set source register FROMRNb 13NEWSYM FxOpbBE ; FROM rn set source register FROMRNb 14NEWSYM FxOpbBF ; FROM rn set source register test dword[SfxB],1 jnz .VersionB mov esi,SfxR0+15*4 inc ebp ; Increase program counter mov eax,ebp sub eax,[SfxCPB] mov [SfxR15],eax call [FxTableb+ecx*4] mov esi,SfxR0 ret.VersionB FETCHPIPE mov eax,ebp sub eax,[SfxCPB] inc ebp mov [edi],eax ; Write Destination mov [SfxSignZero],eax shr al,7 mov [SfxOverflow],al CLRFLAGS retNEWSYM FxOpc05 ; BRA branch always ; Verified. movsx eax,byte[ebp] mov cl,[ebp+1] inc ebp add ebp,eax call [FxTablec+ecx*4] retNEWSYM FxOpc06 ; BGE branch on greater or equals ; Verified. movsx eax,byte[ebp] mov ebx,[SfxSignZero] shr ebx,15 inc ebp xor bl,[SfxOverflow] mov cl,[ebp] test bl,01h jnz .nojump add ebp,eax call [FxTablec+ecx*4] ret.nojump inc ebp call [FxTablec+ecx*4] retNEWSYM FxOpc07 ; BLT branch on lesss than ; Verified. movsx eax,byte[ebp] mov ebx,[SfxSignZero] shr ebx,15 inc ebp xor bl,[SfxOverflow] mov cl,[ebp] test bl,01h jz .nojump add ebp,eax call [FxTablec+ecx*4] ret.nojump inc ebp call [FxTablec+ecx*4] retNEWSYM FxOpc08 ; BNE branch on not equal ; Verified. movsx eax,byte[ebp] inc ebp test dword[SfxSignZero],0FFFFh mov cl,[ebp] jz .nojump add ebp,eax call [FxTablec+ecx*4] ret.nojump inc ebp call [FxTablec+ecx*4] retNEWSYM FxOpc09 ; BEQ branch on equal (z=1) ; Verified. movsx eax,byte[ebp] inc ebp test dword[SfxSignZero],0FFFFh mov cl,[ebp] jnz .nojump add ebp,eax call [FxTablec+ecx*4] ret.nojump inc ebp call [FxTablec+ecx*4] retNEWSYM FxOpc0A ; BPL branch on plus ; Verified. movsx eax,byte[ebp] inc ebp test dword[SfxSignZero],088000h mov cl,[ebp] jnz .nojump add ebp,eax call [FxTablec+ecx*4] ret.nojump inc ebp call [FxTablec+ecx*4] retNEWSYM FxOpc0B ; BMI branch on minus ; Verified. movsx eax,byte[ebp] inc ebp test dword[SfxSignZero],088000h mov cl,[ebp] jz .nojump add ebp,eax call [FxTablec+ecx*4] ret.nojump inc ebp call [FxTablec+ecx*4] retNEWSYM FxOpc0C ; BCC branch on carry clear ; Verified. movsx eax,byte[ebp] inc ebp test byte[SfxCarry],01h mov cl,[ebp] jnz .nojump add ebp,eax call [FxTablec+ecx*4] ret.nojump inc ebp call [FxTablec+ecx*4] retNEWSYM FxOpc0D ; BCS branch on carry set ; Verified. movsx eax,byte[ebp] inc ebp test byte[SfxCarry],01h mov cl,[ebp] jz .nojump add ebp,eax call [FxTablec+ecx*4] ret.nojump inc ebp call [FxTablec+ecx*4] retNEWSYM FxOpc0E ; BVC branch on overflow clear ; Verified. movsx eax,byte[ebp] inc ebp test byte[SfxOverflow],01h mov cl,[ebp] jnz .nojump add ebp,eax call [FxTablec+ecx*4] ret.nojump inc ebp call [FxTablec+ecx*4] retNEWSYM FxOpc0F ; BVS branch on overflow set ; Verified. movsx eax,byte[ebp] inc ebp test byte[SfxOverflow],01h mov cl,[ebp] jz .nojump add ebp,eax call [FxTablec+ecx*4] ret.nojump inc ebp call [FxTablec+ecx*4] retNEWSYM FxOpc10 ; TO RN set register n as destination register TORNc 0NEWSYM FxOpc11 ; TO RN set register n as destination register TORNc 1NEWSYM FxOpc12 ; TO RN set register n as destination register TORNc 2NEWSYM FxOpc13 ; TO RN set register n as destination register TORNc 3NEWSYM FxOpc14 ; TO RN set register n as destination register TORNc 4NEWSYM FxOpc15 ; TO RN set register n as destination register TORNc 5NEWSYM FxOpc16 ; TO RN set register n as destination register TORNc 6NEWSYM FxOpc17 ; TO RN set register n as destination register TORNc 7NEWSYM FxOpc18 ; TO RN set register n as destination register TORNc 8NEWSYM FxOpc19 ; TO RN set register n as destination register TORNc 9NEWSYM FxOpc1A ; TO RN set register n as destination register TORNc 10NEWSYM FxOpc1B ; TO RN set register n as destination register TORNc 11NEWSYM FxOpc1C ; TO RN set register n as destination register TORNc 12NEWSYM FxOpc1D ; TO RN set register n as destination register TORNc 13NEWSYM FxOpc1E ; TO RN set register n as destination register FETCHPIPE mov eax,[esi] ; Read Source mov [SfxR0+14*4],eax ; Write CLRFLAGS UpdateR14 inc ebp ; Increase program counter retNEWSYM FxOpc1F ; TO RN set register n as destination register FETCHPIPE mov eax,[esi] ; Read Source mov ebp,[SfxCPB] mov [SfxR15],eax add ebp,eax CLRFLAGS retNEWSYM FxOpc3D ; ALT1 set alt1 mode ; Verified. FETCHPIPE mov dword[SfxB],0 or ch,01h inc ebp call [FxTablec+ecx*4] xor ch,ch retNEWSYM FxOpc3E ; ALT2 set alt1 mode ; Verified. FETCHPIPE mov dword[SfxB],0 or ch,02h inc ebp call [FxTablec+ecx*4] xor ch,ch retNEWSYM FxOpc3F ; ALT3 set alt3 mode ; Verified. FETCHPIPE mov dword[SfxB],0 or ch,03h inc ebp call [FxTablec+ecx*4] xor ch,ch retNEWSYM FxOpcB0 ; FROM rn set source register FROMRNc 0NEWSYM FxOpcB1 ; FROM rn set source register FROMRNc 1NEWSYM FxOpcB2 ; FROM rn set source register FROMRNc 2NEWSYM FxOpcB3 ; FROM rn set source register FROMRNc 3NEWSYM FxOpcB4 ; FROM rn set source register FROMRNc 4NEWSYM FxOpcB5 ; FROM rn set source register FROMRNc 5NEWSYM FxOpcB6 ; FROM rn set source register FROMRNc 6NEWSYM FxOpcB7 ; FROM rn set source register FROMRNc 7NEWSYM FxOpcB8 ; FROM rn set source register FROMRNc 8NEWSYM FxOpcB9 ; FROM rn set source register FROMRNc 9NEWSYM FxOpcBA ; FROM rn set source register FROMRNc 10NEWSYM FxOpcBB ; FROM rn set source register FROMRNc 11NEWSYM FxOpcBC ; FROM rn set source register FROMRNc 12NEWSYM FxOpcBD ; FROM rn set source register FROMRNc 13NEWSYM FxOpcBE ; FROM rn set source register FROMRNc 14NEWSYM FxOpcBF ; FROM rn set source register FETCHPIPE mov eax,ebp sub eax,[SfxCPB] inc ebp mov [edi],eax ; Write Destination mov [SfxSignZero],eax shr al,7 mov [SfxOverflow],al CLRFLAGS ret
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -