Re: A89: storing background


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

Re: A89: storing background




>I'm saving my background using 2 buffers; it works fine except it's too
>slow.  Me and a friend of mine were looking into it and decided it was
>because I was writing the whole background into a buffer, then putting the
>sprite on top of it.  So, with b&w graphics, I was writing ~4k to the
screen
>(~8k with grayscale); we determined it was this that caused the slowness.
I
>was wondering if some one could give me a hand with it.  Btw, I got this
>method from Scott Noveck (thanks alot Scott).  If there is a faster/better
>way out there thay you know about, I would appreciate it if you would tell
>me.

There is - background storage, xoring the sprites, or only copying a portion
of the buffers - but they're absurdly complex unless you need one heck of a
lot of speed.  PJ does it just like you did, and I can get it well over 300
frames per second if I want (of course, the screen can only do some 30 FPS
=)

Your problem, I think, is that you need to disable auto-int 1.  If auto-int
1 is on, the calc slows down a LOT when you hold down a key.

Lemme glance over the source:

>go2:
>     move.b #%11111110,($600019) ;first row of keyboard matrix
>     move.b #5,d0   have to wait for this to take affect
> \wait:
>     nop
>     dbra.b d0,\wait
>     move.b ($60001b),d0  ;find this info at http://ti89.acz.org/

You could save yourself 2 bytes or so by taking out the nop in that wait
look and increasing the number in d0 to 7 - should hopefully still wait long
enough while using a moveq instead of move.

>buf1_buf2
>     move.l #buffer1,a0
>     move.l #buffer2,a1
>     move.l #959,d0
>\copy_loop
>     move.l (a0)+,(a1)+
>     dbra.s d0,\copy_loop
>     rts
>buf2_screen
>     move.l #buffer2,a0
>     move.l #LCD_MEM,a1
>     move.l #959,d0
>\screen_loop
>     move.l (a0)+,(a1)+
>     dbra.s d0,\screen_loop
>     rts

You could make these both much faster by "unrolling" the loops a little.
For instance, if you did the move.l TWICE in each loop, you would only have
to go through it 480 times instead on 960.  If you did the move 5 times,
you'd only have to do the loop 192 times - saving massive amounts of time.
Once again, this should still not be a problem since PJ doesn't unroll the
loops at all. . .

Once again, I highly recommend that you disable auto-int 1.  Will solve all
your probliems, I suspect. ..

    -Scott