Re: A89: Simple Grid-based Putsprite Routine


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

Re: A89: Simple Grid-based Putsprite Routine




Hi,


>  include "tios.h"
>  include "util.h"
>  xdef _main
>  xdef _comment
>  xdef _ti89
> 
> _main:
>  jsr util::zap_screen
>  move.l #Sprite1,a0
>  move.l #0,d0         ;set the sprite to display in grid area 0,0
>  move.l #0,d1         ;(top-left area of screen)
>  bsr _putsprite
>  jsr util::idle_loop
>  rts
> 
> _putsprite:

Change LCD_MEM to #LCD_MEM

>  move.l LCD_MEM,a1      <-----------

>  add.l d0,a1           ;add the grid column to LCD_MEM

Next,
Change mulu.l to mulu
(The .l should not be used here)

...
> This means that if both of those registers were 1, the sprite's upper-left
> corner would at the 9th pixel down and the 9th pixel across. 
...
If that's really what you want, change #60 to #240 (30*8=240)

>  mulu.l #60,d1         <-----------

>  add.l d1,a1           ;add bytes to a1
>  move.b (a0),(a1)      ;These 8 lines cause the problems. I believe
>  move.b 1(a0),30(a1)   ;that this is because it's doing stuff with
>  move.b 2(a0),60(a1)   ;odd addresses... how would I fix that?
>  move.b 3(a0),90(a1)
>  move.b 4(a0),120(a1)
>  move.b 5(a0),150(a1)
>  move.b 6(a0),180(a1)
>  move.b 7(a0),210(a1)
>  rts
> 
> _comment: dc.b "Mogsoft PutSprite Experiment",0
> Sprite1:          ;if you can't see the sprite, it's a happyface. :)
>  dc.b %00111100
>  dc.b %01000010
>  dc.b %10100101
>  dc.b %10000001
>  dc.b %10100101
>  dc.b %10011001
>  dc.b %01000010
>  dc.b %00111100
> 
>  END

Then it will work fine :)

-Don
-- 
 Don Barnes
   EMAIL: don.barnes@wmich.edu
      IM: DonRBarnes
     WEB: mf.calc.org


References: