[A86] Re: What's wrong w/ This?2


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

[A86] Re: What's wrong w/ This?2




This should work a little better than what you were origionally working with. 
 That findpixel routine ends up giving you the byte of the address in hl and 
the offset in e.  When you are drawing a sprite aligned on a byte as this one 
is, you can ignore the offset.  The address in hl takes care of both the x 
and the y location on the screen.  Remember, the location you give to 
FindPixel is NOT the same as the on-screen address.  FindPixel turns an 
x-value  of 16 into a two-byte difference in the actual address.  Another 
thing is that you CAN load a number directly into a register other than A.  
You can do "ld e,16" or whatever.

Marc McG

ps_normal:
  ld    hl,offsets
  ld    a,b
  and   $07
  add   a,l
  ld    l,a
  adc   a,h
  sub   l
  ld    h,a
  ld    e,(hl)
  ld    hl,_rld
  ld    (hl),c
  ld    a,b
  rrca
  rrca
  rrca
  rld
  or    $FC
  ld    l,(hl)
  ld    h,a

  ld   b,(ix)
  inc  ix
ps_draw:
  ld   a,(ix)
  or   (hl)
  ld   (hl),a
ps_shift:
  ld   de,$0010
  add  hl,de
  inc  ix
  djnz ps_draw
  ret

_rld:    .db $00
offsets: .db 0,1,2,3,4,5,6,7