A83: Re: Sprite routine problems
[Prev][Next][Index][Thread]
A83: Re: Sprite routine problems
At the expense of sounding a prick (I apologize in advance)...just move the
aligned part after the aligned part - then compare to Movax's routine,
because it is pretty much identical. Apart from you use index registers a
bit more (which are slower incidentally - movax avoids using them in aligned
sprite blits)...you've used less pop/pushes, and knowing Movax they're there
for a reason.
Later,
James.
----- Original Message -----
From: Pizza of Hut <pizzaofhut@geocities.com>
To: Assembly-83 <assembly-83@lists.ticalc.org>
Sent: Wednesday, September 29, 1999 9:03 PM
Subject: A83: Sprite routine problems
>
> Hello. I've been working on a 8x8 xor sprite routine to test my z80
> skills. For some reason, the actual sprite wont display, so I'm hoping
> one of you would be able to help me out. The code is as follows:
>
> ;Input: a-x coord, e-y coord, ix-sprite address
> ;Output: 8x8 XOR sprite written to 8e29h
> 8x8_sprite:
> ld hl,0
> ;*********Calculate addy in graphbuf********
> sla e ;Do y*12
> sla e
> add hl,de
> add hl,de
> add hl,de
> srl a ;Do x/8
> srl a
> srl a
> ld d,0
> ld e,a
> add hl,de
> ld de,8e29
> add hl,de
> ld b,00000111b
> and b
> cp 0 ;checks if sprite is aligned
> jr z,Aligned_Sprite ;If so, goto aligned sprite bit
> ;********Non-aligned sprite blit starts here********
> ld b,a ;Shift counter
> ld c,8 ;Line counter
> Line_Loop:
> ld d,(ix+0)
> push bc
> Shift_Loop:
> srl d
> rr e
> djnz Shift_Loop
> pop bc
> ld a,d ;Write line to graphbuf
> xor (hl)
> ld (hl),a
> inc hl
> ld a,e
> xor (hl)
> ld (hl),a
> ld de,11
> add hl,de
> inc ix
> dec c
> jr nz,Line_Loop
> ret
> ;********Aligned sprite blit starts here********
> Aligned_Sprite:
> ld c,16 ;Line counter
> Aligned_Loop:
> ld d,(ix+0)
> ld a,d
> xor (hl)
> ld (hl),a
> ld de,12
> add hl,de
> inc ix
> dec c
> jr nz,Aligned_Loop
> ret
> .end
> END
>
> If anyone can find what I did wrong, I'd really appreciate it. Thanx.
> --
> Pizza of Hut
> http://www.antishrine.sacone.com/
>
>
>
>
References: