70 lines
920 B
NASM
70 lines
920 B
NASM
VMEM equ 0xA000
|
|
|
|
; di = y*32+x
|
|
; ax = width
|
|
; bl = height
|
|
; bh = color
|
|
|
|
; ax/bl = 0 is undefined behavior. Don't do it.
|
|
; (To be clear, in the current implementation it just halts)
|
|
|
|
_gfx_rect0:
|
|
pusha
|
|
|
|
push VMEM
|
|
pop es
|
|
|
|
mov dl, 0 ; row counter
|
|
|
|
.row:
|
|
add dl, 1
|
|
|
|
mov cx, 0 ; col counter
|
|
|
|
.col:
|
|
add cx, 1
|
|
|
|
mov [es:di], bh
|
|
add di, 1
|
|
|
|
cmp cx, ax
|
|
jnz .col
|
|
|
|
sub di, ax ; di - width + 320. == x=x1; y++
|
|
add di, 320
|
|
|
|
cmp dl, bl
|
|
jnz .row
|
|
|
|
popa
|
|
ret
|
|
|
|
|
|
; cx = x
|
|
; al = y
|
|
; dx = width
|
|
; bl = height
|
|
; bh = color
|
|
gfx_rect:
|
|
pusha
|
|
|
|
; Set di to y*320+x
|
|
push bx
|
|
push dx ; Don't forget, mul clobbers dx!
|
|
|
|
mov ah, 0
|
|
mov bx, 320
|
|
mul bx
|
|
add ax, cx
|
|
mov di, ax
|
|
|
|
pop dx
|
|
pop bx
|
|
|
|
; AX CLOBBERED
|
|
mov ax, dx
|
|
|
|
call _gfx_rect0
|
|
|
|
popa
|
|
ret |