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

📄 newgfx.mac

📁 十七种模拟器源代码 非常有用的作课程设计不可缺少的
💻 MAC
📖 第 1 页 / 共 5 页
字号:
;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.


EXTSYM mode7B, mode7D
EXTSYM drawmode7ngextbg,drawmode7ngextbg2







%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,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[hiresstuff],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
    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,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[hiresstuff],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
    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,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[hiresstuff],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
    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 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
    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 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 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 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

⌨️ 快捷键说明

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