📄 newgfxb.mac
字号:
; eax = pointer to beginning of tile area
jmp drawlineng4b
.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
cmp byte[BGMA+ebx],0
jne .nomode0
mov ebx,[mode0ads]
mov [mode0add],ebx
.nomode0
jmp drawlineng2b
.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
jmp drawlineng8b
.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
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
jmp drawlineng16x164b
.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
cmp byte[BGMA+ebx],0
jne .nomode02
mov ebx,[mode0ads]
mov [mode0add],ebx
.nomode02
jmp drawlineng16x162b
.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
jmp drawlineng16x168b
.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
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 byte[tleftn],33
.loop2b
mov cx,[vrama+eax]
test ecx,2000h
jnz near .fintile2b
drawlineng16x8 tltype4b, preparet4ba, cachesingle4bng,.loop2b,.fintile2b,ngpalcon4b,test4ba,0Fh,%1
.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 byte[tleftn],33
.loopb2b
mov cx,[vrama+eax]
test ecx,2000h
jnz near .fintileb2b
drawlineng16x8 tltype2b, preparet2ba, cachesingle2bng,.loopb2b,.fintileb2b,ngpalcon2b,test2ba,03h,%1
.no2bit2b
pop ebx
ret
; Offsetmode calculation : <b2-7,2109>*1024+<b3-7,2112>*32+<b3-7,2111>
.offsetm
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
add eax,40h
mov edx,eax
and edx,0FFFFFFC0h
add edx,[vram]
mov [ofsmcptr],edx
and eax,3Fh
mov [ofsmcptr2],eax
mov eax,[BGPT1Y+ebx*2+%1*512]
mov [ofsmady],eax
mov eax,[BGPT1X+ebx*2+%1*512]
mov [ofsmadx],eax
mov eax,[BGPT1+ebx*2+%1*512]
mov [ofsmtptr],eax
mov [ofsmtptrs],eax
test ecx,100h
jz .noyincd
add eax,[BGPT1Y+ebx*2+%1*512]
.noyincd
lea ecx,[ecx*8]
mov edx,ecx
and ecx,07C0h ; 1Fh*40h
and edx,38h
add eax,ecx
mov [yposng],edx
mov [yposngom],edx
xor edx,38h
mov ecx,[BG1SXl+ebx*2+%1*512]
mov [flipyposng],edx
mov [flipyposngom],edx
mov edx,[BGPT1X+ebx*2+%1*512]
test ecx,100h
jz .noxincd
add eax,edx
add [ofsmtptr],edx
neg dx
.noxincd
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
add [ofsmtptr],ecx
mov [ofsmmptr],eax
mov dword[ofshvaladd],0
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
cmp dl,2
jne near .no4bitd
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 byte[tleftn],33
.loopd
mov cx,[vrama+eax]
test ecx,2000h
jnz near .fintiled
drawlinengom tltype4b, preparet4ba, cachesingle4bng,.loopd,.fintiled,ngpalcon4b,test4ba,0Fh,%1
.no4bitd
pop ebx
ret
.offsetm2
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
add eax,40h
mov edx,eax
and edx,0FFFFFFC0h
add edx,[vram]
mov [ofsmcptr],edx
and eax,3Fh
mov [ofsmcptr2],eax
mov eax,[BGPT1Y+ebx*2+%1*512]
mov [ofsmady],eax
mov eax,[BGPT1X+ebx*2+%1*512]
mov [ofsmadx],eax
mov eax,[BGPT1+ebx*2+%1*512]
mov [ofsmtptr],eax
mov [ofsmtptrs],eax
test ecx,100h
jz .noyincdn
add eax,[BGPT1Y+ebx*2+%1*512]
.noyincdn
lea ecx,[ecx*8]
mov edx,ecx
and ecx,07C0h ; 1Fh*40h
and edx,38h
add eax,ecx
mov [yposng],edx
mov [yposngom],edx
xor edx,38h
mov ecx,[BG1SXl+ebx*2+%1*512]
mov [flipyposng],edx
mov [flipyposngom],edx
mov edx,[BGPT1X+ebx*2+%1*512]
test ecx,100h
jz .noxincdn
add eax,edx
add [ofsmtptr],edx
neg dx
.noxincdn
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
add [ofsmtptr],ecx
mov [ofsmmptr],eax
mov dword[ofshvaladd],0
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
cmp dl,1
jne near .no2bitdn
; eax = pointer to beginning of tile area
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 byte[tleftn],33
.loopdn
mov cx,[vrama+eax]
test cx,2000h
jnz near .fintiledn
drawlinengom2 tltype2b, preparet2ba, cachesingle2bng,.loopdn,.fintiledn,ngpalcon2b,test2ba,03h,%1
.no2bitdn
cmp dl,3
jne near .no8bitdn
; eax = pointer to beginning of tile area
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
mov byte[tleftn],33
.loopdn2
mov cx,[vrama+eax]
test cx,2000h
jnz near .fintiledn2
drawlinengom2 tltype8b, preparet8ba, cachesingle8bng,.loopdn2,.fintiledn2,ngpalcon8b,test8ba,0FFh,%1
.no8bitdn
pop ebx
ret
%endmacro
%macro mosender 1
.nodraw
add edi,%1
add esi,%1
dec ecx
jnz .next
pop esi
mov dword[ignor512],0
ret
%endmacro
%macro drawbglinengpr1 2
mov dword[ng16bprval],2000h
mov dword[ng16bbgval],%1
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 [pesimpng],esi
mov edi,xtravbuf+16
mov ecx,64
xor eax,eax
mov esi,xtravbuf+16
rep stosd
or ebx,ebx
jnz %%nomosaic
inc ebx
jmp %%yesmosaic
%%nomosaic
cmp byte[BGMA+ebx],5
jae near .tiles16x8
%%yesmosaic
cmp byte[t16x161+ebx+%1*256],1
je near .tiles16x16
cmp byte[BGMA+ebx],2
je near .offsetm
; cmp byte[BGMA+ebx],4
; je near .offsetm2
mov eax,[BG1SYl+ebx*2+%1*512]
and eax,0FFFFh
add eax,ebx
lea eax,[eax*8]
and eax,38h
mov [yposng],eax
xor eax,38h
mov [flipyposng],eax
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
jmp drawlineng4b
.no4bit
cmp dl,1
jne near .no2bit
; eax = pointer to beginning of tile area
mov dword[mode0add],0
cmp byte[BGMA+ebx],0
jne .nomode0
mov ebx,[mode0ads]
mov [mode0add],ebx
.nomode0
jmp drawlineng2b
.no2bit
cmp dl,3
jne near .no8bit
; eax = pointer to beginning of tile area
jmp drawlineng8b
.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
lea eax,[ecx*8]
and eax,38h
mov [yposng],eax
xor eax,38h
mov [flipyposng],eax
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
jmp drawlineng16x164b
.no4bit2
cmp dl,1
jne near .no2bit2
; eax = pointer to beginning of tile area
mov dword[mode0add],0
cmp byte[BGMA+ebx],0
jne .nomode02
mov ebx,[mode0ads]
mov [mode0add],ebx
.nomode02
jmp drawlineng16x162b
.no2bit2
cmp dl,3
jne near .no8bit2
; eax = pointer to beginning of tile area
jmp drawlineng16x168b
.no8bit2
pop ebx
ret
.tiles16x8
mov ecx,[BG1SYl+ebx*2+%1*512]
and ecx,0FFFFh
add ecx,ebx
mov dword[taddnfy16x16],0
mov dword[taddfy16x16],16
test ecx,08h
jz .nobottomyb
mov dword[taddnfy16x16],16
mov dword[taddfy16x16],-16
.nobottomyb
cmp byte[t16x161+ebx+%1*256],1
je near .tiles16x16hr
mov dword[taddnfy16x16],0
mov dword[taddfy16x16],0
.tiles16x16hr
lea eax,[ecx*8]
and eax,38h
mov [yposng],eax
xor eax,38h
mov [flipyposng],eax
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 .no4bit2b
; eax = pointer to beginning of tile area
mov byte[tleftn],33
.loop2b
mov cx,[vrama+eax]
test cx,2000h
jz near .fintile2b
drawlineng16x8 tltype4b, preparet4ba, cachesingle4bng,.loop2b,.fintile2b,ngpalcon4b,test4ba,0Fh,%1
pop ebx
ret
.no4bit2b
cmp dl,1
jne near .no2bit2b
; eax = pointer to beginning of tile area
mov dword[mode0add],0
mov byte[tleftn],33
.loopb2b
mov cx,[vrama+eax]
test ecx,2000h
jz near .fintileb2b
drawlineng16x8 tltype2b, preparet2ba, cachesingle2bng,.loopb2b,.fintileb2b,ngpalcon2b,test2ba,03h,%1
pop ebx
ret
.no2bit2b
pop ebx
ret
.offsetm
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
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -