makev16t.asm
来自「十七种模拟器源代码 非常有用的作课程设计不可缺少的」· 汇编 代码 · 共 3,137 行 · 第 1/5 页
ASM
3,137 行
mov ecx,[bg1yaddval+ebp*4]
call draw16x1616b
cmp byte[drawn],33
jne .notalldrawnb
mov al,[curbgnum]
or [alreadydrawn],al
.notalldrawnb
ret
NEWSYM drawbackgrndmain16t
cmp byte[bgfixer],1
je near drawbackgrndmain16tfix
cmp byte[bgfixer2],1
je near drawbackgrndmain16tfix
mov esi,[colormodeofs]
mov bl,[esi+ebp]
cmp bl,0
je near .noback
mov al,[curbgnum]
test byte[scrnon],al
jz near .noback
test byte[alreadydrawn],al
jnz near .noback
test byte[scrndis],al
jnz near .noback
mov byte[winon],0
test byte[winenabm],al
jz near .nobackwin
; procwindow [winbg1en+ebp]
mov al,[winbg1en+ebp]
call makewindow
cmp byte[winon],0FFh
je near .noback
.nobackwin
mov bl,[curbgnum]
mov byte[curmosaicsz],1
test byte[mosaicon],bl
jz .nomos
mov bl,[mosaicsz]
cmp bl,0
je .nomos
inc bl
mov [curmosaicsz],bl
.nomos
mov byte[bgcoloradder],0
cmp byte[bgmode],0
jne .nomode0
mov eax,ebp
shl eax,5
mov byte[bgcoloradder],al
.nomode0
mov esi,[bg1vbufloc+ebp*4]
mov edi,[bg1tdatloc+ebp*4]
mov edx,[bg1tdabloc+ebp*4]
mov ebx,[bg1cachloc+ebp*4]
mov eax,[bg1xposloc+ebp*4]
mov cl,[curbgnum]
cmp byte[curbgpr],0h
jne .test2
; test byte[scaddtype],cl
; jnz .transp
.test2
test byte[scaddset],02h
jz .noscrnadd
test byte[scrnon+1],cl
jnz near .mainandsub
.noscrnadd
test byte[scaddtype],cl
jnz .transp
test byte[bgtilesz],cl
jnz .16x16
mov ecx,[bg1yaddval+ebp*4]
call draw8x816b
cmp byte[drawn],33
jne .notalldrawn
mov al,[curbgnum]
or [alreadydrawn],al
.notalldrawn
.noback
ret
.16x16
mov ecx,[bg1yaddval+ebp*4]
call draw16x1616b
cmp byte[drawn],33
jne .notalldrawnb
mov al,[curbgnum]
or [alreadydrawn],al
.notalldrawnb
ret
.transp
test byte[bgtilesz],cl
jnz .16x16b
mov ecx,[bg1yaddval+ebp*4]
call draw8x816t
cmp byte[drawn],33
jne .notalldrawnc
mov al,[curbgnum]
or [alreadydrawn],al
.notalldrawnc
ret
.16x16b
mov ecx,[bg1yaddval+ebp*4]
call draw16x1616t
cmp byte[drawn],33
jne .notalldrawnd
mov al,[curbgnum]
or [alreadydrawn],al
.notalldrawnd
ret
.mainandsub
test byte[curbgpr],20h
jnz .firstpr
test byte[scaddtype],cl
jnz .transpb
.firstpr
test byte[bgtilesz],cl
jnz .16x16c
mov ecx,[bg1yaddval+ebp*4]
call draw8x816bt
cmp byte[drawn],33
jne .notalldrawne
mov al,[curbgnum]
or [alreadydrawn],al
.notalldrawne
ret
.16x16c
mov ecx,[bg1yaddval+ebp*4]
call draw16x1616bt
cmp byte[drawn],33
jne .notalldrawnf
mov al,[curbgnum]
or [alreadydrawn],al
.notalldrawnf
ret
.transpb
test byte[bgtilesz],cl
jnz .16x16d
mov ecx,[bg1yaddval+ebp*4]
call draw8x816tms
cmp byte[drawn],33
jne .notalldrawng
mov al,[curbgnum]
or [alreadydrawn],al
.notalldrawng
ret
.16x16d
mov ecx,[bg1yaddval+ebp*4]
call draw16x1616tms
cmp byte[drawn],33
jne .notalldrawnh
mov al,[curbgnum]
or [alreadydrawn],al
.notalldrawnh
ret
NEWSYM procspritessub16tfix
test byte[scrndis],10h
jnz .nosprites
test byte[scrnon+1],10h
jz .nosprites
cmp byte[winonsp],0FFh
je .nosprites
xor ebx,ebx
mov bl,[curypos]
add ebx,[cursprloc]
mov cl,[ebx]
cmp byte[sprprifix],0
jne .sprprio
add dword[cursprloc],256
.sprprio
cmp cl,0
je .nosprites
call drawsprites16b
.nosprites
ret
NEWSYM procspritesmain16tfix
test byte[scrndis],10h
jnz .nosprites
test byte[scrnon],10h
jz .nosprites
cmp byte[winonsp],0FFh
je .nosprites
xor ebx,ebx
mov bl,[curypos]
add ebx,[cursprloc]
mov cl,[ebx]
cmp byte[sprprifix],0
jne .sprprio
add dword[cursprloc],256
.sprprio
cmp cl,0
je .nosprites
test byte[scaddtype],10h
jz .nospriteadd
call drawsprites16t
.nosprites
ret
.nospriteadd
call drawsprites16b
xor eax,eax
ret
NEWSYM drawbackgrndsub16tfix
mov esi,[colormodeofs]
mov bl,[esi+ebp]
cmp bl,0
je near .noback
mov al,[curbgnum]
test byte[scrnon+1],al
jz near .noback
test byte[alreadydrawn],al
jnz near .noback
test byte[scrndis],al
jnz near .noback
mov byte[winon],0
test byte[winenabs],al
jz near .nobackwin
; procwindow [winbg1en+ebp]
mov al,[winbg1en+ebp]
call makewindow
cmp byte[winon],0FFh
je near .noback
.nobackwin
mov bl,[curbgnum]
mov byte[curmosaicsz],1
test byte[mosaicon],bl
jz .nomos
mov bl,[mosaicsz]
cmp bl,0
je .nomos
inc bl
mov [curmosaicsz],bl
.nomos
mov byte[bgcoloradder],0
cmp byte[bgmode],0
jne .nomode0
mov eax,ebp
mov bl,20h
mul bl
mov byte[bgcoloradder],al
.nomode0
mov esi,[bg1vbufloc+ebp*4]
mov edi,[bg1tdatloc+ebp*4]
mov edx,[bg1tdabloc+ebp*4]
mov ebx,[bg1cachloc+ebp*4]
mov eax,[bg1xposloc+ebp*4]
mov cl,[curbgnum]
test byte[bgtilesz],cl
jnz .16x16
mov ecx,[bg1yaddval+ebp*4]
call draw8x816b
cmp byte[drawn],33
jne .notalldrawn
mov al,[curbgnum]
or [alreadydrawn],al
.notalldrawn
.noback
ret
.16x16
mov ecx,[bg1yaddval+ebp*4]
call draw16x1616b
cmp byte[drawn],33
jne .notalldrawnb
mov al,[curbgnum]
or [alreadydrawn],al
.notalldrawnb
ret
NEWSYM drawbackgrndmain16tfix
mov esi,[colormodeofs]
mov bl,[esi+ebp]
cmp bl,0
je near .noback
mov al,[curbgnum]
test byte[scrnon],al
jz near .noback
test byte[alreadydrawn],al
; jnz near .noback
test byte[scrndis],al
jnz near .noback
mov byte[winon],0
test byte[winenabm],al
jz near .nobackwin
; procwindow [winbg1en+ebp]
mov al,[winbg1en+ebp]
call makewindow
cmp byte[winon],0FFh
je near .noback
.nobackwin
mov bl,[curbgnum]
mov byte[curmosaicsz],1
test byte[mosaicon],bl
jz .nomos
mov bl,[mosaicsz]
cmp bl,0
je .nomos
inc bl
mov [curmosaicsz],bl
.nomos
mov byte[bgcoloradder],0
cmp byte[bgmode],0
jne .nomode0
mov eax,ebp
shl eax,5
mov byte[bgcoloradder],al
.nomode0
mov esi,[bg1vbufloc+ebp*4]
mov edi,[bg1tdatloc+ebp*4]
mov edx,[bg1tdabloc+ebp*4]
mov ebx,[bg1cachloc+ebp*4]
mov eax,[bg1xposloc+ebp*4]
mov cl,[curbgnum]
cmp byte[curbgpr],0h
jne .test2
; test byte[scaddtype],cl
; jnz .transp
.test2
test byte[scaddtype],cl
jnz .transp
test byte[bgtilesz],cl
jnz .16x16
mov ecx,[bg1yaddval+ebp*4]
call draw8x816b
cmp byte[drawn],33
jne .notalldrawn
mov al,[curbgnum]
or [alreadydrawn],al
.notalldrawn
.noback
ret
.16x16
mov ecx,[bg1yaddval+ebp*4]
call draw16x1616b
cmp byte[drawn],33
jne .notalldrawnb
mov al,[curbgnum]
or [alreadydrawn],al
.notalldrawnb
ret
.transp
test byte[bgtilesz],cl
jnz .16x16b
mov ecx,[bg1yaddval+ebp*4]
call draw8x816t
cmp byte[drawn],33
jne .notalldrawnc
mov al,[curbgnum]
or [alreadydrawn],al
.notalldrawnc
ret
.16x16b
mov ecx,[bg1yaddval+ebp*4]
call draw16x1616t
cmp byte[drawn],33
jne .notalldrawnd
mov al,[curbgnum]
or [alreadydrawn],al
.notalldrawnd
ret
ALIGN32
NEWSYM transpbuf, times 576+16+288*2 db 0 ; Transparent buffer
NEWSYM drawline16t
cmp byte[bgmode],7
je near processmode716t
mov al,[scrnon]
test [scrnon+1],al
jz .nomainsub
test byte[scrnon],10h
jnz .nomainsub
test byte[scrnon+1],10h
jz .nomainsub
mov al,[scrnon+1]
xor al,0FFh
and [scrnon],al
.nomainsub
push esi
push edi
push ebx
push edx
push ebp
; current video offset
mov dword[curvidoffset],transpbuf+32
; set palette
call setpalette16b
; clear back area w/ back color
procwindowback
call clearback16bts
; do sprite windowing
call makewindowsp
; clear registers
xor eax,eax
xor ecx,ecx
; get current sprite table
xor ebx,ebx
mov bl,[curypos]
shl ebx,9
add ebx,[spritetablea]
mov [currentobjptr],ebx
mov dword[cursprloc],sprleftpr
; setup priorities
cmp byte[sprprifix],0
je .nosprprio
mov dword[cursprloc],sprlefttot
call preparesprpr
.nosprprio
; process backgrounds
; do background 2
mov byte[curbgnum],02h
mov ebp,01h
call procbackgrnd
; do background 1
mov byte[curbgnum],01h
mov ebp,00h
call procbackgrnd
; do background 4
mov byte[curbgnum],08h
mov ebp,03h
call procbackgrnd
; do background 3
mov byte[curbgnum],04h
mov ebp,02h
call procbackgrnd
cmp byte[bgmode],1
ja near priority216t
test byte[scaddset],02h
jz near .noscrnadd
; draw backgrounds
mov byte[curbgpr],0h
; do background 4
mov byte[curbgnum],08h
mov ebp,03h
call drawbackgrndsub16t
; do background 3
mov byte[curbgnum],04h
mov ebp,02h
call drawbackgrndsub16t
mov ebp,0
call procspritessub16t
; do background 4
mov byte[curbgnum],08h
mov ebp,03h
call drawbackgrndsub16t
; do background 3
mov byte[curbgpr],20h
cmp byte[bg3high2],1
je .bg3nothigh
mov byte[curbgnum],04h
mov ebp,02h
call drawbackgrndsub16t
.bg3nothigh
mov ebp,1
call procspritessub16t
; do background 2
mov byte[curbgpr],0h
mov byte[curbgnum],02h
mov ebp,01h
call drawbackgrndsub16t
; do background 1
mov byte[curbgnum],01h
mov ebp,00h
call drawbackgrndsub16t
mov ebp,2
call procspritessub16t
; do background 2
mov byte[curbgpr],20h
mov byte[curbgnum],02h
mov ebp,01h
call drawbackgrndsub16t
; do background 1
mov byte[curbgnum],01h
mov ebp,00h
call drawbackgrndsub16t
mov ebp,3
call procspritessub16t
; do background 3
cmp byte[bg3high2],1
jne .bg3high
mov byte[curbgnum],04h
mov ebp,02h
call drawbackgrndsub16t
.bg3high
.noscrnadd
mov al,[winenabm]
mov [cwinenabm],al
NEWSYM NextDrawLine16bt
; calculate current video offset
xor ebx,ebx
mov bx,[curypos]
mov esi,ebx
shl esi,9
shl ebx,6
add esi,ebx
add esi,32
add esi,[vidbuffer]
mov [curvidoffset],esi
; clear back area w/ back color
call clearback16t
mov byte[curbgpr],0h
; do background 4
mov byte[curbgnum],08h
mov ebp,03h
call drawbackgrndmain16t
; do background 3
mov byte[curbgnum],04h
mov ebp,02h
call drawbackgrndmain16t
mov ebp,0
call procspritesmain16t
; do background 4
mov byte[curbgnum],08h
mov ebp,03h
call drawbackgrndmain16t
; do background 3
mov byte[curbgpr],20h
cmp byte[bg3high2],1
je .bg3nothighb
mov byte[curbgnum],04h
mov ebp,02h
call drawbackgrndmain16t
.bg3nothighb
mov ebp,1
call procspritesmain16t
; do background 2
mov byte[curbgpr],0h
mov byte[curbgnum],02h
mov ebp,01h
call drawbackgrndmain16t
; do background 1
mov byte[curbgnum],01h
mov ebp,00h
call drawbackgrndmain16t
mov ebp,2
call procspritesmain16t
; do background 2
mov byte[curbgpr],20h
mov byte[curbgnum],02h
mov ebp,01h
call drawbackgrndmain16t
; do background 1
mov byte[curbgnum],01h
mov ebp,00h
call drawbackgrndmain16t
mov ebp,3
call procspritesmain16t
cmp byte[bg3high2],1
jne .bg3highb
; do background 3
mov byte[curbgpr],20h
mov byte[curbgnum],04h
mov ebp,02h
call drawbackgrndmain16t
.bg3highb
pop ebp
pop edx
pop ebx
pop edi
pop esi
xor eax,eax
xor ecx,ecx
ret
NEWSYM priority216t
test byte[scaddset],02h
jz near .noscrnadd
; do background 2
mov byte[curbgpr],0h
mov byte[curbgnum],02h
mov ebp,01h
call drawbackgrndsub16t
mov ebp,0
call procspritessub16t
; do background 1
mov byte[curbgnum],01h
mov ebp,00h
call drawbackgrndsub16t
mov ebp,1
call procspritessub16t
; do background 2
mov byte[curbgpr],20h
mov byte[curbgnum],02h
mov ebp,01h
call drawbackgrndsub16t
mov ebp,2
call procspritessub16t
; do background 1
mov byte[curbgnum],01h
mov ebp,00h
call drawbackgrndsub16t
mov ebp,3
call procspritessub16t
.noscrnadd
mov al,[winenabm]
mov [cwinenabm],al
NEWSYM Priority2NextDrawLine16bt
; calculate current video offset
xor ebx,ebx
mov bx,[curypos]
mov esi,ebx
shl esi,9
shl ebx,6
add esi,ebx
add esi,32
add esi,[vidbuffer]
mov [curvidoffset],esi
; clear back area w/ back color
call clearback16t
; do background 2
mov byte[curbgpr],0h
mov byte[curbgnum],02h
mov ebp,01h
call drawbackgrndmain16t
mov ebp,0
call procspritesmain16t
; do background 1
mov byte[curbgnum],01h
mov ebp,00h
call drawbackgrndmain16t
mov ebp,1
call procspritesmain16t
; do background 2
mov byte[curbgpr],20h
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?