newgfx.mac

来自「linux下的任天堂模拟器代码。供大家参考。」· MAC 代码 · 共 3,357 行 · 第 1/5 页

MAC
3,357
字号
;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 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    ja %%nextline    jmp %%donextbg%%tilecheck    test dword[bgwinchange+ebx],0FFFFFF00h    jnz %%linebyline    test dword[bgwinchange+ebx+4],0FFFFFFFFh    jz %%tilebytile%%linebyline    test dword[winbg1enval+ebx+%1*256],0A0A0A0Ah    jnz %%proclinebyline    test dword[winbg1enval+ebx+%1*256+4],0A0A0A0Ah    jnz %%proclinebyline%%tilebytile    test dword[BGMS1+ebx*2+14],%4    jz %%proclinebyline    test dword[BGMS1+ebx*2+14],%5    jnz %%proclinebyline    cmp ebx,[reslbyl]    jae %%proclinebyline    test dword[bgallchange+ebx],0FFFFFF00h    jnz %%proclinebyline    test dword[bgallchange+ebx+4],0FFFFFFFFh    jnz near %%proclinebyline    test dword[bg1change+ebx+%1*256],0FFFFFF00h    jnz near %%proclinebyline    test dword[bg1change+ebx+%1*256+4],0FFFFFFFFh    jnz 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    ja %%nextline    jmp %%donextbg%%tilecheck    test dword[bgwinchange+ebx],0FFFFFF00h    jnz %%linebyline    test dword[bgwinchange+ebx+4],0FFFFFFFFh    jz %%tilebytile%%linebyline    test dword[winbg1enval+ebx+%1*256],0A0A0A0Ah    jnz %%proclinebyline    test dword[winbg1enval+ebx+%1*256+4],0A0A0A0Ah    jnz %%proclinebyline%%tilebytile    test dword[BGMS1+ebx*2+14],%4    jz %%proclinebyline    test dword[BGMS1+ebx*2+14],%5    jnz %%proclinebyline    cmp ebx,[reslbyl]    jae %%proclinebyline    test dword[bgallchange+ebx],0FFFFFF00h    jnz %%proclinebyline    test dword[bgallchange+ebx+4],0FFFFFFFFh    jnz near %%proclinebyline    test dword[bg1change+ebx+%1*256],0FFFFFF00h    jnz near %%proclinebyline    test dword[bg1change+ebx+%1*256+4],0FFFFFFFFh    jnz near %%proclinebyline    mov eax,[BG3PRI+ebx]    cmp eax,[BG3PRI+ebx+4]    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    jmp %%donextbg%%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    ja %%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    ja %%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,[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[hiresstuff],0    je %%nogo    add esi,75036    mov cl,[sprlefttot+ebx]    call drawsprng    sub esi,75036%%nogo    inc ebx    add esi,288    cmp [resolutn],bx    ja 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,[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[hiresstuff],0    je %%nogo    add esi,75036    mov cl,[sprlefttot+ebx]    call drawsprng    sub esi,75036%%nogo    inc ebx    add esi,288    cmp [resolutn],bx    ja 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,[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[hiresstuff],0    je %%nogo    add esi,75036    mov cl,[sprlefttot+ebx]    call drawsprng    sub esi,75036%%nogo    inc ebx    add esi,288    cmp [resolutn],bx    ja 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,[mode7A]    mov [Mode7BackA],ebx    mov ebx,[mode7C]    mov [Mode7BackC],ebx    mov ebx,[mode7X0]    mov [Mode7BackX0],ebx    mov bl,[mode7set]    mov [Mode7BackSet],ebx    mov ebx,1%%nextline    cmp byte[BGFB+ebx],0    jne near %%nogo    cmp byte[BGMA+ebx],7    jne near %%nogo    test byte[intrlng+ebx],40h    jnz 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 [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,255    sub eax,ebx%%noflip    mov dx,[BG1SXl+ebx*2]    mov [m7starty],ax    mov ax,[BG1SYl+ebx*2]    mov [curvidoffset],esi    pop ebx    push eax    push edx    push esi    push ebx    call drawmode7win    pop ebx    pop esi    pop edx    pop eax    cmp byte[Mode7HiRes],0    je %%nogo    call processmode7hires%%nogo    inc ebx    add esi,288    cmp [resolutn],bx    ja near %%nextline    mov ebx,[Mode7BackA]    mov [mode7A],ebx    mov ebx,[Mode7BackC]    mov [mode7C],ebx    mov ebx,[Mode7BackX0]    mov [mode7X0],ebx    mov ebx,[Mode7BackSet]    mov [mode7set],bl%endmacro%macro ProcMode7ngextbg 2    mov byte[winon],0    ; Draw BG    ; Start line by line drawing/check    mov esi,[vidbuffer]    add esi,16+288    mov ebx,[mode7A]    mov [Mode7BackA],ebx    mov ebx,[mode7C]    mov [Mode7BackC],ebx    mov ebx,[mode7X0]    mov [Mode7BackX0],ebx    mov bl,[mode7set]    mov [Mode7BackSet],ebx    mov ebx,1%%nextline    mov byte[esi-1],0    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    test byte[intrlng+ebx],40h    jz near %%nogo    mov byte[esi-1],1    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 [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,255    sub eax,ebx%%noflip    mov dx,[BG1SXl+ebx*2]    mov [m7starty],ax    mov ax,[BG1SYl+ebx*2]    mov [curvidoffset],esi    push esi    call drawmode7ngextbg    pop esi    pop ebx%%nogo    inc ebx    add esi,288    cmp [resolutn],bx    ja near %%nextline    mov ebx,[Mode7BackA]    mov [mode7A],ebx    mov ebx,[Mode7BackC]    mov [mode7C],ebx    mov ebx,[Mode7BackX0]    mov [mode7X0],ebx    mov ebx,[Mode7BackSet]    mov [mode7set],bl%endmacro%macro ProcMode7ngextbg2 2    mov byte[winon],0    ; Draw BG    ; Start line by line drawing/check    mov esi,[vidbuffer]    add esi,16+288    mov ebx,[mode7A]    mov [Mode7BackA],ebx    mov ebx,[mode7C]    mov [Mode7BackC],ebx    mov ebx,[mode7X0]    mov [Mode7BackX0],ebx    mov bl,[mode7set]    mov [Mode7BackSet],ebx    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    test byte[intrlng+ebx],40h    jz 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 [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,255    sub eax,ebx%%noflip    mov dx,[BG1SXl+ebx*2]    mov [m7starty],ax    mov ax,[BG1SYl+ebx*2]    mov [curvidoffset],esi    push esi    jmp %%drawb    cmp byte[esi-1],1    je %%drawb    call drawmode7ngextbg    jmp %%drawa%%drawb    call drawmode7ngextbg2%%drawa    pop esi    pop ebx%%nogo    inc ebx    add esi,288    cmp [resolutn],bx    ja near %%nextline    mov ebx,[Mode7BackA]    mov [mode7A],ebx    mov ebx,[Mode7BackC]    mov [mode7C],ebx    mov ebx,[Mode7BackX0]    mov [mode7X0],ebx    mov ebx,[Mode7BackSet]

⌨️ 快捷键说明

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