[A83] Re: moving sprites
[Prev][Next][Index][Thread]
[A83] Re: moving sprites
Since nobody sees the error in this program: pushing/popping within calls is
not a good idea.
Please correct me if I'm wrong.
>
> Most sprite routines destroy the contents of the registers, so you need to
> push the registers, then pop them afterwards. This little routine moves a
> sprite, and calls 'pushsprite', which pushes all the registers, then pops
> them after drawing the sprite.
>
>
> ld ix,sprite
> ld a,0
> ld l,32
> ld b,80
> SpriteMoveLoop:
> push bc
> inc a
> ld b,8
> call PushSprite
> call PushFastCopy
> call PushSprite
> pop bc
> djnz SpriteMoveLoop
>
> ret
>
> PushSprite:
> push af
> push bc
> push de
> push hl
> push ix
> call ionPutSprite
> popem:
> pop ix
> pop hl
> pop de
> pop bc
> pop af
>
> PushFastCopy:
> push af
> push bc
> push de
> push hl
> push ix
> call ionfastcopy
> jr Popem
>
> Sprite:
> ..db %00111100
> ..db %01000010
> ..db %10110001
> ..db %10100001
> ..db %10000001
> ..db %10000101
> ..db %01000010
> ..db %00111100
>
> I hope this works...
>
>
> _________________________________________________________________
> Join the world's largest e-mail service with MSN Hotmail.
> http://www.hotmail.com
>
>
References: