Re: A85: ti85 sprite routines


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

Re: A85: ti85 sprite routines




At 04:11 1998-02-02 GMT, you wrote:
>
>Most people use PutSprite i would imagine.  You can find it on Jimmy
>Mardell's web site, www.algonet.se/~mja .

And I don't really understand why :-) It's probably the
most simple sprite routine you can get, and it isn't very
optimized either. There are much better methods to
put sprites. And if you want more advanced sprite routines,
with clipping and stuff, the routines used in Sqrxz should
be good. The file ascr.h is public domain and free to use/modify.

Here's the PutSprite routine, but a few bytes smaller:

PutSprite: ; Puts a sprite stored at (HL) at B,C
 push bc
 push de
 ld a,63
 sub c
 ld c,a
 push hl
 ROM_CALL(FIND_PIXEL)  ; or just 'call FIND_PIXEL' in newer OS/Shells
 ld de,$FC00
 add hl,de
 ex (sp),hl  ; A very handy instruction...
 ld b,(hl)
 inc hl
 ld c,(hl)
 inc hl
 ex (sp),hl
 pop ix
PS_NewRow:
 push bc
 ld d,(ix)
 inc ix
 push af
 push hl
PS_NewCol:
 rl d
 ld e,a
 jr nc,PS_NoPixel
 or (hl)
 jr PS_NextPixel
PS_NoPixel:
 cpl
 and (hl)
PS_NextPixel:
 ld (hl),a
 ld a,e
 rrca
 jr nc,PS_SameByte
 inc hl
PS_SameByte:
 djnz PS_NewCol
 pop hl
 pop af
 ld de,16
 add hl,de
 pop bc
 dec c
 jr nz,PS_NewRow
 pop hl
 pop de
 pop bc
 ret

--
Real name: Jimmy Mårdell                 
IRC......: Yarin                         
Email....: mailto:yarin@acc.umu.se      <-- NEW E-MAIL ADDRESS!!!!
Homepage.: http://www.algonet.se/~mja/


Follow-Ups: References: