[A83] Re: Using data...


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

[A83] Re: Using data...




The MUCH BETTER way:
Do it like this: (a= number of sprite)

GetSpritePointer:  ;Input a=sprite number, ix=sprite pointer
  ld h,0
  ld l,a
  add hl,hl
  add hl,hl
  add hl,hl
  ld de,Sprites  ;Substitute 'Sprites' for whatever you named the sprites
  add hl,de
  push hl
  pop ix
  ret


If you need more than 256 sprites, (the max number of 8x8 sprites is 2500), 
remove the first 2 lines and have hl be the sprite number.

>From: "Steve Watson" <fif_freak00@hotmail.com>
>Reply-To: assembly-83@lists.ticalc.org
>To: assembly-83@lists.ticalc.org
>Subject: [A83] Re: Using data...
>Date: Sat, 17 Mar 2001 22:34:01 -0700
>
>
>Well, the first sprite is pointless if you just want your code to read the
>second one...But, if your code uses BOTH sprites, put the sprites into
>different pointers...
>EX:
>....CODE HERE....
>      cp 5
>      jr z,showsprite1
>      cp 6
>      jr z,showsprite2
>showsprite1:
>      ld b,8          ;I am using the ionPutSprite routine...sprite is 8 
>high
>      ld a,0          ;X coord=0
>      ld l,a          ;Y coord=0
>      ld ix,sprite1   ;Point to the first sprite
>      call ionPutSprite     ;call the routine (any sprite routine would 
>work,
>just fix the X & Y coord registers and the sprite pointers.)
>      call ionFastCopy      ;copy the graph buffer (another is
>B_CALL(_grbufcpy) or for 83 ASM call _grbufcpy_v)
>      B_CALL(_getkey)
>      ret
>showsprite2:
>      ld b,8
>      ld a,0
>      ld l,a
>      ld ix,sprite2
>      call ionPutSprite
>      call ionFastCopy
>      B_CALL(_getkey)
>      ret
>sprite1:
>      .db %00000000
>      .db %00000000
>      .db %00000000
>      .db %00000000
>      .db %00000000
>      .db %00000000
>      .db %00000000
>      .db %00000000
>sprite2:
>      .db %11111111
>      .db %11111111
>      .db %11111111
>      .db %11111111
>      .db %11111111
>      .db %11111111
>      .db %11111111
>      .db %11111111
>.end
>end
>
>I hope that helped you out a bit
>
>_________________________________________________________________
>Get your FREE download of MSN Explorer at http://explorer.msn.com
>
>
>

_________________________________________________________________
Get your FREE download of MSN Explorer at http://explorer.msn.com