A86: Re: Messed Loop


[Prev][Next][Index][Thread]

A86: Re: Messed Loop




Are you sure that FindPixel is saving your registers?  If BC is trashed,
then your coords will be messed up.  Also, I know the header says B,C for
x,y, but most FindPixel functions or sprite routines reverse them because it
just makes more sense when it comes to shifting to get the actual address of
the pixel.

-----Original Message-----
From: Dave VanEe <dvanee@dowco.com>
To: assembly-86@lists.ticalc.org <assembly-86@lists.ticalc.org>
Date: Thursday, October 22, 1998 11:00 PM
Subject: 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))
>
>