A86: Messed Loop
[Prev][Next][Index][Thread]
A86: Messed Loop
I'm using a Findpixel by CLEM to try to do some parabolic motion, but I
can't even get it to draw a line (diagonal Top_Left -> Bottom_Right). Why
doesn't this draw a line like that? (It draw's 2 pixels, one at 0,0 and one
around 64,32)
Vy = $8000
Vx = $8001
x_pos = $8002
y_pos = $8003
.org _asm_exec_ram
call _clrLCD
ld a,0
ld (y_pos),a
ld (x_pos),a
ld a,1
ld (Vy),a
ld (Vx),a
loop:
ld a,(y_pos) ;load x,y of pixel
ld c,a
ld a,(x_pos)
ld b,a
call FindPixel ;get video memory offset w/ bitmask
or (hl) ;OR bitmask with (HL)
ld (hl),a ;put result to video memory
ld a,(Vy) ;change x,y using Vx,Vy (velocity)
add a,c
ld (y_pos),a
ld a,(Vx)
add a,b
ld (x_pos),a
jr loop
(Findpixel header:)
;Input: b,c = x,y coordinates; 0-127,0-63; 0,0 = top left
;Output: (HL) = byte in video memory, A = bitmask (ie, the precise bit in
(HL))