[A89] one of those 'bugs' that drives you nuts


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

[A89] one of those 'bugs' that drives you nuts




could someone take a look at this before i throw my calc against the wall?
i know the code could use a lot of optimizing but some of it is a result of
the madness brought on by trying to find the bug in the code...

this _should_ draw the sprite in big blocks on the screen, however it only
seems to do the 8th and 4th bit on each line

  lea yoursprite(pc),a0
  move.l #7,d0 ;set up the y loop
loop1:
  clr.l d3
  move.b (a0)+,d3 ;d3 holds the byte of the sprite
  move.l #7,d1 ;set up second loop counter
 loop2:
  move.l d1,d4
  btst.b d4,d3 ;is this pixel off?
  beq pixoff ;jump over the 'pixel' drawing routine

  movem.l d0-d1/a0,-(a7) ;save the registers to the stack
  move.l #7,d4 ;set up d4 to be the y value
  sub.w d0,d4 ;reverse byteorder
  mulu.w #11,d4 ;make space between "pixels"
  move.w d4,d0 ;y value in d0
  move.w #7,d4 ;set up d4 to hold the x value
  sub.w d1,d4 ;reverse the value
  mulu.w #11,d4 ;make space between "pixels"
  move.w d0,d1
  add.w #10,d1
  move.w d4,d0
  add.w #10,d0
  move.w #8,d2
  move.w #8,d3
  move.w #2,d4
  jsr graphlib::fill
  movem.l (a7)+,d0-d1/a0
 pixoff:
  dbra d1,loop2
  dbra d0,loop1
.
.
.
 yoursprite:
 dc.b %11111111
 dc.b %00000000
 dc.b %11111111
 dc.b %00000000
 dc.b %11111111
 dc.b %00000000
 dc.b %11111111
 dc.b %00000000




Follow-Ups: References: