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

📄 newgfx2.asm

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

%include "macros.mac"

EXTSYM ngwintable,ngwinen,ngcwinptr,ngcpixleft,ngcwinmode
EXTSYM tleftn, ng16bprval, vrama, bg1drwng, ng16bbgval, bg1totng
EXTSYM bgtxadd, taddnfy16x16, taddfy16x16, switch16x16, curmosaicsz, domosaicng
EXTSYM vidmemch4,vidmemch2,vidmemch8,mode0add,vcache4b,vcache2b,vcache8b
EXTSYM cachesingle2bng,cachesingle8bng,ngpalcon4b,ngpalcon8b
EXTSYM ngpalcon2b,tleftnb,tltype2b,tltype4b,tltype8b,yposng,flipyposng
EXTSYM ofsmcptr,ofsmtptr,ofsmmptr,ofsmcyps,ofsmady,ofsmadx
EXTSYM yposngom,flipyposngom,cbgval,ofsmval,ofsmvalh,vram,bgtxadd2

NEWSYM NewGfx2AsmStart

%include "video/vidmacro.mac"
%include "video/newgfx2.mac"
%include "video/newgfx.mac"
%include "video/newgfxwn.mac"









;******************************************
; 8x8 tiles - tile engine
;******************************************

%macro WinClipMacro 1
    mov byte[tleftn],33
    mov dword[ngcwinptr],ngwintable
    mov dword[ngcwinmode],0
    cmp dword[ngwintable],0
    jne .loop
    add dword[ngcwinptr],4
    mov dword[ngcwinmode],1
.winclipped
    mov ebx,[ngcwinptr]
    mov cx,[vrama+eax]
    cmp dword[ebx],8
    jbe near %1
    sub dword[ebx],8
    add ax,2
    mov ebx,[ng16bbgval]
    add edi,8
    inc dword[bg1totng+ebx*4]
    test eax,03Fh
    jnz .notileadd
    add ax,[bgtxadd]
.notileadd
    dec byte[tleftn]
    jnz .winclipped
    pop ebx
    cmp byte[curmosaicsz],1
    jne near domosaicng
    ret
.loop
    mov ebx,[ngcwinptr]
    mov cx,[vrama+eax]
    cmp dword[ebx],8
    jbe near %1
    sub dword[ebx],8
    xor ecx,[ng16bprval]
    test ecx,2000h
    jnz near .finline
%endmacro

NEWSYM drawtileng2b
    cmp byte[ngwinen],1
    je near drawtileng2bwin
    mov byte[tleftn],33
.loop
    mov cx,[vrama+eax]
    xor ecx,[ng16bprval]
    test ecx,2000h
    jnz near .finline
    drawtileng tltype2b, preparet2ba, cachesingle2bng,.loop,.finline,ngpalcon2b,test2ba,03h
    ret
drawtileng2bwin:
    WinClipMacro Processwinclip2bt
    drawtileng tltype2b, preparet2ba, cachesingle2bng,.loop,.finline,ngpalcon2b,test2ba,03h
Processwinclip2bt:
    mov ebx,[ngcwinptr]
    mov cx,[vrama+eax]
    mov ebx,[ebx]
    xor ecx,[ng16bprval]
    mov [ngcpixleft],ebx
    test ecx,2000h
    jnz near .finline
    drawtilengwin tltype2b, preparet2ba, cachesingle2bng,.loop,.finline,ngpalcon2b,test2ba,03h
.loop
    push eax
    mov ebx,[ngcwinptr]
    mov eax,[ngcpixleft]
    mov [ebx],eax
    pop eax
    cmp dword[ngcwinmode],1
    je near drawtileng2bwin.winclipped
    jmp drawtileng2bwin.loop


NEWSYM drawtileng4b
    cmp byte[ngwinen],1
    je near drawtileng4bwin
    mov byte[tleftn],33
.loop
    mov cx,[vrama+eax]
    xor ecx,[ng16bprval]
    test ecx,2000h
    jnz near .finline
    drawtileng tltype4b, preparet4ba, cachesingle4bng,.loop,.finline,ngpalcon4b,test4ba,0Fh
    ret
drawtileng4bwin:
    WinClipMacro Processwinclip4bt
    drawtileng tltype4b, preparet4ba, cachesingle4bng,.loop,.finline,ngpalcon4b,test4ba,0Fh
Processwinclip4bt:
    mov ebx,[ngcwinptr]
    mov cx,[vrama+eax]
    mov ebx,[ebx]
    xor ecx,[ng16bprval]
    mov [ngcpixleft],ebx
    test ecx,2000h
    jnz near .finline
    drawtilengwin tltype4b, preparet4ba, cachesingle4bng,.loop,.finline,ngpalcon4b,test4ba,0Fh
.loop
    push eax
    mov ebx,[ngcwinptr]
    mov eax,[ngcpixleft]
    mov [ebx],eax
    pop eax
    cmp dword[ngcwinmode],1
    je near drawtileng4bwin.winclipped
    jmp drawtileng4bwin.loop

NEWSYM drawtileng8b
    cmp byte[ngwinen],1
    je near drawtileng8bwin
    mov byte[tleftn],33
.loop
    mov cx,[vrama+eax]
    xor ecx,[ng16bprval]
    test ecx,2000h
    jnz near .finline
    drawtileng tltype8b, preparet8ba, cachesingle8bng,.loop,.finline,ngpalcon8b,test8ba,0FFh
    ret

drawtileng8bwin:
    WinClipMacro Processwinclip8bt
    drawtileng tltype8b, preparet8ba, cachesingle8bng,.loop,.finline,ngpalcon8b,test8ba,0FFh
Processwinclip8bt:
    mov ebx,[ngcwinptr]
    mov cx,[vrama+eax]
    mov ebx,[ebx]
    xor ecx,[ng16bprval]
    mov [ngcpixleft],ebx
    test ecx,2000h
    jnz near .finline
    drawtilengwin tltype8b, preparet8ba, cachesingle8bng,.loop,.finline,ngpalcon8b,test8ba,0FFh
.loop
    push eax
    mov ebx,[ngcwinptr]
    mov eax,[ngcpixleft]
    mov [ebx],eax
    pop eax
    cmp dword[ngcwinmode],1
    je near drawtileng8bwin.winclipped
    jmp drawtileng8bwin.loop

;******************************************
; 16x16 tiles - tile engine
;******************************************

%macro WinClipMacro16x16 1
    mov byte[tleftn],17
    mov dword[ngcwinptr],ngwintable
    mov dword[ngcwinmode],0
    cmp dword[ngwintable],0
    jne .loop
    add dword[ngcwinptr],4
    mov dword[ngcwinmode],1
.winclipped
    mov ebx,[ngcwinptr]
    mov cx,[vrama+eax]
    cmp dword[ebx],16
    jbe near %1
    sub dword[ebx],16
    add ax,2
    mov ebx,[ng16bbgval]
    add edi,16
    inc dword[bg1totng+ebx*4]
    test eax,03Fh
    jnz .notileadd
    add ax,[bgtxadd]
.notileadd
    dec byte[tleftn]
    jnz .winclipped
    pop ebx
    cmp byte[curmosaicsz],1
    jne near domosaicng
    ret
.loop
    mov ebx,[ngcwinptr]
    mov cx,[vrama+eax]
    cmp dword[ebx],16
    jbe near %1
    sub dword[ebx],16
    xor ecx,[ng16bprval]
    test ecx,2000h
    jnz near .finline
%endmacro

NEWSYM drawtileng16x162b
    cmp byte[ngwinen],1
    je near drawtileng16x162bwin
    mov byte[tleftn],17
.loop
    mov cx,[vrama+eax]
    xor ecx,[ng16bprval]
    test ecx,2000h
    jnz near .finline
    drawtileng16x16 tltype2b, preparet2ba, cachesingle2bng,.loop,.finline,ngpalcon2b,test2ba,03h
    ret
drawtileng16x162bwin:
    WinClipMacro16x16 Processwinclip16x162bt
    drawtileng16x16 tltype2b, preparet2ba, cachesingle2bng,.loop,.finline,ngpalcon2b,test2ba,03h
Processwinclip16x162bt:
    mov ebx,[ngcwinptr]
    mov cx,[vrama+eax]
    mov ebx,[ebx]
    xor ecx,[ng16bprval]
    mov [ngcpixleft],ebx
    test ecx,2000h
    jnz near .finline
    drawtileng16x16win tltype2b, preparet2ba, cachesingle2bng,.loop,.finline,ngpalcon2b,test2ba,03h
.loop
    push eax
    mov ebx,[ngcwinptr]
    mov eax,[ngcpixleft]
    mov [ebx],eax
    pop eax
    cmp dword[ngcwinmode],1
    je near drawtileng16x162bwin.winclipped
    jmp drawtileng16x162bwin.loop

NEWSYM drawtileng16x164b
    cmp byte[ngwinen],1
    je near drawtileng16x164bwin
    mov byte[tleftn],17
.loop
    mov cx,[vrama+eax]
    xor ecx,[ng16bprval]
    test ecx,2000h
    jnz near .finline
    drawtileng16x16 tltype4b, preparet4ba, cachesingle4bng,.loop,.finline,ngpalcon4b,test4ba,0Fh
    ret
drawtileng16x164bwin:
    WinClipMacro16x16 Processwinclip16x164bt
    drawtileng16x16 tltype4b, preparet4ba, cachesingle4bng,.loop,.finline,ngpalcon4b,test4ba,0Fh
Processwinclip16x164bt:
    mov ebx,[ngcwinptr]
    mov cx,[vrama+eax]
    mov ebx,[ebx]
    xor ecx,[ng16bprval]
    mov [ngcpixleft],ebx
    test ecx,2000h
    jnz near .finline
    drawtileng16x16win tltype4b, preparet4ba, cachesingle4bng,.loop,.finline,ngpalcon4b,test4ba,0Fh
.loop
    push eax
    mov ebx,[ngcwinptr]
    mov eax,[ngcpixleft]
    mov [ebx],eax
    pop eax
    cmp dword[ngcwinmode],1
    je near drawtileng16x164bwin.winclipped
    jmp drawtileng16x164bwin.loop

NEWSYM drawtileng16x168b
    mov byte[tleftn],17
.loop
    mov cx,[vrama+eax]
    xor ecx,[ng16bprval]
    test ecx,2000h
    jnz near .finline
    drawtileng16x16 tltype8b, preparet8ba, cachesingle8bng,.loop,.finline,ngpalcon8b,test8ba,0FFh
    ret
drawtileng16x168bwin:
    WinClipMacro16x16 Processwinclip16x168bt
    drawtileng16x16 tltype8b, preparet8ba, cachesingle8bng,.loop,.finline,ngpalcon8b,test8ba,0FFh
Processwinclip16x168bt:
    mov ebx,[ngcwinptr]
    mov cx,[vrama+eax]
    mov ebx,[ebx]
    xor ecx,[ng16bprval]
    mov [ngcpixleft],ebx
    test ecx,2000h
    jnz near .finline
    drawtileng16x16win tltype8b, preparet8ba, cachesingle8bng,.loop,.finline,ngpalcon8b,test8ba,0FFh
.loop
    push eax
    mov ebx,[ngcwinptr]
    mov eax,[ngcpixleft]
    mov [ebx],eax
    pop eax
    cmp dword[ngcwinmode],1
    je near drawtileng16x168bwin.winclipped
    jmp drawtileng16x168bwin.loop

;******************************************
; 8x8 tiles - line by line engine
;******************************************

NEWSYM drawlineng2b
    cmp byte[ngwinen],1
    je near drawlineng2bwin
    mov byte[tleftn],33
.loop
    mov cx,[vrama+eax]
    xor ecx,[ng16bprval]
    test ecx,2000h

⌨️ 快捷键说明

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