This is an archived, read-only copy of the United-TI subforum , including posts and topic from May 2003 to April 2012. If you would like to discuss any of the topics in this forum, you can visit Cemetech's z80 & ez80 Assembly subforum. Some of these topics may also be directly-linked to active Cemetech topics. If you are a Cemetech member with a linked United-TI account, you can link United-TI topics here with your current Cemetech topics.

This forum is locked: you cannot post, reply to, or edit topics. Z80 & 68k Assembly => z80 & ez80 Assembly
Author Message
qxzwasd


Newbie


Joined: 07 Apr 2009
Posts: 2

Posted: 06 May 2009 05:04:41 pm    Post subject:

Hi everyone. I'm new to assembly programming, and this is a small program I wrote. It's just moving a "*" around the screen using the arrow keys. Here's the code:

Code:
.NOLIST
#INCLUDE "ti83plus.inc"
.LIST

.ORG   $9D93
.DB   $BB, $6D
   
Draw:
   b_call(_ClrScrnFull)
   LD      A, (XPos)
   LD      (CurCol), A
   LD      A, (YPos)
   LD      (CurRow), A
   LD      A, '*'
   b_call(_PutC)
KeyLoop:
   b_call(_GetKey)
   CP      kClear
   JR      Z, Exit
   CP      kLeft
   JR      Z, KeyLeft
   CP      kRight
   JR      Z, KeyRight
   CP      kUp
   JR      Z, KeyUp
   CP      kDown
   JR      Z, KeyDown
   JR      KeyLoop
KeyLeft:
   LD      A, (XPos)
   DEC   A
   LD      (XPos), A
   JR      Draw
KeyRight:
   LD      A, (XPos)
   INC   A
   LD      (XPos), A
   JR      Draw
KeyUp:
   LD      A, (YPos)
   DEC   A
   LD      (YPos), A
   JR      Draw
KeyDown:
   LD      A, (YPos)
   INC   A
   LD      (YPos), A
   JR      Draw
Exit:   
   RET
XPos:
   .DB 4
YPos:
   .DB 8
.END


When I run it I can move it left and right, but not up and down, and when I press clear symbols start scrolling on the screen. I can press 2nd-quit to get to the homescreen, but then it says that I have no free RAM. Could somebody just look at it and see if you see any obvious mistakes? Thanks.

EDIT: And I know that you can move off the screen and that will make it act weird, but that's not the problem. It won't move up or down at all.


Last edited by Guest on 06 May 2009 05:22:49 pm; edited 1 time in total
Back to top
benryves


Active Member


Joined: 23 Feb 2006
Posts: 564

Posted: 06 May 2009 05:27:05 pm    Post subject:

qxzwasd wrote:
EDIT: And I know that you can move off the screen and that will make it act weird, but that's not the problem. It won't move up or down at all.
Your initial Y coordinate is 8, which is off the screen (Y is 0 to 7, X is 0 to 15). I think you have your XPos and YPos .db directives at the end of the program the wrong way around.
Back to top
qxzwasd


Newbie


Joined: 07 Apr 2009
Posts: 2

Posted: 06 May 2009 05:30:00 pm    Post subject:

benryves wrote:
qxzwasd wrote:
EDIT: And I know that you can move off the screen and that will make it act weird, but that's not the problem. It won't move up or down at all.
Your initial Y coordinate is 8, which is off the screen (Y is 0 to 7, X is 0 to 15). I think you have your XPos and YPos .db directives at the end of the program the wrong way around.


Wow, thanks. I actually had them switched in one place, but I fixed that. I guess I had them switched everywhere. Thanks for your help, I'm surprised I didn't catch that.
Back to top
Display posts from previous:   
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
    »
» View previous topic :: View next topic  
Page 1 of 1 » All times are UTC - 5 Hours

 

Advertisement