📄 newgfxb.mac
字号:
;Copyright (C) 1997-2001 ZSNES Team ( zsknight@zsnes.com / _demo_@zsnes.com )
;
;This program is free software; you can redistribute it and/or
;modify it under the terms of the GNU General Public License
;as published by the Free Software Foundation; either
;version 2 of the License, or (at your option) any later
;version.
;
;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 Procbgpr0 5
; Draw BG 2
; Start line by line drawing/check
mov esi,[vidbuffer]
add esi,16
; add esi,16+288
xor ebx,ebx
%%nextline
cmp byte[BGFB+ebx],0
jne %%nogo
test dword[BGMS1+ebx*2],%4
jz %%nogo
test dword[BGMS1+ebx*2],%5
jnz %%nogo
; Check if at a tile alignment
mov ecx,[BG1SYl+ebx*2+%1*512]
and ecx,0FFFFh
add ecx,ebx
test ecx,07h
jz %%tilecheck
%%proclinebyline
; process line by line
call %2
%%nogo
inc ebx
add esi,288
cmp [resolutn],bx
jne %%nextline
jmp %%donextbg
%%tilecheck
mov eax,[BG1SXl+ebx*2+%1*512]
cmp ax,[BG1SXl+ebx*2+2+%1*512]
jne %%proclinebyline
cmp eax,[BG1SXl+ebx*2+4+%1*512]
jne %%proclinebyline
cmp eax,[BG1SXl+ebx*2+8+%1*512]
jne %%proclinebyline
cmp eax,[BG1SXl+ebx*2+12+%1*512]
jne %%proclinebyline
mov eax,[BG1SYl+ebx*2+%1*512]
cmp ax,[BG1SYl+ebx*2+2+%1*512]
jne %%proclinebyline
cmp eax,[BG1SYl+ebx*2+4+%1*512]
jne %%proclinebyline
cmp eax,[BG1SYl+ebx*2+8+%1*512]
jne %%proclinebyline
cmp eax,[BG1SYl+ebx*2+12+%1*512]
jne %%proclinebyline
test dword[BGMS1+ebx*2+14],%4
jz near %%proclinebyline
test dword[BGMS1+ebx*2+14],%5
jnz near %%proclinebyline
cmp ebx,[reslbyl]
jae near %%proclinebyline
mov eax,[BGMA+ebx]
cmp eax,[BGMA+ebx+4]
jne near %%proclinebyline
mov eax,[BGOPT1+ebx*2+%1*512]
cmp ax,[BGOPT1+ebx*2+2+%1*512]
jne near %%proclinebyline
cmp eax,[BGOPT1+ebx*2+4+%1*512]
jne near %%proclinebyline
cmp eax,[BGOPT1+ebx*2+8+%1*512]
jne near %%proclinebyline
cmp eax,[BGOPT1+ebx*2+12+%1*512]
jne near %%proclinebyline
mov eax,[BGPT1+ebx*2+%1*512]
cmp ax,[BGPT1+ebx*2+2+%1*512]
jne near %%proclinebyline
cmp eax,[BGPT1+ebx*2+4+%1*512]
jne near %%proclinebyline
cmp eax,[BGPT1+ebx*2+8+%1*512]
jne near %%proclinebyline
cmp eax,[BGPT1+ebx*2+12+%1*512]
jne near %%proclinebyline
mov eax,[BGPT1X+ebx*2+%1*512]
cmp ax,[BGPT1X+ebx*2+2+%1*512]
jne near %%proclinebyline
cmp eax,[BGPT1X+ebx*2+4+%1*512]
jne near %%proclinebyline
cmp eax,[BGPT1X+ebx*2+8+%1*512]
jne near %%proclinebyline
cmp eax,[BGPT1X+ebx*2+12+%1*512]
jne near %%proclinebyline
mov eax,[BGPT1Y+ebx*2+%1*512]
cmp ax,[BGPT1Y+ebx*2+2+%1*512]
jne near %%proclinebyline
cmp eax,[BGPT1Y+ebx*2+4+%1*512]
jne near %%proclinebyline
cmp eax,[BGPT1Y+ebx*2+8+%1*512]
jne near %%proclinebyline
cmp eax,[BGPT1Y+ebx*2+12+%1*512]
jne near %%proclinebyline
mov eax,[BGMS1+ebx]
cmp eax,[BGMS1+ebx+4]
jne near %%proclinebyline
cmp eax,[BGMS1+ebx+8]
jne near %%proclinebyline
cmp eax,[BGMS1+ebx+12]
jne near %%proclinebyline
mov eax,[BGFB+ebx]
cmp eax,[BGFB+ebx+4]
jne near %%proclinebyline
mov eax,[t16x161+ebx+%1*256]
cmp eax,[t16x161+ebx+4+%1*256]
jne near %%proclinebyline
cmp byte[BGMA+ebx],5
jae near %%proclinebyline
cmp byte[BGMA+ebx],2
je near %%proclinebyline
test dword[intrlng+ebx],01010101h
jnz near %%proclinebyline
test dword[intrlng+ebx+4],01010101h
jnz near %%proclinebyline
test byte[mosenng+ebx],1 << %1
jnz %%mosaic
%%nomosaic
call %3
add ebx,8
add esi,288*8
cmp [resolutn],bx
ja near %%nextline
jmp %%donextbg
%%mosaic
cmp byte[mosszng+ebx],0
je %%nomosaic
jmp %%proclinebyline
%%donextbg
%endmacro
%macro Procbg3pr0 5
; Draw BG 2
; Start line by line drawing/check
mov esi,[vidbuffer]
add esi,16
; add esi,16+288
xor ebx,ebx
%%nextline
cmp byte[BGFB+ebx],0
jne %%nogo
test dword[BGMS1+ebx*2],%4
jz %%nogo
test dword[BGMS1+ebx*2],%5
jnz %%nogo
; Check if at a tile alignment
mov ecx,[BG1SYl+ebx*2+%1*512]
and ecx,0FFFFh
add ecx,ebx
test ecx,07h
jz %%tilecheck
%%proclinebyline
; process line by line
call %2
%%nogo
inc ebx
add esi,288
cmp [resolutn],bx
jne %%nextline
jmp %%donextbg
%%tilecheck
mov eax,[BG1SXl+ebx*2+%1*512]
cmp ax,[BG1SXl+ebx*2+2+%1*512]
jne %%proclinebyline
cmp eax,[BG1SXl+ebx*2+4+%1*512]
jne %%proclinebyline
cmp eax,[BG1SXl+ebx*2+8+%1*512]
jne %%proclinebyline
cmp eax,[BG1SXl+ebx*2+12+%1*512]
jne %%proclinebyline
mov eax,[BG1SYl+ebx*2+%1*512]
cmp ax,[BG1SYl+ebx*2+2+%1*512]
jne %%proclinebyline
cmp eax,[BG1SYl+ebx*2+4+%1*512]
jne %%proclinebyline
cmp eax,[BG1SYl+ebx*2+8+%1*512]
jne %%proclinebyline
cmp eax,[BG1SYl+ebx*2+12+%1*512]
jne %%proclinebyline
test dword[BGMS1+ebx*2+14],%4
jz near %%proclinebyline
test dword[BGMS1+ebx*2+14],%5
jnz near %%proclinebyline
cmp ebx,[reslbyl]
jae near %%proclinebyline
mov eax,[BGMA+ebx]
cmp eax,[BGMA+ebx+4]
jne near %%proclinebyline
mov eax,[BGOPT1+ebx*2+%1*512]
cmp ax,[BGOPT1+ebx*2+2+%1*512]
jne near %%proclinebyline
cmp eax,[BGOPT1+ebx*2+4+%1*512]
jne near %%proclinebyline
cmp eax,[BGOPT1+ebx*2+8+%1*512]
jne near %%proclinebyline
cmp eax,[BGOPT1+ebx*2+12+%1*512]
jne near %%proclinebyline
mov eax,[BGPT1+ebx*2+%1*512]
cmp ax,[BGPT1+ebx*2+2+%1*512]
jne near %%proclinebyline
cmp eax,[BGPT1+ebx*2+4+%1*512]
jne near %%proclinebyline
cmp eax,[BGPT1+ebx*2+8+%1*512]
jne near %%proclinebyline
cmp eax,[BGPT1+ebx*2+12+%1*512]
jne near %%proclinebyline
mov eax,[BGPT1X+ebx*2+%1*512]
cmp ax,[BGPT1X+ebx*2+2+%1*512]
jne near %%proclinebyline
cmp eax,[BGPT1X+ebx*2+4+%1*512]
jne near %%proclinebyline
cmp eax,[BGPT1X+ebx*2+8+%1*512]
jne near %%proclinebyline
cmp eax,[BGPT1X+ebx*2+12+%1*512]
jne near %%proclinebyline
mov eax,[BGPT1Y+ebx*2+%1*512]
cmp ax,[BGPT1Y+ebx*2+2+%1*512]
jne near %%proclinebyline
cmp eax,[BGPT1Y+ebx*2+4+%1*512]
jne near %%proclinebyline
cmp eax,[BGPT1Y+ebx*2+8+%1*512]
jne near %%proclinebyline
cmp eax,[BGPT1Y+ebx*2+12+%1*512]
jne near %%proclinebyline
mov eax,[BGMS1+ebx]
cmp eax,[BGMS1+ebx+4]
jne near %%proclinebyline
cmp eax,[BGMS1+ebx+8]
jne near %%proclinebyline
cmp eax,[BGMS1+ebx+12]
jne near %%proclinebyline
mov eax,[BG3PRI+ebx]
cmp eax,[BG3PRI+ebx+4]
jne near %%proclinebyline
mov eax,[BGFB+ebx]
cmp eax,[BGFB+ebx+4]
jne near %%proclinebyline
mov eax,[t16x161+ebx+%1*256]
cmp eax,[t16x161+ebx+4+%1*256]
jne near %%proclinebyline
test dword[intrlng+ebx],01010101h
jnz near %%proclinebyline
test dword[intrlng+ebx+4],01010101h
jnz near %%proclinebyline
test byte[mosenng+ebx],1 << %1
jnz %%mosaic
%%nomosaic
call %3
add ebx,8
add esi,288*8
cmp [resolutn],bx
ja near %%nextline
%%mosaic
cmp byte[mosszng+ebx],0
je %%nomosaic
jmp %%proclinebyline
%%donextbg
%endmacro
%macro Procbgpr1 6
; Draw BG
; Start line by line drawing/check
mov esi,[vidbuffer]
add esi,16
; add esi,16+288
xor ebx,ebx
%%nextline
cmp byte[BGFB+ebx],0
jne %%nogo
test dword[BGMS1+ebx*2],%5
jz %%nogo
test dword[BGMS1+ebx*2],%6
jnz %%nogo
; Check if at a tile alignment
cmp byte[%4+ebx],1
je %%tile
%%proclinebyline
; process line by line
call %2
%%nogo
inc ebx
add esi,288
cmp [resolutn],bx
jne %%nextline
jmp %%donextbg
%%tile
call %3
add ebx,8
add esi,288*8
cmp [resolutn],bx
ja %%nextline
%%donextbg
%endmacro
%macro Procbg3pr1 6
; Draw BG 2
; Start line by line drawing/check
mov esi,[vidbuffer]
add esi,16
xor ebx,ebx
%%nextline
cmp byte[BGFB+ebx],0
jne %%nogo
test dword[BGMS1+ebx*2],%5
jz %%nogo
test dword[BGMS1+ebx*2],%6
jnz %%nogo
cmp byte[BGMA+ebx],1
jne %%nomode1
cmp byte[BG3PRI+ebx],0
jne %%nogo
%%nomode1
; Check if at a tile alignment
cmp byte[%4+ebx],1
je %%tile
%%proclinebyline
; process line by line
call %2
%%nogo
inc ebx
add esi,288
cmp [resolutn],bx
jne %%nextline
jmp %%donextbg
%%tile
call %3
add ebx,8
add esi,288*8
cmp [resolutn],bx
ja %%nextline
%%donextbg
%endmacro
%macro Procbg3pr1b 6
; Draw BG 2
; Start line by line drawing/check
mov esi,[vidbuffer]
add esi,16
xor ebx,ebx
%%nextline
cmp byte[BGFB+ebx],0
jne %%nogo
test dword[BGMS1+ebx*2],%5
jz %%nogo
test dword[BGMS1+ebx*2],%6
jnz %%nogo
cmp byte[BGMA+ebx],1
jne %%nogo
cmp byte[BG3PRI+ebx],0
je %%nogo
; Check if at a tile alignment
cmp byte[%4+ebx],1
je %%tile
%%proclinebyline
; process line by line
call %2
%%nogo
inc ebx
add esi,288
cmp [resolutn],bx
jne %%nextline
jmp %%donextbg
%%tile
call %3
add ebx,8
add esi,288*8
cmp [resolutn],bx
ja %%nextline
%%donextbg
%endmacro
%macro Procsprng 2
; Draw BG 2
; Start line by line drawing/check
mov esi,[vidbuffer]
add esi,16+288
mov ebx,1
%%nextline
cmp byte[BGFB+ebx],0
jne %%nogo
test dword[BGMS1+ebx*2],%1
jz %%nogo
test dword[BGMS1+ebx*2],%2
jnz %%nogo
xor eax,eax
mov al,[sprtlng+ebx]
mov cl,byte[sprlefttot+ebx]
mov [csprival],eax
inc byte[sprtlng+ebx]
test byte[sprleftpr+ebx*4+eax],1
jz %%nogo
or cl,cl
jz %%nogo
call drawsprng
cmp byte[BGMA+ebx],5
jb %%nogo
cmp byte[res640],0
je %%nogo
add esi,75036
mov cl,byte[sprlefttot+ebx]
call drawsprng
sub esi,75036
%%nogo
inc ebx
add esi,288
cmp [resolutn],bx
jne near %%nextline
%endmacro
%macro Procsprng01 2
; Draw BG 2
; Start line by line drawing/check
mov esi,[vidbuffer]
add esi,16+288
mov ebx,1
%%nextline
cmp byte[BGFB+ebx],0
jne %%nogo
test dword[BGMS1+ebx*2],%1
jz %%nogo
test dword[BGMS1+ebx*2],%2
jnz %%nogo
cmp byte[BGMA+ebx],1
ja %%nogo
xor eax,eax
mov al,[sprtlng+ebx]
mov cl,byte[sprlefttot+ebx]
mov [csprival],eax
inc byte[sprtlng+ebx]
test byte[sprleftpr+ebx*4+eax],1
jz %%nogo
or cl,cl
jz %%nogo
call drawsprng
cmp byte[BGMA+ebx],5
jb %%nogo
cmp byte[res640],0
je %%nogo
add esi,75036
mov cl,byte[sprlefttot+ebx]
call drawsprng
sub esi,75036
%%nogo
inc ebx
add esi,288
cmp [resolutn],bx
jne near %%nextline
%endmacro
%macro Procsprng234567 2
; Draw BG 2
; Start line by line drawing/check
mov esi,[vidbuffer]
add esi,16+288
mov ebx,1
%%nextline
cmp byte[BGFB+ebx],0
jne %%nogo
test dword[BGMS1+ebx*2],%1
jz %%nogo
test dword[BGMS1+ebx*2],%2
jnz %%nogo
cmp byte[BGMA+ebx],1
jbe %%nogo
xor eax,eax
mov al,[sprtlng+ebx]
mov cl,byte[sprlefttot+ebx]
mov [csprival],eax
inc byte[sprtlng+ebx]
test byte[sprleftpr+ebx*4+eax],1
jz %%nogo
or cl,cl
jz %%nogo
call drawsprng
cmp byte[BGMA+ebx],5
jb %%nogo
cmp byte[res640],0
je %%nogo
add esi,75036
mov cl,byte[sprlefttot+ebx]
call drawsprng
sub esi,75036
%%nogo
inc ebx
add esi,288
cmp [resolutn],bx
jne near %%nextline
%endmacro
%macro ProcMode7ng 2
mov byte[winon],0
; Draw BG
; Start line by line drawing/check
mov esi,[vidbuffer]
add esi,16+288
mov ebx,1
%%nextline
cmp byte[BGFB+ebx],0
jne near %%nogo
cmp byte[BGMA+ebx],7
jne near %%nogo
test dword[BGMS1+ebx*2],%1
jz near %%nogo
test dword[BGMS1+ebx*2],%2
jnz near %%nogo
push ebx
; Process mosaic
mov byte[curmosaicsz],1
xor ecx,ecx
test byte[mosenng+ebx],1
jz %%nomosaic
mov cl,[mosszng+ebx]
or cl,cl
jz %%nomosaic
inc cl
mov byte[curmosaicsz],cl
xor edx,edx
mov eax,ebx
div cl
xor edx,edx
mul cl
mov ebx,eax
%%nomosaic
; process line by line
mov edx,[mode7ab+ebx*4]
mov [mode7A],edx
mov edx,[mode7cd+ebx*4]
mov [mode7C],edx
mov edx,[mode7xy+ebx*4]
mov [mode7X0],edx
mov edx,[mode7st+ebx]
mov [mode7set],dl
xor edx,edx
mov eax,ebx
test byte[mode7set],02h
jz %%noflip
mov eax,261
sub eax,ebx
%%noflip
mov dx,[BG1SXl+ebx*2]
add ax,[BG1SYl+ebx*2]
mov [curvidoffset],esi
push esi
call drawmode7
pop esi
pop ebx
%%nogo
inc ebx
add esi,288
cmp [resolutn],bx
jne near %%nextline
%endmacro
%macro preparet4ba 0
shl cx,5
add ecx,ecx
add ecx,[vcache4b]
%endmacro
%macro preparet2ba 0
shl cx,4
shl ecx,2
add ecx,[vcache2b]
%endmacro
%macro preparet8ba 0
shl cx,6
add ecx,[vcache8b]
%endmacro
%macro test4ba 0
and ecx,2047
test dword[vidmemch4+ecx*2],0FFFFh
%endmacro
%macro test2ba 0
and ecx,4095
add edx,dword[mode0add]
test dword[vidmemch2+ecx],0FFh
%endmacro
%macro test8ba 0
and ecx,1023
test dword[vidmemch8+ecx*4],0FFFFFFFFh
%endmacro
%macro drawtileng 8
; tile value : bit 15 = flipy, bit 14 = flipx, bit 13 = priority value
; bit 10-12 = palette, 0-9=tile#
mov ebx,[ng16bbgval]
mov dl,ch
inc dword[bg1drwng+ebx*4]
and ecx,3FFh
and edx,1Fh
add ecx,[ngptrdat2]
mov edx,[%6+edx*4]
%7
jnz near %%docache
%%returnfromcache
cmp byte[%1+ecx],2
je near %5
cmp byte[%1+ecx],0
je near %%parttile
%2
; start drawing from ecx
test dword[vrama+eax],8000h
jnz near %%flipyfull
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -