A85: (no subject)


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

A85: (no subject)




>    I have been working on some code for Usgard 1.5. It is
>supposed to move a 16 by 8 sprite across the screen when you
>press the arrows. when you press exit it should quit. When
>you run it nothing happens. If you press exit a couple of
>times the calc freezes and displays garbage, eventualy
>shutting off. What is wrong?

Well, if you have not yet fixed it, here is my solution.


The things wrong with your code:
 1) The reason it locks the calc is that there is a
 bug inside the library NSR_NR routine (replace this
 with the bugfree NSR_CLP and see what I mean, or find
 the source to NSR_NR and use that instead.
Note:
 The differences between NSR_NR and NSR_CLP make no
 difference.  (Except at the far edges of the screen)

 2) When you replace NSR_NR with NSR_CLP, you find that
 the sprite flickers when you move it, and when you
 stop moving, it disapears.  To stop this from
 occuring, place the Sprite Eraser and Drawer in the
 move left and move right code pieces, like so:

PsuedoCode:

 This is what you have: (names changed)


 TopofLoop:
  Erase sprite
  get direction and go to move_left and move_right
  Draw Sprite
  goto TopofLoop

 Move_left:
  do left stuff
  go back

 Move_Right:
  do right stuff
  go back


 This is what to use:


 TopofLoop:
  get direction and go to move_left or move_right
  goto TopofLoop

 Move_Left:
  Erase sprite
  do left stuff
  Draw Sprite
  go back

 Move_right:
  erase sprite
  do right stuff
  draw sprite
  go back

You could also change the jr z,move_right and left with call
z,&move_right
and left and replace the jr GameLoops at the end of the code to ret
This should also fix the problem.


Sorry if this is non-understandable.


Hope this helped.   Any questions or comments, just ask.

Jonathan Kaus
jkaus@coleman.k12.wi.us