Re: A82: Sprite routine for ash
[Prev][Next][Index][Thread]
Re: A82: Sprite routine for ash
At 02:53 PM 8/14/97 -0600, you wrote:
>What is the simplest way (doesn't have to be the fastest) to display a
>8x8 sprite at, say, (B,C) using Ash.
PutSprite: ; Puts a sprite stored at (HL) at B,C (by Jimmy Mardell)
push bc
push de
ld a,63
sub c
ld c,a
push hl
push hl
call $4166
ld de,$88B8
add hl,de
ex de,hl
pop hl
ld b,(hl)
inc hl
ld c,(hl)
inc hl
push hl
pop ix
ex de,hl
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)
ld (hl),a
jr PS_NextPixel
PS_NoPixel:
cpl
and (hl)
ld (hl),a
PS_NextPixel:
ld a,e
rrca
jr nc,PS_SameByte
inc hl
PS_SameByte:
djnz PS_NewCol
pop hl
pop af
ld de,12
add hl,de
pop bc
dec c
jr nz,PS_NewRow
pop hl
pop de
pop bc
ret
This is for non-aligned sprites, if you only need to do aligned ones, it is
much simpler, faster and smaller. Remember to set the rom page to 4 before
trying to use this routine, as it uses FIND_PIXEL.
-Andrew
Follow-Ups:
References: