Files
vt1200/bad-apple/player/fill.asm
T

62 lines
1.4 KiB
NASM

; fill.asm -- one FILL L rectangle into the 1280x1024, 256-byte-stride VRAM.
;
; The C wrapper publishes:
; fill_daddr linear bit address of the top-left pixel
; fill_dydx (rows << 16) | columns, in screen pixels
; fill_color 0x0000 = black, 0xFFFF = white
;
; FILL L destroys DADDR and DYDX, so the wrapper reloads them every call.
; PSIZE, PMASK and CONTROL are programmed once by _fill_init_.
.ref _fill_daddr
.ref _fill_dydx
.ref _fill_color
.text
.globl _fill_run_
_fill_run_:
setf 32, 0, 1
move b2, -*sp, 1
move b3, -*sp, 1
move b7, -*sp, 1
move b9, -*sp, 1
move @_fill_daddr, b2, 1
movi 800h, b3 ; 2048 bits = 256-byte row pitch
move @_fill_dydx, b7, 1
move @_fill_color, b9, 1
; PSIZE is cheap to re-assert; if the resident OS left it at 2 bpp,
; FILL would write twice as many pixels as asked for.
movi 1, a1
move a1, @0C0000150h, 0
fill l
move *sp+, b9, 1
move *sp+, b7, 1
move *sp+, b3, 1
move *sp+, b2, 1
rets
.globl _vid_dint_
_vid_dint_:
dint
rets
.globl _fill_init_
_fill_init_:
setf 32, 0, 1
movi 1, a1
move a1, @0C0000150h, 0 ; PSIZE = 1
clr a1
move a1, @0C0000160h, 0 ; PMASK = 0
move a1, @0C0000170h, 0 ; upper half, forward compatibility
move @0C00000B0h, a1, 0 ; CONTROL
andi 0801Fh, a1 ; keep CD and RM/RR, raster op 0
move a1, @0C00000B0h, 0
move @0C00000B0h, a1, 0 ; read back: I/O writes are pipelined
rets
.end