📄 newgfx16.mac
字号:
%12 8
%12 10
%12 12
%12 14
add ecx,16
sub edi,288*2
dec dword[tleftnb]
jnz near %%nextbm
add edi,288*2
%5
mov ebx,[ng16bbgval]
add ax,2
inc dword[bg1totng+ebx*4]
add edi,16
test eax,03Fh
jz %%tileadd
%%next
dec byte[tleftn]
jnz near %4
pop ebx
ret
%%docache
call %3
mov byte[%9+ecx],dl
call %10
jmp %%returnfromcache
%%tileadd
add ax,[bgtxadd]
jmp %%next
%endmacro
%macro drawtileng16x1616b 12
; tile value : bit 15 = flipy, bit 14 = flipx, bit 13 = priority value
; bit 10-12 = palette, 0-9=tile#
mov ebx,[ng16bbgval]
mov dl,ch
inc dword[bg1drwng+ebx*4]
and ecx,3FFh
and edx,1Fh
add ecx,[ngptrdat2]
add cx,[taddnfy16x16]
test dword[vrama+eax],8000h
jz %%noflipy
add cx,[taddfy16x16]
%%noflipy
test dword[vrama+eax],4000h
jz %%noflipx
inc cx
%%noflipx
%%nexttile
push ecx
push edx
mov edx,[%6+edx*4]
%7
jnz near %%docache
cmp byte[%9+ecx],dl
je %%returnfromcache
mov byte[%9+ecx],dl
call %10
%%returnfromcache
cmp byte[%1+ecx],2
je near %%done
cmp byte[%1+ecx],0
je near %%parttile
%2
; start drawing from ecx
test dword[vrama+eax],4000h
jz %%noflipxfull
add ecx,128
%%noflipxfull
test dword[vrama+eax],8000h
jnz near %%flipyfull
%11 0,0
%11 288*2,16
%11 288*4,32
%11 288*6,48
%11 288*8,64
%11 288*10,80
%11 288*12,96
%11 288*14,112
jmp %%done
%%flipyfull
%11 288*14,0
%11 288*12,16
%11 288*10,32
%11 288*8,48
%11 288*6,64
%11 288*4,80
%11 288*2,96
%11 0,112
jmp %%done
%%parttile
%2
; start drawing from ecx to edi
test word[vrama+eax],4000h
jz %%noflipxpart
add ecx,128
%%noflipxpart
test word[vrama+eax],8000h
jnz near %%flipypart
mov dword[tleftnb],8
%%nextb
%12 0
%12 2
%12 4
%12 6
%12 8
%12 10
%12 12
%12 14
add ecx,16
add edi,288*2
dec dword[tleftnb]
jnz near %%nextb
sub edi,288*2*8
jmp %%done
%%flipypart
add edi,288*2*7
mov dword[tleftnb],8
%%nextbm
%12 0
%12 2
%12 4
%12 6
%12 8
%12 10
%12 12
%12 14
add ecx,16
sub edi,288*2
dec dword[tleftnb]
jnz near %%nextbm
add edi,288*2
%%done
pop edx
pop ecx
inc cx
test dword[vrama+eax],4000h
jz %%noflipxb
sub cx,2
%%noflipxb
add edi,16
xor dword[switch16x16],1
jnz near %%nexttile
%%ntile
mov ebx,[ng16bbgval]
add ax,2
inc dword[bg1totng+ebx*4]
test eax,03Fh
jz %%tileadd
%%next
dec byte[tleftn]
jnz near %4
pop ebx
ret
%5
add edi,32
jmp %%ntile
%%docache
call %3
mov byte[%9+ecx],dl
call %10
jmp %%returnfromcache
%%tileadd
add ax,[bgtxadd]
jmp %%next
%endmacro
%macro ProcessBuildWindow 1
mov dword[ngwinen],0
test byte[winbg1enval+ebx+%1*256],0Ah
jz %%nowindowing
push eax
push ebx
;NEWSYM winlogicaval, times 256 dw 0
mov al,[winlogicaval+ebx*2]
shr al,%1*2
and al,03h
mov [nglogicval],al
mov eax,ebx
add ebx,%1*256
call BuildWindow
mov eax,edi
sub eax,esi
sar eax,1
cmp dword[ngwintable],0
jne %%notzero
sub [ngwintable+4],eax
jmp %%done
%%notzero
sub [ngwintable],eax
%%done
pop ebx
pop eax
%%nowindowing
%endmacro
%macro drawbgtileng16b 2
mov dword[ng16bprval],0
mov dword[ng16bbgval],%1
cmp byte[t16x161+ebx+%1*256],1
je near .tiles16x16
push ebx
mov eax,[BGPT1+ebx*2+%1*512]
test ecx,100h
jz .noyinc
add eax,[BGPT1Y+ebx*2+%1*512]
.noyinc
lea ecx,[ecx*8]
and ecx,07C0h ; 1Fh*40h
add eax,ecx
mov ecx,[BG1SXl+ebx*2+%1*512]
mov edx,[BGPT1X+ebx*2+%1*512]
test ecx,100h
jz .noxinc
add eax,edx
neg dx
.noxinc
mov edi,ecx
sub dx,64
and ecx,0F8h
and eax,0FFFFh
shr ecx,2
mov [bgtxadd],edx
mov [bgtxad+ebx*2+%2*512],dx
add eax,ecx
mov ecx,[BGOPT1+ebx*2+%1*512]
mov edx,[BGMA+ebx]
and edi,07h
and edx,07h
and ecx,0FFFFh
mov edx,[colormodedef+edx*4+%1]
neg edi
add edi,edi
cmp dl,2
jne near .no4bit
shr ecx,5
add edi,esi
mov [ngptrdat+%2*1024+ebx*4],ecx
mov [ngptrdat2],ecx
mov [ngceax+%2*1024+ebx*4],eax
mov [ngcedi+%2*1024+ebx*4],edi
; eax = pointer to beginning of tile area
ProcessBuildWindow %1
mov ecx,ebx
add ecx,%2*256
mov dl,1 << %2
jmp drawtileng4b16b
.no4bit
cmp dl,1
jne near .no2bit
shr ecx,4
add edi,esi
mov [ngptrdat+%2*1024+ebx*4],ecx
mov [ngptrdat2],ecx
mov [ngceax+%2*1024+ebx*4],eax
mov [ngcedi+%2*1024+ebx*4],edi
; eax = pointer to beginning of tile area
mov dword[mode0add],0
ProcessBuildWindow %1
cmp byte[BGMA+ebx],0
jne .nomode0
push ebx
mov ebx,[mode0ads]
mov [mode0add],ebx
pop ebx
.nomode0
mov ecx,ebx
add ecx,%2*256
mov dl,1 << %2
jmp drawtileng2b16b
.no2bit
cmp dl,3
jne near .no8bit
shr ecx,6
add edi,esi
mov [ngptrdat+%2*1024+ebx*4],ecx
mov [ngptrdat2],ecx
mov [ngceax+%2*1024+ebx*4],eax
mov [ngcedi+%2*1024+ebx*4],edi
; eax = pointer to beginning of tile area
ProcessBuildWindow %1
mov ecx,ebx
add ecx,%2*256
mov dl,1 << %2
jmp drawtileng8b16b
.no8bit
pop ebx
ret
.tiles16x16
mov dword[taddnfy16x16],0
mov dword[taddfy16x16],16
test ecx,08h
jz .nobottomy
mov dword[taddnfy16x16],16
mov dword[taddfy16x16],-16
.nobottomy
push ebx
mov eax,[BGPT1+ebx*2+%1*512]
test ecx,200h
jz .noyinc2
add eax,[BGPT1Y+ebx*2+%1*512]
.noyinc2
lea ecx,[ecx*4]
and ecx,07C0h ; 1Fh*40h
add eax,ecx
mov ecx,[BG1SXl+ebx*2+%1*512]
mov edx,[BGPT1X+ebx*2+%1*512]
test ecx,200h
jz .noxinc2
add eax,edx
neg dx
.noxinc2
mov edi,ecx
sub dx,64
and ecx,1F0h
and eax,0FFFFh
shr ecx,3
mov [bgtxadd],edx
mov [bgtxad+ebx*2+%2*512],dx
add eax,ecx
mov ecx,[BGOPT1+ebx*2+%1*512]
mov edx,[BGMA+ebx]
and edi,0Fh
and edx,07h
and ecx,0FFFFh
mov edx,[colormodedef+edx*4+%1]
neg edi
add edi,edi
cmp dl,2
jne near .no4bit2
shr ecx,5
add edi,esi
mov [ngptrdat+%2*1024+ebx*4],ecx
mov [ngptrdat2],ecx
mov [ngceax+%2*1024+ebx*4],eax
mov [ngcedi+%2*1024+ebx*4],edi
; eax = pointer to beginning of tile area
ProcessBuildWindow %1
mov ecx,ebx
add ecx,%2*256
mov dl,1 << %2
jmp drawtileng16x164b16b
.no4bit2
cmp dl,1
jne near .no2bit2
shr ecx,4
add edi,esi
mov [ngptrdat+%2*1024+ebx*4],ecx
mov [ngptrdat2],ecx
mov [ngceax+%2*1024+ebx*4],eax
mov [ngcedi+%2*1024+ebx*4],edi
; eax = pointer to beginning of tile area
mov dword[mode0add],0
ProcessBuildWindow %1
cmp byte[BGMA+ebx],0
jne .nomode02
push ebx
mov ebx,[mode0ads]
mov [mode0add],ebx
pop ebx
.nomode02
mov ecx,ebx
add ecx,%2*256
mov dl,1 << %2
jmp drawtileng16x162b16b
.no2bit2
cmp dl,3
jne near .no8bit
shr ecx,6
add edi,esi
mov [ngptrdat+%2*1024+ebx*4],ecx
mov [ngptrdat2],ecx
mov [ngceax+%2*1024+ebx*4],eax
mov [ngcedi+%2*1024+ebx*4],edi
; eax = pointer to beginning of tile area
ProcessBuildWindow %1
mov ecx,ebx
add ecx,%2*256
mov dl,1 << %2
jmp drawtileng16x168b16b
.no8bit2
pop ebx
ret
%endmacro
%macro drawbgtilengpr116b 2
mov dword[ng16bprval],2000h
mov dword[ng16bbgval],%1
cmp byte[t16x161+ebx+%1*256],1
je near .tiles16x16
push ebx
mov edx,[BGMA+ebx]
mov ecx,[bgtxad+ebx*2+%2*512]
and edx,07h
mov [bgtxadd],cx
mov ecx,[ngptrdat+%2*1024+ebx*4]
mov edx,[colormodedef+edx*4+%1]
mov [ngptrdat2],ecx
mov eax,[ngceax+%2*1024+ebx*4]
mov edi,[ngcedi+%2*1024+ebx*4]
cmp dl,2
jne near .no4bit
; eax = pointer to beginning of tile area
ProcessBuildWindow %1
mov ecx,ebx
add ecx,%2*256
mov dl,1 << %2
jmp drawtileng4b16b
.no4bit
cmp dl,1
jne near .no2bit
; eax = pointer to beginning of tile area
mov dword[mode0add],0
ProcessBuildWindow %1
cmp byte[BGMA+ebx],0
jne .nomode0
push ebx
mov ebx,[mode0ads]
mov [mode0add],ebx
pop ebx
.nomode0
mov ecx,ebx
add ecx,%2*256
mov dl,1 << %2
jmp drawtileng2b16b
.no2bit
cmp dl,3
jne near .no8bit
; eax = pointer to beginning of tile area
ProcessBuildWindow %1
mov ecx,ebx
add ecx,%2*256
mov dl,1 << %2
jmp drawtileng8b16b
.no8bit
pop ebx
ret
.tiles16x16
mov ecx,[BG1SYl+ebx*2+%1*512]
and ecx,0FFFFh
mov dword[taddnfy16x16],0
add ecx,ebx
mov dword[taddfy16x16],16
test ecx,08h
jz .nobottomy
mov dword[taddnfy16x16],16
mov dword[taddfy16x16],-16
.nobottomy
push ebx
mov edx,[BGMA+ebx]
mov ecx,[bgtxad+ebx*2+%2*512]
and edx,07h
mov [bgtxadd],cx
mov ecx,[ngptrdat+%2*1024+ebx*4]
mov edx,[colormodedef+edx*4+%1]
mov [ngptrdat2],ecx
mov eax,[ngceax+%2*1024+ebx*4]
mov edi,[ngcedi+%2*1024+ebx*4]
cmp dl,2
jne near .no4bit2
; eax = pointer to beginning of tile area
ProcessBuildWindow %1
mov ecx,ebx
add ecx,%2*256
mov dl,1 << %2
jmp drawtileng16x164b16b
.no4bit2
cmp dl,1
jne near .no2bit2
; eax = pointer to beginning of tile area
mov dword[mode0add],0
ProcessBuildWindow %1
cmp byte[BGMA+ebx],0
jne .nomode02
push ebx
mov ebx,[mode0ads]
mov [mode0add],ebx
pop ebx
.nomode02
mov ecx,ebx
add ecx,%2*256
mov dl,1 << %2
jmp drawtileng16x162b16b
.no2bit2
cmp dl,3
jne near .no8bit2
; eax = pointer to beginning of tile area
ProcessBuildWindow %1
mov ecx,ebx
add ecx,%2*256
mov dl,1 << %2
jmp drawtileng16x168b16b
.no8bit2
pop ebx
ret
%endmacro
%macro procpixels 3
mov bl,[esi+%2]
mov cl,[esi+%1]
add bl,dl
add cl,dl
mov bx,[eax+ebx*2]
shl ebx,16
mov bx,[eax+ecx*2]
mov [edi+%3],ebx
xor ebx,ebx
%endmacro
%macro procpixelst 3
mov bl,[esi+%1]
add bl,dl
test bl,%3
jz %%nodraw
mov cx,[eax+ebx*2]
mov [edi+%2],cx
%%nodraw
%endmacro
%macro procpixelstr 3
mov bl,[esi+%2]
mov cl,[esi+%1]
add bl,dl
add cl,dl
mov bx,[eax+ebx*2+512]
shl ebx,16
mov bx,[eax+ecx*2+512]
mov [edi+%3],ebx
xor ebx,ebx
%endmacro
%macro procpixelstt 3
mov bl,[esi+%1]
add bl,dl
test bl,%3
jz %%nodraw
mov cx,[eax+ebx*2+512]
mov [edi+%2],cx
%%nodraw
%endmacro
%macro procpixelsnt 3
mov bl,[esi+%2]
mov cl,[esi+%1]
add bl,dl
add cl,dl
mov bx,[eax+ebx*2]
shl ebx,16
mov bx,[eax+ecx*2]
mov [edi+%3],ebx
xor ebx,ebx
%endmacro
%macro procpixelstnt 3
mov bl,[esi+%1]
add bl,dl
test bl,%3
jz %%nodraw
mov cx,[eax+ebx*2]
mov [edi+%2],cx
%%nodraw
%endmacro
%macro procpixelsmst 3
mov bl,[esi+%2]
mov cl,[esi+%1]
add bl,dl
add cl,dl
mov bx,[eax+ebx*2+512]
shl ebx,16
mov bx,[eax+ecx*2+512]
and ebx,[UnusedBitXor]
mov [edi+%3],ebx
mov [edi+%3+75036*2],ebx
xor ebx,ebx
%endmacro
%macro procpixelstmst 3
mov bl,[esi+%1]
add bl,dl
test bl,%3
jz %%nodraw
mov cx,[eax+ebx*2+512]
mov [edi+%2],cx
and cx,[UnusedBitXor]
mov [edi+%2+75036*2],cx
%%nodraw
%endmacro
%macro procpixelsmsnt 3
mov bl,[esi+%2]
mov cl,[esi+%1]
add bl,dl
add cl,dl
mov bx,[eax+ebx*2]
shl ebx,16
mov bx,[eax+ecx*2]
mov [edi+%3],ebx
mov [edi+%3+75036*2],ebx
xor ebx,ebx
%endmacro
%macro procpixelstmsnt 3
mov bl,[esi+%1]
add bl,dl
test bl,%3
jz %%nodraw
mov cx,[eax+ebx*2]
mov [edi+%2],cx
mov [edi+%2+75036*2],cx
%%nodraw
%endmacro
%macro procpixelss 3
mov bl,[esi+%2]
mov cl,[esi+%1]
add bl,dl
add cl,dl
mov bx,[eax+ebx*2]
shl ebx,16
mov bx,[eax+ecx*2]
mov [edi+%3+75036*2],ebx
xor ebx,ebx
%endmacro
%macro procpixelsts 3
mov bl,[esi+%1]
add bl,dl
test bl,%3
jz %%nodraw
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -