📄 newg162.asm
字号:
;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.%include "macros.mac"EXTSYM ngwintable,ngwinen,ngcwinptr,ngcpixleft,ngcwinmode,tleftn,ng16bprvalEXTSYM vrama,bg1drwng,ng16bbgval,bg1totng,bgtxadd,taddnfy16x16,taddfy16x16EXTSYM switch16x16,curmosaicsz,domosaicng16b,vidmemch2,vidmemch4,vidmemch8EXTSYM mode0add,vcache4b,vcache2b,vcache8b,cachesingle2bng,cachesingle8bngEXTSYM ngpalcon4b,ngpalcon8b,ngpalcon2b,tleftnb,tltype2b,tltype4b,tltype8bEXTSYM yposng,flipyposng,ofsmcptr,ofsmtptr,ofsmmptr,ofsmcyps,ofsmady,ofsmadxEXTSYM FillSubScr,UnusedBitXor,yposngom,flipyposngom,cbgval,ofsmval,ofsmvalhEXTSYM CPalPtrng,BGMS1,scadtng,CMainWinScr,CSubWinScr,UnusedBit,res640EXTSYM mosclineval,mostranspval,vcache2bs,vcache4bs,vcache8bs,vidmemch2sEXTSYM vidmemch4s,vidmemch8s,cpalval,bgtxadd2,SpecialLine,cachesingle4bngEXTSYM ofshvaladd,ofsmtptrs,ofsmcptr2,ngptrdat2%include "video/vidmacro.mac"%include "video/newg162.mac"%include "video/newgfx16.mac"%include "video/newg16wn.mac";******************************************; 16bitng caching functions;******************************************%macro cacheloopstuff 1 mov bl,[esi+%1] or bl,bl jnz %%okay mov ax,0FFFFh jmp %%transp%%okay or bl,dl mov ax,[ebp+ebx*2]%%transp mov [edi+%1*2],ax mov [edi+14-%1*2+128],ax%endmacro%macro DoCache 2 push ecx push eax push esi push edi mov esi,ecx xor ebx,ebx shl esi,6 shl ecx,8 add esi,[%1] add ecx,[%2] mov edi,ecx mov ecx,8.loop cacheloopstuff 0 cacheloopstuff 1 cacheloopstuff 2 cacheloopstuff 3 cacheloopstuff 4 cacheloopstuff 5 cacheloopstuff 6 cacheloopstuff 7 add edi,16 add esi,8 dec ecx jnz near .loop pop edi pop esi pop eax pop ecx ret%endmacroSECTION .textcache2b16b: DoCache vcache2b,vcache2bscache4b16b: DoCache vcache4b,vcache4bscache8b16b: DoCache vcache8b,vcache8bs;******************************************; 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,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 domosaicng16b 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%macro determinetransp 1 mov [mostranspval],dl mov [mosclineval],ebx add ecx,[CMainWinScr] cmp byte[curmosaicsz],1 jne .mosaic test byte[BGMS1+ebx*2],dl jz .nosubmain test byte[FillSubScr+ebx],1 jnz near %1 jmp .main.nosubmain test byte[FillSubScr+ebx],1 jz .main sub ecx,[CMainWinScr] add ecx,[CSubWinScr] add edi,75036*2 jmp .main.mosaic test byte[FillSubScr+ebx],1 jz .main sub ecx,[CMainWinScr] add ecx,[CSubWinScr].main%endmacro%macro CheckWindowing 1 cmp byte[ngwinen],0 je %%nowindowing cmp byte[ecx],0 jne near %1%%nowindowing%endmacro%macro DetermineWindow 3 ; both,main,sub cmp byte[ngwinen],0 je %%nowindow cmp byte[ecx],0 jz near %3 sub ecx,[CMainWinScr] add ecx,[CSubWinScr] cmp byte[ecx],0 jnz near %1 jmp %2%%nowindow%endmacro%macro drawtile16b 10 mov byte[tleftn],33%%loop mov cx,[vrama+eax] xor ecx,[ng16bprval] test ecx,2000h jnz near %%finline drawtileng16b %1,%2,%3,%%loop,%%finline,%4,%5,%6,%7,%8,%9,%10 ret%endmacro%macro drawtile16bw 12 WinClipMacro %%processwinclip2b drawtileng16b %1,%2,%3,.loop,.finline,%4,%5,%6,%7,%8,%9,%10%%processwinclip2b mov ebx,[ngcwinptr] mov cx,[vrama+eax] mov ebx,[ebx] xor ecx,[ng16bprval] mov [ngcpixleft],ebx test ecx,2000h jnz near %%finline drawtilengwin16b %1,%2,%3,%%loop,%%finline,%4,%5,%6,%7,%8,%11,%12%%loop push eax mov ebx,[ngcwinptr] mov eax,[ngcpixleft] mov [ebx],eax pop eax cmp dword[ngcwinmode],1 je near .winclipped jmp .loop%endmacro%macro drawtile16bw2 14 mov byte[tleftn],33 mov dword[ngcwinptr],ngwintable mov dword[ngcwinmode],0 cmp dword[ngwintable],0 jne near .loop add dword[ngcwinptr],4 mov dword[ngcwinmode],1.winclipped mov ebx,[ngcwinptr] mov cx,[vrama+eax] cmp dword[ebx],8 jbe near %%processwinclip2b sub dword[ebx],8 xor ecx,[ng16bprval] test ecx,2000h jnz near .finlineb drawtileng16b %1,%2,%3,.winclipped,.finlineb,%4,%5,%6,%7,%8,%13,%14.loop mov ebx,[ngcwinptr] mov cx,[vrama+eax] cmp dword[ebx],8 jbe near %%processwinclip2b sub dword[ebx],8 xor ecx,[ng16bprval] test ecx,2000h jnz near .finline drawtileng16b %1,%2,%3,.loop,.finline,%4,%5,%6,%7,%8,%9,%10%%processwinclip2b mov ebx,[ngcwinptr] mov cx,[vrama+eax] mov ebx,[ebx] xor ecx,[ng16bprval] mov [ngcpixleft],ebx test ecx,2000h jnz near %%finline drawtilengwin16b %1,%2,%3,%%loop,%%finline,%4,%5,%6,%7,%8,%11,%12%%loop push eax mov ebx,[ngcwinptr] mov eax,[ngcpixleft] mov [ebx],eax pop eax cmp dword[ngcwinmode],1 je near .winclipped jmp .loop%endmacroNEWSYM drawtileng2b16b mov ebp,[cpalval+ebx*4] determinetransp drawtileng2b16btdrawtileng2b16bnt CheckWindowing drawtileng2bwin drawtile16b tltype2b, preparet2batile, cachesingle2bng,ngpalcon2b,test2ba,03h,vidmemch2s,cache2b16b,tilenormal,tilenormalbdrawtileng2bwin: drawtile16bw tltype2b, preparet2batile, cachesingle2bng,ngpalcon2b,test2ba,03h,vidmemch2s,cache2b16b,tilenormal,tilenormalb,tilenormalw,tilenormalwbdrawtileng2b16bt test byte[BGMS1+ebx*2+1],dl jnz near drawtileng2b16bms test byte[scadtng+ebx],dl jz near drawtileng2b16bnt CheckWindowing drawtileng2bwint drawtile16b tltype2b, preparet2batile, cachesingle2bng,ngpalcon2b,test2ba,03h,vidmemch2s,cache2b16b,tilenormalt,tilenormalbtdrawtileng2bwint: drawtile16bw tltype2b, preparet2batile, cachesingle2bng,ngpalcon2b,test2ba,03h,vidmemch2s,cache2b16b,tilenormalt,tilenormalbt,tilenormalwt,tilenormalwbtdrawtileng2b16bms: test byte[scadtng+ebx],dl jz near drawtileng2b16bmsnt DetermineWindow drawtileng2b16bmstmsw, drawtileng2b16bmstmw, drawtileng2b16bmstsw drawtile16b tltype2b, preparet2batile, cachesingle2bng,ngpalcon2b,test2ba,03h,vidmemch2s,cache2b16b,tilenormalmst,tilenormalbmstdrawtileng2b16bmstmsw: drawtile16bw tltype2b, preparet2batile, cachesingle2bng,ngpalcon2b,test2ba,03h,vidmemch2s,cache2b16b,tilenormalmst,tilenormalbmst,tilenormalwmst,tilenormalwbmstdrawtileng2b16bmstmw: drawtile16bw2 tltype2b, preparet2batile, cachesingle2bng,ngpalcon2b,test2ba,03h,vidmemch2s,cache2b16b,tilenormalmst,tilenormalbmst,tilenormalwsmt,tilenormalwbsmt,tilenormals,tilenormalbsdrawtileng2b16bmstsw: drawtile16bw2 tltype2b, preparet2batile, cachesingle2bng,ngpalcon2b,test2ba,03h,vidmemch2s,cache2b16b,tilenormalmst,tilenormalbmst,tilenormalwmsbt,tilenormalwbmsbt,tilenormalt,tilenormalbtdrawtileng2b16bmsnt DetermineWindow drawtileng2b16bmsntmsw, drawtileng2b16bmsntmw, drawtileng2b16bmsntsw drawtile16b tltype2b, preparet2batile, cachesingle2bng,ngpalcon2b,test2ba,03h,vidmemch2s,cache2b16b,tilenormalmsnt,tilenormalbmsntdrawtileng2b16bmsntmsw: drawtile16bw tltype2b, preparet2batile, cachesingle2bng,ngpalcon2b,test2ba,03h,vidmemch2s,cache2b16b,tilenormalmsnt,tilenormalbmsnt,tilenormalwmsnt,tilenormalwbmsntdrawtileng2b16bmsntmw: drawtile16bw2 tltype2b, preparet2batile, cachesingle2bng,ngpalcon2b,test2ba,03h,vidmemch2s,cache2b16b,tilenormalmsnt,tilenormalbmsnt,tilenormalwsmnt,tilenormalwbsmnt,tilenormals,tilenormalbsdrawtileng2b16bmsntsw: drawtile16bw2 tltype2b, preparet2batile, cachesingle2bng,ngpalcon2b,test2ba,03h,vidmemch2s,cache2b16b,tilenormalmsnt,tilenormalbmsnt,tilenormalwmsbnt,tilenormalwbmsbnt,tilenormal,tilenormalbNEWSYM drawtileng4b16b mov ebp,[cpalval+ebx*4] determinetransp drawtileng4b16btdrawtileng4b16bnt CheckWindowing drawtileng4bwin drawtile16b tltype4b, preparet4batile, cachesingle4bng,ngpalcon4b,test4ba,0Fh,vidmemch4s,cache4b16b,tilenormal,tilenormalbdrawtileng4bwin: drawtile16bw tltype4b, preparet4batile, cachesingle4bng,ngpalcon4b,test4ba,0Fh,vidmemch4s,cache4b16b,tilenormal,tilenormalb,tilenormalw,tilenormalwbdrawtileng4b16bt test byte[BGMS1+ebx*2+1],dl jnz near drawtileng4b16bms test byte[scadtng+ebx],dl jz near drawtileng4b16bnt CheckWindowing drawtileng4bwint drawtile16b tltype4b, preparet4batile, cachesingle4bng,ngpalcon4b,test4ba,0Fh,vidmemch4s,cache4b16b,tilenormalt,tilenormalbtdrawtileng4bwint: drawtile16bw tltype4b, preparet4batile, cachesingle4bng,ngpalcon4b,test4ba,0Fh,vidmemch4s,cache4b16b,tilenormalt,tilenormalbt,tilenormalwt,tilenormalwbtdrawtileng4b16bms: test byte[scadtng+ebx],dl jz near drawtileng4b16bmsnt DetermineWindow drawtileng4b16bmstmsw, drawtileng4b16bmstmw, drawtileng4b16bmstsw drawtile16b tltype4b, preparet4batile, cachesingle4bng,ngpalcon4b,test4ba,0Fh,vidmemch4s,cache4b16b,tilenormalmst,tilenormalbmstdrawtileng4b16bmstmsw: drawtile16bw tltype4b, preparet4batile, cachesingle4bng,ngpalcon4b,test4ba,0Fh,vidmemch4s,cache4b16b,tilenormalmst,tilenormalbmst,tilenormalwmst,tilenormalwbmstdrawtileng4b16bmstmw: drawtile16bw2 tltype4b, preparet4batile, cachesingle4bng,ngpalcon4b,test4ba,0Fh,vidmemch4s,cache4b16b,tilenormalmst,tilenormalbmst,tilenormalwsmt,tilenormalwbsmt,tilenormals,tilenormalbsdrawtileng4b16bmstsw: drawtile16bw2 tltype4b, preparet4batile, cachesingle4bng,ngpalcon4b,test4ba,0Fh,vidmemch4s,cache4b16b,tilenormalmst,tilenormalbmst,tilenormalwmsbt,tilenormalwbmsbt,tilenormalt,tilenormalbtdrawtileng4b16bmsnt DetermineWindow drawtileng4b16bmsntmsw, drawtileng4b16bmsntmw, drawtileng4b16bmsntsw drawtile16b tltype4b, preparet4batile, cachesingle4bng,ngpalcon4b,test4ba,0Fh,vidmemch4s,cache4b16b,tilenormalmsnt,tilenormalbmsntdrawtileng4b16bmsntmsw: drawtile16bw tltype4b, preparet4batile, cachesingle4bng,ngpalcon4b,test4ba,0Fh,vidmemch4s,cache4b16b,tilenormalmsnt,tilenormalbmsnt,tilenormalwmsnt,tilenormalwbmsntdrawtileng4b16bmsntmw: drawtile16bw2 tltype4b, preparet4batile, cachesingle4bng,ngpalcon4b,test4ba,0Fh,vidmemch4s,cache4b16b,tilenormalmsnt,tilenormalbmsnt,tilenormalwsmnt,tilenormalwbsmnt,tilenormals,tilenormalbsdrawtileng4b16bmsntsw: drawtile16bw2 tltype4b, preparet4batile, cachesingle4bng,ngpalcon4b,test4ba,0Fh,vidmemch4s,cache4b16b,tilenormalmsnt,tilenormalbmsnt,tilenormalwmsbnt,tilenormalwbmsbnt,tilenormal,tilenormalb
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -