📄 fxemu2.mac
字号:
;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.%macro FETCHPIPE 0; mov edx,[SfxPBR]; mov edx,[SfxMemTable+edx*4]; mov edx,[SfxCPB]; mov edx,[SfxR15] mov cl,[ebp]%endmacro%macro UpdateR14 0; mov edx,[SfxROMBR]; mov edx,[SfxMemTable+edx*4] mov eax,[SfxCROM]; and dword[SfxR14],0FFFFh add eax,[SfxR14] mov [SfxRomBuffer],eax%endmacro%macro CLRFLAGS 0 ;and dword[SfxSFR],0FFFFh-0100h-0200h-1000h ; Clear ALT1,ALT2 and B Flags; xor ch,ch; mov dword[SfxB],0 ; Clear B Flag; mov esi,SfxR0; mov edi,SfxR0%endmacro%macro TORN 1 ; V FETCHPIPE mov edi, SfxR0+%1*4 inc ebp ; Increase program counter call [FxTable+ecx*4] mov edi,SfxR0 ret%endmacro%macro WITH 1 ; Verified. FETCHPIPE mov esi,SfxR0+%1*4 mov edi,SfxR0+%1*4 mov dword[SfxB],1 inc ebp ; Increase program counter call [FxTablec+ecx*4] mov esi,SfxR0 mov edi,SfxR0 mov dword[SfxB],0 ; Clear B Flag ret%endmacro%macro STWRN 1 ; V mov eax,[SfxR0+%1*4] ; Read register mov ebx,[SfxRAMMem] mov [SfxLastRamAdr],eax ; Save last ram address add dword[SfxLastRamAdr],ebx ; Save last ram address mov edx,[esi] ; Read Source FETCHPIPE mov [ebx+eax],dl ; Store Word xor eax,1 inc ebp ; Increase program counter mov [ebx+eax],dh ; Store Word CLRFLAGS ret%endmacro%macro STBRN 1 ; V mov eax,[SfxR0+%1*4] ; Read register FETCHPIPE add eax,[SfxRAMMem] mov [SfxLastRamAdr],eax ; Save last ram address mov ebx,[esi] ; Read Source mov [eax],bl ; Store Byte CLRFLAGS inc ebp ; Increase program counter ret%endmacro%macro LDWRN 1 ; V mov eax,[SfxR0+%1*4] ; Read register mov ebx,[SfxRAMMem] mov [SfxLastRamAdr],eax ; Save last ram address FETCHPIPE mov dl,[ebx+eax] ; Store Word add dword[SfxLastRamAdr],ebx ; Save last ram address xor eax,1 and edx,0FFFFh inc ebp ; Increase program counter mov dh,[ebx+eax] ; Store Word mov [edi],edx ; Read Source CLRFLAGS ret%endmacro%macro LDBRN 1 ; V mov eax,[SfxR0+%1*4] ; Read register FETCHPIPE add eax,[SfxRAMMem] xor ebx,ebx mov [SfxLastRamAdr],eax ; Save last ram address mov bl,[eax] ; Read Byte inc ebp ; Increase program counter mov [edi],ebx ; Store Result CLRFLAGS ret%endmacro; test byte[SfxPOR],01h; jnz .nozerocheck; test byte[SfxPOR],02h; jz .nodither; **** Can pre-calculate [SfxSCBR] << 10 + [sfxramdata]; Pre-calculate fxbit values from color register%macro drawpix4b 0 and [eax],edx and [eax+16],edx xor edx,0FFFFFFFFh mov ebx,[fxbit01pcal] and ebx,edx or [eax], ebx and edx,[fxbit23pcal] or [eax+16], edx%endmacro%macro drawpix4bd 0 and [eax],edx and [eax+16],edx xor edx,0FFFFFFFFh mov ebx,[fxbit45pcal] and ebx,edx or [eax], ebx and edx,[fxbit67pcal] or [eax+16], edx%endmacro%macro drawpix2b 0 and [eax],edx xor edx,0FFFFFFFFh and edx,[fxbit01pcal] or [eax], edx%endmacro%macro drawpix2bd 0 and [eax],edx xor edx,0FFFFFFFFh and edx,[fxbit45pcal] or [eax], edx%endmacro%macro drawpix8b 0 and [eax],edx and [eax+16],edx and [eax+32],edx and [eax+48],edx xor edx,0FFFFFFFFh mov ebx,[fxbit01pcal] and ebx,edx or [eax], ebx mov ebx,[fxbit23pcal] and ebx,edx or [eax+16], ebx mov ebx,[fxbit45pcal] and ebx,edx or [eax+32], ebx and edx,[fxbit67pcal] or [eax+48], edx%endmacro%macro drawpix8bd 0 and [eax],edx and [eax+16],edx and [eax+32],edx and [eax+48],edx xor edx,0FFFFFFFFh mov ebx,[fxbit45pcal] and ebx,edx or [eax], ebx mov ebx,[fxbit67pcal] and ebx,edx or [eax+16], ebx mov ebx,[fxbit01pcal] and ebx,edx or [eax+32], ebx and edx,[fxbit23pcal] or [eax+48], edx%endmacro%macro plotb 5 shl eax,%3 and ebx,07h add ebx,ebx add eax,ebx add eax,[SCBRrel] mov bl,[SfxR1] mov edx,[fxxand+ebx*4] %2%endmacro%macro plotbz 5 shl eax,%3 and ebx,07h add ebx,ebx add eax,ebx add eax,[SCBRrel] mov bl,[SfxR1] mov edx,[fxxand+ebx*4] test byte[SfxCOLR],%5 jz .nodraw %2%endmacro%macro plotbd 5 shl eax,%3 and ebx,07h add ebx,ebx add eax,ebx add eax,[SCBRrel] mov bl,[SfxR1] mov edx,[fxxand+ebx*4] mov bl,[SfxR1] xor bl,[SfxR2] test bl,01h jz .nodither4b %4 inc word[SfxR1] %1.nodither4b %2%endmacro%macro plotbzd 5 shl eax,%3 and ebx,07h add ebx,ebx add eax,ebx add eax,[SCBRrel] mov bl,[SfxR1] mov edx,[fxxand+ebx*4] test byte[SfxCOLR],%5 jz near .nodraw mov bl,[SfxR1] xor bl,[SfxR2] test bl,01h jz .nodither4b %4 inc word[SfxR1] %1.nodither4b %2%endmacro%macro plotlines4b 1 mov ebx,[SfxR2] FETCHPIPE mov bh,[SfxR1] mov eax,[sfxclineloc] inc ebp mov eax,[eax+ebx*4] cmp eax,0FFFFFFFFh je near .nodraw %1 ret, drawpix4b, 5, drawpix4bd, 0Fh.nodraw inc word[SfxR1] ret%endmacro%macro plotlines4bb 1 mov ebx,[SfxR2] FETCHPIPE mov bh,[SfxR1] mov eax,[sfxclineloc] inc ebp mov eax,[eax+ebx*4] cmp eax,0FFFFFFFFh je near .nodraw %1 FXReturn, drawpix4b, 5, drawpix4bd, 0Fh.nodraw inc word[SfxR1] FXReturn%endmacro%macro plotlines2b 1 mov ebx,[SfxR2] FETCHPIPE mov bh,[SfxR1] mov eax,[sfxclineloc] inc ebp mov eax,[eax+ebx*4] cmp eax,0FFFFFFFFh je .nodraw %1 ret, drawpix2b, 4, drawpix2bd, 03h.nodraw inc word[SfxR1] ret%endmacro%macro plotlines2bb 1 mov ebx,[SfxR2] FETCHPIPE mov bh,[SfxR1] mov eax,[sfxclineloc] inc ebp mov eax,[eax+ebx*4] cmp eax,0FFFFFFFFh je near .nodraw %1 FXReturn, drawpix2b, 4, drawpix2bd, 03h.nodraw inc word[SfxR1] FXReturn%endmacro%macro plotlines8b 1 mov ebx,[SfxR2] FETCHPIPE mov bh,[SfxR1] mov eax,[sfxclineloc] inc ebp mov eax,[eax+ebx*4] cmp eax,0FFFFFFFFh je near .nodraw %1 ret, drawpix8b, 6, drawpix8bd, 0FFh.nodraw inc word[SfxR1] ret%endmacro%macro plotlines8bb 1 mov ebx,[SfxR2] FETCHPIPE mov bh,[SfxR1] mov eax,[sfxclineloc] inc ebp mov eax,[eax+ebx*4] cmp eax,0FFFFFFFFh je .nodraw %1 FXReturn, drawpix8b, 6, drawpix8bd, 0FFh.nodraw inc word[SfxR1] FXReturn%endmacro%macro plotlines8bl 1 mov ebx,[SfxR2] FETCHPIPE mov bh,[SfxR1] mov eax,[sfxclineloc] inc ebp mov eax,[eax+ebx*4] cmp eax,0FFFFFFFFh je near .nodraw %1 ret, drawpix8b, 6, drawpix8bd, 0Fh.nodraw inc word[SfxR1] ret%endmacro%macro plotlines8bbl 1 mov ebx,[SfxR2] FETCHPIPE mov bh,[SfxR1] mov eax,[sfxclineloc] inc ebp mov eax,[eax+ebx*4] cmp eax,0FFFFFFFFh je .nodraw %1 FXReturn, drawpix8b, 6, drawpix8bd, 0Fh.nodraw inc word[SfxR1] FXReturn%endmacro%macro ADDRN 1 ; V mov eax, [esi] ; Read Source mov ebx, [SfxR0+%1*4] FETCHPIPE add ax,bx seto byte[SfxOverflow] setc byte[SfxCarry] mov [SfxSignZero],eax inc ebp ; Increase program counter mov [edi],eax ; Write Destination CLRFLAGS ret%endmacro%macro ADCRN 1 ; V FETCHPIPE mov eax, [esi] ; Read Source mov ebx, [SfxR0+%1*4] shr byte[SfxCarry],1 adc ax,bx seto byte[SfxOverflow] setc byte[SfxCarry] mov [SfxSignZero],eax inc ebp ; Increase program counter
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -