📄 newgfx16.mac
字号:
mov cx,[eax+ebx*2]
mov [edi+%2+75036*2],cx
%%nodraw
%endmacro
%macro drawlineng16b 10
; 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]
mov edx,[%6+edx*4]
%7
jnz near %%docache
%%returnfromcache
cmp byte[%1+ecx],2
je near %5
cmp byte[%1+ecx],0
je near %%parttile
jmp %%parttile
%2
; start drawing from ecx
test dword[vrama+eax],8000h
jz %%notflipyfull
add ecx,[flipyposng]
jmp %%yesflipyfull
%%notflipyfull
add ecx,[yposng]
%%yesflipyfull
test dword[vrama+eax],4000h
jnz near %%flipxfull
push eax
mov esi,ecx
xor ecx,ecx
xor ebx,ebx
mov eax,[CPalPtrng]
%9 0,1,0
%9 2,3,4
%9 4,5,8
%9 6,7,12
pop eax
jmp %5
%%flipxfull
push eax
mov esi,ecx
xor ecx,ecx
xor ebx,ebx
mov eax,[CPalPtrng]
%9 7,6,0
%9 5,4,4
%9 3,2,8
%9 1,0,12
pop eax
jmp %5
%%parttile
%2
; start drawing from ecx to edi
test word[vrama+eax],8000h
jz %%noflipypart
add ecx,[flipyposng]
jmp %%yesflipypart
%%noflipypart
add ecx,[yposng]
%%yesflipypart
test word[vrama+eax],4000h
jnz near %%flipxpart
push eax
mov eax,[CPalPtrng]
mov esi,ecx
xor ebx,ebx
%10 0,0,%8
%10 1,2,%8
%10 2,4,%8
%10 3,6,%8
%10 4,8,%8
%10 5,10,%8
%10 6,12,%8
%10 7,14,%8
pop eax
jmp %5
%%flipxpart
push eax
mov eax,[CPalPtrng]
mov esi,ecx
xor ebx,ebx
%10 7,0,%8
%10 6,2,%8
%10 5,4,%8
%10 4,6,%8
%10 3,8,%8
%10 2,10,%8
%10 1,12,%8
%10 0,14,%8
pop eax
%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
cmp byte[curmosaicsz],1
jne near domosaicng16b
ret
%%docache
call %3
jmp %%returnfromcache
%%tileadd
add ax,[bgtxadd]
jmp %%next
%endmacro
%macro drawlineng16x1616b 10
; 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
%%returnfromcache
cmp byte[%1+ecx],2
je near %%done
cmp byte[%1+ecx],0
je near %%parttile
%2
; start drawing from ecx
test word[vrama+eax],8000h
jz %%noflipyfull
add ecx,[flipyposng]
jmp %%yesflipyfull
%%noflipyfull
add ecx,[yposng]
%%yesflipyfull
test dword[vrama+eax],4000h
jnz near %%flipxfull
push eax
mov esi,ecx
xor ecx,ecx
xor ebx,ebx
mov eax,[CPalPtrng]
%9 0,1,0
%9 2,3,4
%9 4,5,8
%9 6,7,12
pop eax
jmp %%done
%%flipxfull
push eax
mov esi,ecx
xor ecx,ecx
xor ebx,ebx
mov eax,[CPalPtrng]
%9 7,6,0
%9 5,4,4
%9 3,2,8
%9 1,0,12
pop eax
jmp %%done
%%parttile
%2
; start drawing from ecx to edi
test word[vrama+eax],8000h
jz %%noflipypart
add ecx,[flipyposng]
jmp %%yesflipypart
%%noflipypart
add ecx,[yposng]
%%yesflipypart
test word[vrama+eax],4000h
jnz near %%flipxpart
push eax
mov eax,[CPalPtrng]
mov esi,ecx
xor ebx,ebx
%10 0,0,%8
%10 1,2,%8
%10 2,4,%8
%10 3,6,%8
%10 4,8,%8
%10 5,10,%8
%10 6,12,%8
%10 7,14,%8
pop eax
jmp %%done
%%flipxpart
push eax
mov eax,[CPalPtrng]
mov esi,ecx
xor ebx,ebx
%10 7,0,%8
%10 6,2,%8
%10 5,4,%8
%10 4,6,%8
%10 3,8,%8
%10 2,10,%8
%10 1,12,%8
%10 0,14,%8
pop eax
%%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
cmp byte[curmosaicsz],1
jne near domosaicng16b
ret
%5
add edi,32
jmp %%ntile
%%docache
call %3
jmp %%returnfromcache
%%tileadd
add ax,[bgtxadd]
jmp %%next
%endmacro
%macro drawbglineng16b 2
mov dword[ng16bprval],0
mov [pesimpng],esi
mov dword[ng16bbgval],%1
cmp byte[bgmode],5
jb %%nointerl
test byte[intrlng+ebx],01h
jz %%nointerl
add ecx,ebx
add ecx,[cfieldad]
%%nointerl
push ebx
mov byte[curmosaicsz],1
xor eax,eax
test byte[mosenng+ebx],1 << %1
jz %%nomosaic
mov al,[mosszng+ebx]
or al,al
jz %%nomosaic
inc al
mov byte[curmosaicsz],al
mov cl,al
mov al,bl
div cl
mul cl
mov ebx,eax
mov edi,xtravbuf+32
mov ecx,128
mov eax,0FFFFFFFFh
mov esi,xtravbuf+32
rep stosd
or ebx,ebx
jnz %%nozeroline
inc ebx
%%nozeroline
mov ecx,[BG1SYl+ebx*2+%1*512]
and ecx,0FFFFh
add ecx,ebx
jmp %%yesmosaic
%%nomosaic
%%yesmosaic
cmp byte[BGMA+ebx],5
jae near .tiles16x8
cmp byte[osm2dis],1
je .nooffsetm
cmp byte[BGMA+ebx],2
je near .offsetm
cmp byte[t16x161+ebx+%1*256],1
je near .tiles16x16
cmp byte[BGMA+ebx],4
je near .offsetm
.nooffsetm
mov eax,[BGPT1+ebx*2+%1*512]
test ecx,100h
jz .noyinc
add eax,[BGPT1Y+ebx*2+%1*512]
.noyinc
lea ecx,[ecx*8]
mov edx,ecx
and ecx,07C0h ; 1Fh*40h
and edx,38h
add eax,ecx
mov [yposng],edx
xor edx,38h
mov ecx,[BG1SXl+ebx*2+%1*512]
mov [flipyposng],edx
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 drawlineng4b16b
.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
mov ecx,[mode0ads]
mov [mode0add],ecx
.nomode0
mov ecx,ebx
mov dl,1 << %2
add ecx,%2*256
jmp drawlineng2b16b
.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
mov dl,1 << %2
add ecx,%2*256
jmp drawlineng8b16b
.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
mov eax,[BGPT1+ebx*2+%1*512]
test ecx,200h
jz .noyinc2
add eax,[BGPT1Y+ebx*2+%1*512]
.noyinc2
lea edx,[ecx*8]
lea ecx,[ecx*4]
and edx,38h
and ecx,07C0h ; 1Fh*40h
mov [yposng],edx
xor edx,38h
add eax,ecx
mov [flipyposng],edx
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
mov dl,1 << %2
add ecx,%2*256
jmp drawlineng16x164b16b
.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
mov dl,1 << %2
add ecx,%2*256
jmp drawlineng16x162b16b
.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
mov dl,1 << %2
add ecx,%2*256
jmp drawlineng16x168b16b
.no8bit2
pop ebx
ret
.tiles16x8
cmp byte[t16x161+ebx+%1*256],1
je .tiles16x16hr
mov dword[taddnfy16x16],0
mov dword[taddfy16x16],0
mov eax,[BGPT1+ebx*2+%1*512]
test ecx,100h
jz .noyinc2c
add eax,[BGPT1Y+ebx*2+%1*512]
.noyinc2c
lea ecx,[ecx*8]
mov edx,ecx
and ecx,07C0h ; 1Fh*40h
and edx,38h
jmp .tiles16x8hr
.tiles16x16hr
mov dword[taddnfy16x16],0
mov dword[taddfy16x16],16
test ecx,08h
jz .nobottomy2
mov dword[taddnfy16x16],16
mov dword[taddfy16x16],-16
.nobottomy2
mov eax,[BGPT1+ebx*2+%1*512]
test ecx,200h
jz .noyinc2b
add eax,[BGPT1Y+ebx*2+%1*512]
.noyinc2b
lea edx,[ecx*8]
lea ecx,[ecx*4]
and edx,38h
and ecx,07C0h ; 1Fh*40h
.tiles16x8hr
mov [yposng],edx
xor edx,38h
add eax,ecx
mov [flipyposng],edx
mov ecx,[BG1SXl+ebx*2+%1*512]
add ecx,ecx
mov edx,[BGPT1X+ebx*2+%1*512]
test ecx,200h
jz .noxinc2b
add eax,edx
neg dx
.noxinc2b
mov edi,ecx
sub dx,64
and ecx,01F0h
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
shr edi,1
mov edx,[colormodedef+edx*4+%1]
neg edi
add edi,edi
cmp dl,2
jne near .no4bit2b
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
mov dword[cbgval],%1
mov ecx,ebx
mov dl,1 << %2
add ecx,%2*256
jmp drawlineng16x84b16b
.no4bit2b
cmp dl,1
jne near .no2bit2b
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
mov dword[cbgval],%1
mov ecx,ebx
mov dl,1 << %2
add ecx,%2*256
jmp drawlineng16x82b16b
.no2bit2b
pop ebx
ret
.offsetm16x16
pushad
xor edx,edx
mov dx,[BG3SYl+ebx*2]
; and dx,0F8h
shr edx,3
shl edx,6
xor eax,eax
mov ax,[BGPT3+ebx*2]
add ax,dx
xor edx,edx
mov dx,[BG3SXl+ebx*2]
and dx,0F8h
mov [ofsmcyps],ebx
shr edx,3
shl edx,1
add ax,dx
mov dx,[bg3scrolx]
test dx,8000h
jz .nooma16x16
and dx,0F000h
shr dx,5
add ax,dx
.nooma16x16
cmp byte[BGMA+ebx],4
je .offsetm416x16
add eax,40h
.offsetm416x16
mov edx,eax
and edx,0FFFFFFC0h
add edx,[vram]
mov [ofsmcptr],edx
and eax,3Fh
mov [ofsmcptr2],eax
m
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -