A89: storing background


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

A89: storing background




I have a question, it's probably an easy one too. :)

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.

Here's the source:

 include "doorsos.h"
 include "graphlib.h"
 xdef _ti89
 xdef _ti92plus
 xdef _main
 xdef _comment
_main
     move.w #1,graphlib::choosescreen
begin
;first buffer
     move.l #buffer1,a0
     move.w #959,d0
\clra
     clr.l (a0)+
     dbra.s d0,\clra
;second buffer
     move.l #buffer2,a0
     move.w #959,d0
\clrb
     clr.l (a0)+
     dbra.s d0,\clrb
put_pic
     move.w #0,d0
     move.w #0,d1
     move.l #buffer1,a1
     lea pic(PC),a0
     jsr graphlib::put_sprite
     bsr buf1_buf2
put_sprite
     move.w x,d0
     move.w y,d1
     lea mask(PC),a2
     move.l #buffer2,a1
     lea sprite(PC),a0
     jsr graphlib::put_sprite
     bsr buf2_screen

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/
     btst.b #3,d0
     beq move
     bra go2
move
     add.w #3,x
     bra begin
exit
     clr.w graphlib::choosescreen
     rts
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
sprite
 dc.w 8
 dc.w 1
 dc.b %11111111
 dc.b %10000001
 dc.b %10000001
 dc.b %10000001
 dc.b %10000001
 dc.b %10000001
 dc.b %10000001
 dc.b %11111111
mask
 dc.b %11111111
 dc.b %11111111
 dc.b %11111111
 dc.b %11111111
 dc.b %11111111
 dc.b %11111111
 dc.b %11111111
 dc.b %11111111
pic:
    This is just a picture the size of the screen.  I left it out to keep
the e-mail a little
    shorter.
_comment
 dc.b "move sprite w/o updating screen"
x dc.w 5
y dc.w 5
 BSS
buffer1 ds.b 3840
buffer2 ds.b 3840
 end

I appreciate any help I can get with this.

Eric Greening