⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 fxemu2b.asm

📁 著名SFC模拟器Snes9x的源代码。
💻 ASM
字号:
; Snes9x - Portable Super Nintendo Entertainment System (TM) emulator.;; Super FX assembler emulator code; (c) Copyright 1998, 1999 zsKnight and _Demo_.;; Permission to use, copy, modify and distribute Snes9x in both binary and; source form, for non-commercial purposes, is hereby granted without fee,; providing that this license information and copyright notice appear with; all copies and any derived work.;; This software is provided 'as-is', without any express or implied; warranty. In no event shall the authors be held liable for any damages; arising from the use of this software.;; Snes9x is freeware for PERSONAL USE only. Commercial users should; seek permission of the copyright holders first. Commercial use includes; charging money for Snes9x or software derived from Snes9x.;; The copyright holders request that bug fixes and improvements to the code; should be forwarded to them so everyone can benefit from the modifications; in future versions.;; Super NES and Super Nintendo Entertainment System are trademarks of; Nintendo Co., Limited and its subsidiary companies.;%include "i386/macros.mac"%include "i386/fxemu2.mac"%include "i386/fxemu2b.mac"EXTSYM FxTable,FxTableb,FxTablec,SfxB,SfxCPB,SfxCROM,SfxCarry,SfxOverflowEXTSYM SfxR0,SfxR14,SfxR15,SfxRomBuffer,SfxSignZero,withr15skSECTION .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 1   NEWSYM FxOpb12      ; TO RN  set register n as destination register   TORNb 2   NEWSYM FxOpb13      ; TO RN  set register n as destination register   TORNb 3   NEWSYM FxOpb14      ; TO RN  set register n as destination register   TORNb 4   NEWSYM FxOpb15      ; TO RN  set register n as destination register   TORNb 5   NEWSYM FxOpb16      ; TO RN  set register n as destination register   TORNb 6   NEWSYM FxOpb17      ; TO RN  set register n as destination register   TORNb 7   NEWSYM FxOpb18      ; TO RN  set register n as destination register   TORNb 8   NEWSYM FxOpb19      ; TO RN  set register n as destination register   TORNb 9   NEWSYM FxOpb1A      ; TO RN  set register n as destination register   TORNb 10   NEWSYM FxOpb1B      ; TO RN  set register n as destination register   TORNb 11   NEWSYM FxOpb1C      ; TO RN  set register n as destination register   TORNb 12   NEWSYM 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 byte[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 1   NEWSYM FxOpc12      ; TO RN  set register n as destination register   TORNc 2   NEWSYM FxOpc13      ; TO RN  set register n as destination register   TORNc 3   NEWSYM FxOpc14      ; TO RN  set register n as destination register   TORNc 4   NEWSYM FxOpc15      ; TO RN  set register n as destination register   TORNc 5   NEWSYM FxOpc16      ; TO RN  set register n as destination register   TORNc 6   NEWSYM FxOpc17      ; TO RN  set register n as destination register   TORNc 7   NEWSYM FxOpc18      ; TO RN  set register n as destination register   TORNc 8   NEWSYM FxOpc19      ; TO RN  set register n as destination register   TORNc 9   NEWSYM FxOpc1A      ; TO RN  set register n as destination register   TORNc 10   NEWSYM FxOpc1B      ; TO RN  set register n as destination register   TORNc 11   NEWSYM FxOpc1C      ; TO RN  set register n as destination register   TORNc 12   NEWSYM 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 byte[SfxOverflow],al   CLRFLAGS   ret

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -