Hi,

How can you get the getKey value of a keypress and display it on the screen?

Thanks in advance!
Considering that this is in the z80 Assembly subforum, I'm going to assume that that's what you mean. You also mentioned that you learned from Hot_Dog's tutorials, so some of my code might seem unusual to you, but hopefully not overly confusing:


Code:
.nolist
#include "ti83plus.inc"
#include "keyval.inc"
#include "dcs7.inc"

.list
   .org $9D95-2
   .db $BB,$6D
INIT:
   xor d
   ret
   jr Start
   .dw Description
   .db $07,$00
   .dw $0000         ;no icon
   .dw $0000
   .dw $0000         ;the routine to open files.  DCS will start you here instead of at $9D95
                  ;if a file is pending
Description:
   .db "GetKey Tester",0
Start:
   bcall(_Homeup)
MainLoop:
   in a,(4)
   bit 3,a            ;[ON] key
   jr z,Quit
   bcall(_GetCSC)
   ld l,a
   ld h,0
   bcall(_disphl)
   bcall(_newline)
   jr Mainloop
Quit:
   bcall(_homeup)
   ret
The first part until

Code:
Start:
is the header, right?
I usually use Mimas for such little programs that are not really dangerous, so its easy: Mimas automatically inserts the header.
So, thanks for this routine!

Code:
.nolist
#include "ti83plus.inc"
#include "keyval.inc"
#include "dcs7.inc"


I do believe this is the header.
I believe this is the header:

Code:

.nolist
#include "ti83plus.inc"
#include "keyval.inc"
#include "dcs7.inc"

.list
   .org $9D95-2
   .db $BB,$6D
INIT:
   xor d
   ret
   jr Start
   .dw Description
   .db $07,$00
   .dw $0000         ;no icon
   .dw $0000
   .dw $0000         ;the routine to open files.  DCS will start you here instead of at $9D95
                  ;if a file is pending
Description:
   .db "GetKey Tester",0

Wink
That's the header if you want it to be a DCS program. I would see no reason why you wouldn't want it to be a DCS program, so you should start from INIT:.
These are your include files. Could be considered your header.

Code:

.nolist 
#include "ti83plus.inc" 
#include "keyval.inc" 
#include "dcs7.inc" 
.list

This is the same for all ASM programs

Code:

   .org $9D95-2 
   .db $BB,$6D 

This is a DCS header: It's for when you load it in the app.

Code:

INIT: 
   xor d 
   ret 
   jr Start 
   .dw Description 
   .db $07,$00 
   .dw $0000         ;no icon 
   .dw $0000 
   .dw $0000         ;the routine to open files.  DCS will start you here instead of at $9D95 
                  ;if a file is pending 
Description: 
   .db "GetKey Tester",0 

This is the actual program:

Code:

Start:
   bcall(_Homeup)
MainLoop:
   in a,(4)
   bit 3,a            ;[ON] key
   jr z,Quit
   bcall(_GetCSC)
   ld l,a
   ld h,0
   bcall(_disphl)
   bcall(_newline)
   jr Mainloop
Quit:
   bcall(_homeup)
   ret

Start, MainLoop, and Quit are actually called "labels"
Thanks for those excellent clarifications, graphmastur; that is of course exactly correct.
KermMartian wrote:
Thanks for those excellent clarifications, graphmastur; that is of course exactly correct.

lol, "of course". Very Happy I've been studying. Although, I'm looking at this code, and if there is no key pressed, the screen is constantly being updated, right?
  
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