📄 mode7.mac
字号:
lea edi,[ecx+vrama]
jmp %%nextposy
%%finishmode7
xor eax,eax
mov dh,byte[curmosaicsz]
cmp dh,1
jne near %2
ret
;**********************************************************
; Mode 7, no repetition mode
;**********************************************************
%%norep2
test byte[mode7set],40h
jnz %%tilerep2
jmp %%nextvalb2
ALIGN16
%%nextvalb2
cmp byte[.mode7ypos+2],3
ja %%offscr2
cmp byte[.mode7xpos+2],3
jbe near %%offscr3
%%offscr2
mov eax,[.mode7xadder]
mov ebx,[.mode7yadder]
add [.mode7xpos],eax
sub [.mode7ypos],ebx
add esi,%3
dec dword[.temp]
jnz near %%nextvalb2
mov dword[.temp],256
add esi,75036*2-256
dec dword[.temp2]
jnz near %%nextvalb2
jmp %%finishmode7
%%tilerep2
%%nextvalb3
cmp byte[.mode7ypos+2],3
ja %%offscr2b
cmp byte[.mode7xpos+2],3
jbe near %%offscr3
%%offscr2b
mov ch,[.mode7xpos+1]
mov eax,[.mode7xadder]
mov cl,[.mode7ypos+1]
mov ebx,[.mode7yadder]
mov dl,[mode7tab+ecx]
add [.mode7xpos],eax
mov dl,[vrama+edx]
sub [.mode7ypos],ebx
%1
dec dword[.temp]
jnz near %%nextvalb3
mov dword[.temp],256
add esi,75036*2-256
dec dword[.temp2]
jnz near %%nextvalb3
jmp %%finishmode7
%%offscr3
mov eax,[.mode7xpos]
and eax,7FFh
mov [.mode7xrpos],eax
mov eax,[.mode7ypos]
and eax,7FFh
mov [.mode7yrpos],eax
; get tile data offset into edi
mov ebx,[.mode7ypos+1]
mov eax,[.mode7xpos+1]
shl ebx,5
shr eax,3
and ebx,07FF8h
shl al,1
mov bl,al
mov edi,[vram]
xor ch,ch
mov [.mode7ptr],ebx
mov cl,[edi+ebx]
shl ecx,7
add edi,ecx
jmp %%nextvalr
ALIGN16
%%nodr2
add esi,%3
dec dword[.temp]
jz near %%fin2
%%nextvalr
test byte[.mode7xrpos+1],0F8h
jnz near %%rposoffxr
%%nextposxr
test byte[.mode7yrpos+1],0F8h
jnz near %%rposoffyr
%%nextposyr
mov cl,[.mode7yrpos+1]
mov edx,[.mode7xadder]
mov ch,[.mode7xrpos+1]
add dword[.mode7xrpos],edx
mov edx,[.mode7yadder]
sub dword[.mode7yrpos],edx
xor edx,edx
mov dl,[mode7tab+ecx]
mov dl,[edi+edx]
%1
dec dword[.temp]
jnz near %%nextvalr
%%fin2
mov dword[.temp],256
add esi,75036*2-256
dec dword[.temp2]
jnz near %%nextvalr
jmp %%finishmode7
%%rposoffxr
mov al,[.mode7xinc]
mov edi,[vram]
add [.mode7ptr],al
mov cl,byte[.mode7xincc]
cmp byte[.mode7ptr],cl
je %%roff
%%roffxretb
mov ebx,[.mode7ptr]
xor ecx,ecx
mov cl,[edi+ebx]
mov eax,[.mode7xadd2]
shl ecx,7
sub [.mode7xrpos],eax
add edi,ecx
jmp %%nextvalr
%%rposoffyr
mov al,[.mode7yinc]
mov edi,[vram]
sub [.mode7ptr+1],al
js %%roff
%%roffyretb
mov ebx,[.mode7ptr]
xor ecx,ecx
mov cl,[edi+ebx]
mov eax,[.mode7yadd2]
shl ecx,7
add [.mode7yrpos],eax
add edi,ecx
jmp %%nextposxr
%%roff
test byte[mode7set],40h
jnz %%tilerep3
jmp %%finishmode7
%%tilerep3
and byte[.mode7yrpos+1],07h
and byte[.mode7xrpos+1],07h
mov cl,[.mode7yrpos+1]
mov eax,[.mode7xadder]
mov ch,[.mode7xrpos+1]
add [.mode7xrpos],eax
mov dl,[mode7tab+ecx]
mov eax,[.mode7yadder]
mov dl,[vrama+edx]
sub [.mode7yrpos],eax
%1
dec dword[.temp]
jnz near %%tilerep3
mov dword[.temp],256
add esi,75036*2-256
dec dword[.temp2]
jnz near %%tilerep3
jmp %%finishmode7
%endmacro
%macro ProcessBuildWindow 1
mov dword[ngwinen],0
test byte[winbg1enval+ebx+%1*256],0Ah
jz %%nowindowing
push eax
push ebx
mov al,[winlogicaval+ebx*2]
shr al,%1*2
and al,03h
mov [nglogicval],al
mov eax,ebx
add ebx,%1*256
call BuildWindow
cmp dword[ngwintable],0
je %%zero
dec dword[ngwintable]
jmp %%notzero
%%zero
dec dword[ngwintable+4]
%%notzero
pop ebx
pop eax
mov dword[ngcwinptr],ngwintable
%%nowindowing
%endmacro
;************************************
%macro Mode7Processngw 3
mov dword[ngwleftb],256
mov dword[ngwleft],256
test byte[mode7set],80h
jnz near %%norep2
mov eax,[.mode7xpos]
and eax,7FFh
mov [mode7xrpos],eax
mov eax,[.mode7ypos]
and eax,7FFh
mov [mode7yrpos],eax
; get tile data offset into edi
mov ebx,[.mode7ypos+1]
mov eax,[.mode7xpos+1]
shl ebx,5
shr eax,3
and ebx,07FF8h
shl al,1
mov bl,al
mov edi,[vram]
xor ch,ch
mov [.mode7ptr],ebx
mov cl,[edi+ebx]
shl ecx,7
add edi,ecx
xor dl,dl
xor ecx,ecx
mov ebx,[.mode7xadder]
test ebx,80000000h
jz %%nexta
neg ebx
%%nexta
cmp ebx,0800h
jl %%skipx
sub ebx,800h
add ecx,[.mode7xadd2]
add dl,[.mode7xinc]
jmp %%nexta
%%skipx
mov [.m7xaddofa],ecx
mov [.m7xaddof2a],dl
xor dl,dl
xor ecx,ecx
mov ebx,[.mode7yadder]
test ebx,80000000h
jz %%nextay
neg ebx
%%nextay
cmp ebx,0800h
jl %%skipy
sub ebx,800h
add ecx,[.mode7yadd2]
add dl,[.mode7yinc]
jmp %%nextay
%%skipy
mov [.m7yaddofa],ecx
mov [.m7yaddof2a],dl
xor ecx,ecx
mov eax,[mode7xrpos]
mov ebx,[.mode7ptr]
call ProcessMode7ngwin
cmp dword[ngwleftb],0
jne near %%nextval
jmp %%finishmode7
ALIGN16
%%nextval
test ah,0F8h
jnz near %%rposoffx
%%nextposx
test byte[mode7yrpos+1],0F8h
jnz near %%rposoffy
%%nextposy
mov ch,ah
mov cl,byte[mode7yrpos+1]
mov edx,[mode7yadder]
sub dword[mode7yrpos],edx
xor edx,edx
mov dl,[mode7tab+ecx]
add eax,[mode7xadder]
mov dl,[edi+edx]
%1
dec dword[ngwleftb]
jnz near %%nextval
mov [mode7xrpos],eax
cmp dword[ngwleft],0
je %%notskipvalues
call ProcessMode7ngwinB
cmp dword[ngwleftb],0
jne near %%nextval
%%notskipvalues
jmp %%finishmode7
%%rposoffx
sub eax,[.m7xaddofa]
add bl,[.m7xaddof2a]
test ah,0F8h
jz %%noaddstuff
add bl,[.mode7xinc]
sub eax,[.mode7xadd2]
%%noaddstuff
xor ecx,ecx
mov cl,[vrama+ebx]
shl ecx,7
lea edi,[ecx+vrama]
jmp %%nextposx
%%rposoffy
mov edx,[.m7yaddofa]
sub bh,[.m7yaddof2a]
add dword[mode7yrpos],edx
test byte[mode7yrpos+1],0F8h
jz %%noaddstuff2
mov edx,[.mode7yadd2]
sub bh,[.mode7yinc]
add dword[mode7yrpos],edx
%%noaddstuff2
and ebx,07FFFh
xor ecx,ecx
mov cl,[vrama+ebx]
shl ecx,7
lea edi,[ecx+vrama]
jmp %%nextposy
%%finishmode7
xor eax,eax
mov dh,byte[curmosaicsz]
cmp dh,1
jne near %2
ret
;**********************************************************
; Mode 7, no repetition mode
;**********************************************************
%%norep2
call ProcessMode7ngwinC
cmp dword[ngwleftb],0
jne near %%nextvald
jmp %%finishmode7
%%nextvald
mov dword[ngwleft],0
test byte[mode7set],40h
jnz near %%tilerep2
jmp %%nextvalb2
ALIGN16
%%nextvalb2
cmp byte[mode7ypos+2],3
ja %%offscr2
cmp byte[mode7xpos+2],3
jbe near %%offscr3
%%offscr2
mov eax,[mode7xadder]
mov ebx,[mode7yadder]
add [mode7xpos],eax
sub [mode7ypos],ebx
add esi,%3
dec dword[ngwleftb]
jnz near %%nextvalb2
cmp dword[ngwleft],0
je %%notskipvalues3b
call ProcessMode7ngwinD
cmp dword[ngwleftb],0
jne near %%nextvalb2
%%notskipvalues3b
jmp %%finishmode7
%%tilerep2
%%nextvalb3
cmp byte[mode7ypos+2],3
ja %%offscr2b
cmp byte[mode7xpos+2],3
jbe near %%offscr3
%%offscr2b
mov ch,[mode7xpos+1]
mov eax,[mode7xadder]
mov cl,[mode7ypos+1]
mov ebx,[mode7yadder]
mov dl,[mode7tab+ecx]
add [mode7xpos],eax
mov dl,[vrama+edx]
sub [mode7ypos],ebx
%1
dec dword[ngwleftb]
jnz near %%nextvalb3
cmp dword[ngwleft],0
je %%notskipvalues3
call ProcessMode7ngwinD
cmp dword[ngwleftb],0
jne near %%nextvalb3
%%notskipvalues3
jmp %%finishmode7
%%offscr3
mov eax,[mode7xpos]
and eax,7FFh
mov [mode7xrpos],eax
mov eax,[mode7ypos]
and eax,7FFh
mov [mode7yrpos],eax
; get tile data offset into edi
mov ebx,[mode7ypos+1]
mov eax,[mode7xpos+1]
shl ebx,5
shr eax,3
and ebx,07FF8h
shl al,1
mov bl,al
mov edi,[vram]
xor ch,ch
mov [.mode7ptr],ebx
mov cl,[edi+ebx]
shl ecx,7
add edi,ecx
jmp %%nextvalr
ALIGN16
%%nodr2
add esi,%3
dec dword[ngwleftb]
jz near %%fin2
%%nextvalr
test byte[mode7xrpos+1],0F8h
jnz near %%rposoffxr
%%nextposxr
test byte[mode7yrpos+1],0F8h
jnz near %%rposoffyr
%%nextposyr
mov cl,[mode7yrpos+1]
mov ch,[mode7xrpos+1]
mov edx,[mode7xadder]
add dword[mode7xrpos],edx
mov edx,[mode7yadder]
sub dword[mode7yrpos],edx
xor edx,edx
mov dl,[mode7tab+ecx]
mov dl,[edi+edx]
%1
dec dword[ngwleftb]
jnz near %%nextvalr
%%fin2
cmp dword[ngwleft],0
je %%notskipvalues4
call ProcessMode7ngwinB
cmp dword[ngwleftb],0
jne near %%nextvalr
%%notskipvalues4
jmp %%finishmode7
%%rposoffxr
mov al,[.mode7xinc]
mov edi,[vram]
add [.mode7ptr],al
mov cl,byte[.mode7xincc]
cmp byte[.mode7ptr],cl
je %%roff
%%roffxretb
mov ebx,[.mode7ptr]
xor ecx,ecx
mov cl,[edi+ebx]
mov eax,[.mode7xadd2]
shl ecx,7
sub [mode7xrpos],eax
add edi,ecx
jmp %%nextvalr
%%rposoffyr
mov al,[.mode7yinc]
mov edi,[vram]
sub [.mode7ptr+1],al
js %%roff
%%roffyretb
mov ebx,[.mode7ptr]
xor ecx,ecx
mov cl,[edi+ebx]
mov eax,[.mode7yadd2]
shl ecx,7
add [mode7yrpos],eax
add edi,ecx
jmp %%nextposxr
%%roff
test byte[mode7set],40h
jnz %%tilerep3
jmp %%finishmode7
%%tilerep3
and byte[mode7yrpos+1],07h
and byte[mode7xrpos+1],07h
mov cl,[mode7yrpos+1]
mov eax,[mode7xadder]
mov ch,[mode7xrpos+1]
add [mode7xrpos],eax
mov dl,[mode7tab+ecx]
mov eax,[mode7yadder]
mov dl,[vrama+edx]
sub [mode7yrpos],eax
%1
dec dword[ngwleftb]
jnz near %%tilerep3
mov [mode7xrpos],eax
cmp dword[ngwleft],0
je %%notskipvalues5
call ProcessMode7ngwinB
cmp dword[ngwleftb],0
jne near %%tilerep3
%%notskipvalues5
jmp %%finishmode7
%endmacro
;************************************
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -