Re: A83: sprite problems
[Prev][Next][Index][Thread]
Re: A83: sprite problems
A suggestion for not being able to quit: make sure you do a "pop de" in
your finish routine. This is all I can see that could be wrong, but you
didn't send the finish part.
Hope this helps
Jeremy
On Sat, 16 Sep 2000, Andrew Friedley wrote:
>
> First I want to say thank you to everyone who has helped me on this list so
> far.
>
> I am now trying to write my first game in ASM for the ti-83+ using movax's
> XOR sprite routines.
>
> Now I am having a bit of a problem with my game loop section.
> The game loop is currently as follows:
>
> ; GAME LOOP BEGIN
> startgame:
> B_CALL clrlcdfull
>
> ld d,47 ;initial ship x
> ld e,50 ; initial ship y
> ld bc,sprship ;ship sprite
>
> ld a,d ;move d to a for drawing
> push de ;push x y coordinates
>
> CALL SPRXOR
> B_CALL grbufcpy
>
> ; GAME LOOP INPUT
> gameinput:
>
> ;get input
> ld a,0FFh ;reset
> out (1),a
> ld a,0FEh
> out (1),a
> in a,(1) ;input arrow keys
>
> cp 253 ;left
> jr z,shipleft
>
> cp 251 ;right
> jr z,shipright
>
> cp 254 ;up
> jr z,shipup
>
> cp 247 ;down
> jr z,shipdown
>
> ld a,0FFh ;input clear key
> out (1),a
> ld a,0FDh
> out(1),a
> in a,(1)
>
> cp 191 ;clear
> jp z,finish
>
> ; GAME LOOP LOGIC
> gamelogic:
> jp gameinput
>
> As far as I can see there are no problems with this code, but I am including
> it for background. Notice I pushed the de register at the beginning. This
> is to save the ship's x,y coordinates during the input section. If the
> input section decides an arrow key has been pressed, the code for that key
> will pop de, erase the ship, modify the x,y coordinates and redraw the ship.
> After that, it pushes de back and continues the game loop. Below is the
> code for the left key, I am only including it because the others are almost
> identical.
>
> shipleft:
> pop de;
> ld a,d
> ld bc,sprship
> push de
>
> CALL SPRXOR
> B_CALL grbufcpy
>
> pop de
> ld a,d
> dec a;
> ld d,a
> push de
>
> CALL SPRXOR
> B_CALL grbufcpy
>
> jp gamelogic
>
> I know I went a bit overboard with the pushes/pops but I did that to try to
> figure out what was going wrong. When I move left/right in the game, the
> sip will move, but it leaves a trail of jibberish pixels behind it. I have
> looked at my code over and over, and don't see why this is happening. Do I
> need to clear the screen each loop iteration? If so, how much of a
> performance decrease will this be? Also, when I press the clear key to
> quit, the screen goes blank and the run indicator comes on, and the calc
> just sits there. I have to reset in order to get back to TI-OS. Does
> anybody know how to fix either of these problems?
>
> Thanks,
>
> Andrew Friedley
> _________________________________________________________________________
> Get Your Private, Free E-mail from MSN Hotmail at http://www.hotmail.com.
>
> Share information about yourself, create your own public profile at
> http://profiles.msn.com.
>
>
References: