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

📄 vidmacrb.mac

📁 十七种模拟器源代码 非常有用的作课程设计不可缺少的
💻 MAC
📖 第 1 页 / 共 3 页
字号:
;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 OMBGTestVal,ngptrdat2,cachesingle4bng,ofshvaladd,ofsmtptrs,ofsmcptr2
EXTSYM Testval






; makev16t macros

%macro procwindowback 0
    mov byte[winon],0
    mov bl,[wincolen]
    and bl,00001010b
    cmp bl,00001010b
    je near .dualwin
    mov bl,[scaddset]
    shr bl,4
    and bl,00000011b

    cmp bl,0
    je near .finishwin
    cmp bl,3
    je near .clearwin
    test byte[wincolen],00001010b
    jz near .finishwin

    mov al,[wincolen]
    and al,00000101b

    mov esi,windowdata
    mov byte[winon],1
    mov byte[numwin],0
    mov cl,[winl2]
    mov ch,[winr2]
    test byte[wincolen],00000010b
    jz .nowin1
    mov cl,[winl1]
    mov ch,[winr1]
    shl al,2
.nowin1
    cmp ch,255
    je .noinc
    inc ch
.noinc
    test al,04h
    jnz near .wininside
    cmp cl,ch
    jae .noinsidemask
    mov byte[esi],0
    mov byte[esi+1],01h
    mov byte[esi+2],cl
    mov byte[esi+3],0FFh
    mov byte[esi+4],ch
    mov byte[esi+5],01h
    mov byte[numwin],3
    jmp .finishwin
.noinsidemask
    mov byte[winon],2
    jmp .finishwin
.wininside
    cmp cl,ch
    ja .nooutsidemask
.nonotoutside
    cmp ch,254
    jb .skipnodraw
    cmp cl,1
    jbe .noinsidemask
.skipnodraw
    mov byte[esi],cl
    mov byte[esi+1],01h
    mov byte[esi+2],ch
    mov byte[esi+3],0FFh
    mov byte[numwin],2
    jmp .finishwin
.nooutsidemask
    mov byte[winon],5
    jmp .finishwin
.dualwin
    mov al,[wincolen]
    mov bl,[scaddset]
    and bl,30h
    cmp bl,30h
    je .clearwin
    cmp bl,00h
    je .finishwin
    call makedualwincol
    mov byte[winon],3
    jmp .finishwin
.clearwin
    mov byte[winon],4
.finishwin
%endmacro


%macro procwindowback2 0
    mov byte[winon],0
    mov al,[wincolen]
    test al,00001010b
    jz near .finishwin
    mov esi,windowdata
    mov bl,al
    mov byte[winon],1
    and bl,00001010b
    and al,00000101b
    mov byte[numwin],0
    cmp bl,00001010b
    je near .multiwin
    test bl,00000010b
    jnz .win1
    mov cl,[winl2]
    mov ch,[winr2]
    shr al,2
    jmp .okaywin
.win1
    mov cl,[winl1]
    mov ch,[winr1]
    and al,01h
.okaywin
    test al,01h
    jz near .wininside
    cmp cl,ch
    jae .noinsidemask
    mov byte[esi],0
    mov byte[esi+1],01h
    mov byte[esi+2],cl
    mov byte[esi+3],0FFh
    mov byte[esi+4],ch
    mov byte[esi+5],01h
    mov byte[numwin],3
    jmp .finishwin
.noinsidemask
    mov byte[esi],0
    mov byte[esi+1],01h
    mov byte[numwin],1
    jmp .finishwin
.wininside
    cmp cl,ch
    ja .nooutsidemask
.nonotoutside
    cmp ch,254
    jb .skipnodraw
    cmp cl,1
    jbe .noinsidemask
.skipnodraw
    mov byte[esi],cl
    mov byte[esi+1],01h
    mov byte[esi+2],ch
    mov byte[esi+3],0FFh
    mov byte[numwin],2
    jmp .finishwin
.nooutsidemask
    mov byte[winon],0
    jmp .finishwin
.multiwin
    mov byte[esi],0
    mov byte[esi+1],01h
    mov byte[numwin],1
.finishwin
%endmacro


;*******************************************************
; Processes & Draws 4-bit sprites for both main & sub
;*******************************************************

%macro drawspr16bt 2
    mov al,[esi+%1]
    test al,0Fh
    jz %%skip
    add al,ch
    mov edx,[pal16b+eax*4]
    mov [edi-%2],dx
    mov [ebp-%2],dx
%%skip
%endmacro


%macro drawspr16btwo 3
    mov al,[esi+%1]
    test al,0Fh
    jz %%skip
    cmp byte[winspdata+ebx-8+%3+16],0
    jne %%skip
    add al,ch
    mov edx,[pal16b+eax*4]
    mov [edi-%2],dx
    mov [ebp-%2],dx
%%skip
%endmacro


%macro sprpriorityinit 1
    cmp byte[sprclprio+ebp],0
    je near .endobj
    test byte[cwinenabm],10h
    jz .drawnowin
    cmp byte[winonsp],0
    jne near %1
.drawnowin
%endmacro

%macro sprprioritydrawbt 2
    cmp dword[sprsingle],1
    je near .drawsingle
    mov [csprprlft],cl
    mov esi,[currentobjptr]
    mov edi,[curvidoffset]
    mov edx,esi
    xor ebx,ebx
.loopobj
    test byte[esi+7],20h
    jnz near .drawspriteflipx
    mov bx,[esi]
    push esi
    mov ch,[esi+6]
    mov dl,[esi+7]
    xor eax,eax
    and edx,03h
    cmp edx,ebp
    jne near .notprio
    mov esi,[esi+2]
    mov cl,[csprbit]
    sprdrawa16b %1
    pop esi
    add esi,8
    dec byte[csprprlft]
    jnz near .loopobj
    rol byte[csprbit],1
    cmp byte[csprbit],1
    je near .clearcsprmem
    ret
.notprio
    mov esi,[esi+2]
    mov dl,[csprbit]
    sprdrawa sprdrawpra2
    pop esi
    add esi,8
    dec byte[csprprlft]
    jnz near .loopobj
    rol byte[csprbit],1
    cmp byte[csprbit],1
    je near .clearcsprmem
    ret
.drawspriteflipx
    mov bx,[esi]
    push esi
    mov ch,[esi+6]
    mov dl,[esi+7]
    xor eax,eax
    and edx,03h
    cmp edx,ebp
    jne near .notpriof
    mov esi,[esi+2]
    mov cl,[csprbit]
    sprdrawaf16b %1
    pop esi
    add esi,8
    dec byte[csprprlft]
    jnz near .loopobj
    rol byte[csprbit],1
    cmp byte[csprbit],1
    je near .clearcsprmem
.endobj
    ret
.notpriof
    mov esi,[esi+2]
    mov dl,[csprbit]
    sprdrawaf sprdrawpra2
    pop esi
    add esi,8
    dec byte[csprprlft]
    jnz near .loopobj
    rol byte[csprbit],1
    cmp byte[csprbit],1
    je near .clearcsprmem
    ret
.clearcsprmem
    xor eax,eax
    mov ecx,64
    mov edi,sprpriodata+16
    rep stosd
    ret
.drawsingle
    mov esi,[currentobjptr]
    mov edi,[curvidoffset]
    mov edx,ecx
    and edx,0FFh
    xor eax,eax
    shl edx,3
    sub edx,8
    add edx,esi
    mov esi,edx
    xor ebx,ebx
.loopobj2
    test byte[esi+7],20h
    jnz near .drawspriteflipx2
    mov bx,[esi]
    push esi
    mov ch,[esi+6]
    mov esi,[esi+2]
    sprdrawa16b %2
    pop esi
    sub esi,8
    dec cl
    jnz near .loopobj2
    ret
.drawspriteflipx2
    mov bx,[esi]
    push esi
    mov ch,[esi+6]
    mov esi,[esi+2]
    sprdrawaf16b %2
    pop esi
    sub esi,8
    dec cl
    jnz near .loopobj2
    ret
%endmacro

%macro sprdrawpra16bt 1
    or eax,eax
    jz %%skip
    test byte[sprpriodata+ebx-%1+16],cl
    jnz %%skip
    add al,ch
    mov edx,[pal16b+eax*4]
    mov [edi+ebx*2-%1*2],dx
    mov [transpbuf+32+ebx*2-%1*2],dx
    or byte[sprpriodata+ebx-%1+16],cl
%%skip
%endmacro

%macro sprdrawprb16bt 1
    or eax,eax
    jz %%skip
    add al,ch
    mov edx,[pal16b+eax*4]
    mov [edi+ebx*2-%1*2],dx
    mov [transpbuf+32+ebx*2-%1*2],dx
%%skip
%endmacro


;*******************************************************
; Processes & Draws 4-bit sprites w/ transparency
;*******************************************************

%macro drawspr16ta 2
    mov al,[esi+%1]
    or al,al
    jz %%skip
    add al,ch
    mov edx,[pal16b+eax*4]
    mov [edi+ebx-%2],dx
%%skip
%endmacro

%macro drawspr16tb 2
    mov al,[esi+%1]
    or al,al
    jz %%skip
    add al,ch
    mov ebx,[ebp-%2]
    mov edx,[pal16b+eax*4]
    cmp bx,0
    je %%noadd
    and edx,[vesa2_clbit]
    and ebx,[vesa2_clbit]
    add edx,ebx
    shr edx,1
%%noadd
    mov [edi-%2],dx
%%skip
%endmacro


%macro drawspr16tc 2
    mov al,[esi+%1]
    or al,al
    jz %%skip
    add al,ch
    mov ebx,[ebp-%2]
    mov edx,[pal16bcl+eax*4]
    and ebx,[vesa2_clbit]
    add edx,ebx
    shr edx,1
    mov edx,[fulladdtab+edx*2]
    mov [edi-%2],dx
%%skip
%endmacro


%macro drawspr16td 2
    mov al,[esi+%1]
    or al,al
    jz %%skip
    add al,ch
    mov ebx,[ebp-%2]
    mov edx,[pal16bxcl+eax*4]
    and ebx,[vesa2_clbit]
    add edx,ebx
    shr edx,1
    mov edx,[fulladdtab+edx*2]
    xor edx,0FFFFh
    mov [edi-%2],dx
%%skip
%endmacro

%macro drawspr16tawinon 3
    mov al,[esi+%1]
    or al,al
    jz %%skip
    cmp byte[winspdata+ebx-8+%3+16],0
    jne %%skip
    add al,ch
    mov edx,[pal16b+eax*4]
    mov [edi+ebx*2-%2],dx
%%skip
%endmacro

%macro drawspr16tbwinon 3
    mov al,[esi+%1]
    or al,al
    jz %%skip
    cmp byte[winspdata+ebx-8+%3+16],0
    jne %%skip
    add al,ch
    mov edx,[ebp-%2]
    mov eax,[pal16b+eax*4]
    cmp dx,0
    je %%noadd
    and eax,[vesa2_clbit]
    and edx,[vesa2_clbit]
    add eax,edx
    shr eax,1
%%noadd
    mov [edi-%2],ax
    xor eax,eax
%%skip
%endmacro

%macro drawspr16tcwinon 3
    mov al,[esi+%1]
    or al,al
    jz %%skip
    cmp byte[winspdata+ebx-8+%3+16],0
    jne %%skip
    add al,ch
    mov edx,[ebp-%2]
    mov eax,[pal16bcl+eax*4]
    and edx,[vesa2_clbit]
    add eax,edx
    shr eax,1
    mov eax,[fulladdtab+eax*2]
    mov [edi-%2],ax
    xor eax,eax
%%skip
%endmacro

%macro drawspr16tdwinon 3
    mov al,[esi+%1]
    or al,al
    jz %%skip
    cmp byte[winspdata+ebx-8+%3+16],0
    jne %%skip
    add al,ch
    mov edx,[ebp-%2]
    mov eax,[pal16bxcl+eax*4]
    and edx,[vesa2_clbit]
    add eax,edx
    shr eax,1
    mov eax,[fulladdtab+eax*2]
    xor eax,0FFFFh
    mov [edi-%2],ax
    xor eax,eax
%%skip
%endmacro

%macro drawsprgrp 1
    %1 0, 16
    %1 1, 14
    %1 2, 12
    %1 3, 10
    %1 4, 8
    %1 5, 6
    %1 6, 4
    %1 7, 2
%endmacro

%macro drawsprgrpf 1
    %1 7, 16
    %1 6, 14
    %1 5, 12
    %1 4, 10
    %1 3, 8
    %1 2, 6
    %1 1, 4
    %1 0, 2
%endmacro

%macro drawsprgrpwin 1
    %1 0, 16, 0
    %1 1, 14, 1
    %1 2, 12, 2
    %1 3, 10, 3
    %1 4, 8, 4
    %1 5, 6, 5
    %1 6, 4, 6
    %1 7, 2, 7
%endmacro

%macro drawsprgrpfwin 1
    %1 7, 16, 0
    %1 6, 14, 1
    %1 5, 12, 2
    %1 4, 10, 3
    %1 3, 8, 4
    %1 2, 6, 5
    %1 1, 4, 6
    %1 0, 2, 7
%endmacro


%macro sprprioritydrawt16b 4
    cmp dword[sprsingle],1
    je near .drawsingle
    mov [csprprlft],cl
    mov esi,[currentobjptr]
    mov edi,[curvidoffset]
    mov edx,esi
    xor ebx,ebx
.loopobj
    test byte[esi+7],20h
    jnz near .drawspriteflipx
    mov bx,[esi]
    push esi
    mov ch,[esi+6]
    mov dl,[esi+7]
    xor eax,eax
    and edx,03h
    cmp edx,ebp
    jne near .notprio
    cmp ch,12*16
    jae near .transpobj
    mov esi,[esi+2]
    mov cl,[csprbit]
    sprdrawa16b %3
    pop esi
    add esi,8
    dec byte[csprprlft]
    jnz near .loopobj
    rol byte[csprbit],1
    cmp byte[csprbit],1
    je near .clearcsprmem
    ret
.transpobj
    mov esi,[esi+2]
    mov cl,[csprbit]
    sprdrawa16b %1
    pop esi
    add esi,8
    dec byte[csprprlft]
    jnz near .loopobj
    rol byte[csprbit],1
    cmp byte[csprbit],1
    je near .clearcsprmem
    ret
.notprio

⌨️ 快捷键说明

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