Re: A83: moving background


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

Re: A83: moving background




On 16-Jul-98, Chris Hiszpanski wrote:

>Ok, I understand how sprites work, but how can I get a whole screen to move
>and keep going. For example, Penguins and chicken shoot.

>From: Chris
>mecad@scv.net

Spend 5 minutes to think about it yourself, then read the answer below:

---

Just rotate every byte in the graph buffer through carry, like this:

        ld    hl,PLOTSSCREEN
        ld    b,0
loop1:  rr    (hl)
        djnz  loop1
        ld    b,0
loop2:  rr    (hl)
        djnz  loop2
        ld    b,0
loop3:  rr    (hl)
        djnz  loop3
        ret

That's optimized for speed, optimizing for size would use bc to loop through
all of the buffer at once. This will scroll everything to the right one
pixel, leaving the leftmost row trashed.

Linus


Follow-Ups: References: