Re: A83: Re: Re: LDIR/CPIR clock timing, AND sprite routine


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

Re: A83: Re: Re: LDIR/CPIR clock timing, AND sprite routine




>your problem is that you want a "masked" sprite routine.  Probably the
>easiest masked sprite routine to make relies on using an "AND" routine to
>keep the background graphics that you want to stay, while destroying the
>data behind the sprite that you want to display.  This ensures that only
>the area, predetermined by your sprite mask is removed, taking away the
>transparent look from the sprite.  This method of masking is accomplished
>by using an "AND" sprite routine, with the 1's in the sprite standing for
>data you want to preserve, and 0's being the background inside the sprite
>that you want blank.  Then you simply "OR" the desired sprite over the same
>territory as the mask.  Sorry for lack of example, you can do this by
>making 2 sprite routines (one "or" & one "and").
>
>-harper


  well, if you were going to use that method of masking (instead of a single 
masking sprite routine like Mardell's ASCR routines), then you certainly 
would not use two separate sprite routines. It would be much more 
size-efficient to change the opcodes of the sprite routine. Below is an 
example of how Joe Wingbermuele's LargeSprite routine could be modified to 
do XOR, OR, or AND without requiring two separate routines. However, that 
would be an extremely slow way of doing things. If you want a decent masking 
routine, use Mardell's ASCR, Hideaki Omuro's SprClp, Eric Huizing's 
SpriteBlitt, or one of a dozen masking sprite routines readily availible on 
ticalc.org.

AND:
push af
ld a,$A2
jr JOESPRITE

OR:
push af
ld a,$B2
jr JOESPRITE

XOR:
push af
ld a,$AA
JOESPRITE:
ld (OPCHANGE1),a
inc a
ld (OPCHANGE2),a
pop af
di
ex af,af'
ld a,c
push	af
ex af,af'
ld e,l
ld h,$00
ld d,h
add hl,de
add hl,de
add hl,hl
add hl,hl
ld e,a
and $07
ld c,a
srl e
srl e
srl e
add hl,de
ld de,GRAPH_MEM
add hl,de

sl0:
push	hl
sl1:
ld d,(ix)
ld e,$00
ld a,c
or a
jr z,sl3
sl2:
srl d
rr e
dec a
jr nz,sl2
sl3:
ld a,(hl)
OPCHANGE1:
or d      ;***   Changed by routine
ld (hl),a
inc hl
ld a,(hl)
OPCHANGE2:
or e      ;***   Changed by routine
ld (hl),a
inc ix
ex af,af'
dec a
push af
ex af,af'
pop af
jr nz,sl1
pop hl
pop af
push af
ex af,af'
ld de,12
add hl,de
djnz sl0
pop af
ret

---------
Sam Heald
evil_sam@hotmail.com
void.calc.org

________________________________________________________________________
Get Your Private, Free E-mail from MSN Hotmail at http://www.hotmail.com