So 2 days ago I got my calculator for Christmas, am cool now Cool.
I've been trying to get a simple game loop to work that ends when you press the ENTER button.

Here's the code (pretty much the whole thing except for some util functions):

Code:
SJQ_gameloop:
   ld HL, vRam
   ld DE, %1110011111100000
   ld BC, 320 * 240
   call SJQ_MemSet16
   
   call _GetCSC
   cp A, 105
   jp NZ, SJQ_gameloop
SJQ_gameend:
   call _homeup
   call _ClrScrnFull
   ret


It seems to just get stuck in an infinite loop, and I end up having to reset it to try again.
What am I doing wrong when comparing it with 105 (the ENTER button code)?
Assembly uses different keycodes; 105 is the BASIC keycode of Enter. Take a look at skEnter in this include file.
105 is not the ENTER key code. Try using skEnter (09h) instead of 105.
It works, thanks, but a second kinda "bug" happens, if I try to turn off the calculator before pressing enter, and then pressing enter then this screen appears:
The on key is meant to break out of programs, which is good in case something like an infinite loop is reached... You can disable this behavior, but I would advise against it.
Here is the link to OnBlock by Mateo, which disables the on button breaking out of programs. The source code is included.
  
Register to Join the Conversation
Have your own thoughts to add to this or any other topic? Want to ask a question, offer a suggestion, share your own programs and projects, upload a file to the file archives, get help with calculator and computer programming, or simply chat with like-minded coders and tech and calculator enthusiasts via the site-wide AJAX SAX widget? Registration for a free Cemetech account only takes a minute.

» Go to Registration page
Page 1 of 1
» All times are UTC - 5 Hours
 
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum

 

Advertisement