Re: LF: Getkey!


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

Re: LF: Getkey!



Here is a simple routine that I got from my program 'keymap', probably
found at the Fargo archive.

Loop:
	jsr             flib[idle_loop]           
	cmp             #264,d0      	;Esc pushed?	
	beq             done		;if so, go to done and exit.
	cmp             #0,d0		;if a key is not pressed,
	beq             loop		;goto loop. 	

All this segment does is puts the calc in a loop, waiting for keypresses.
 If key #264 is pressed(Escape), then it goes to label done and exits. 
Any other keypress is stored in the data register d0.  If you want to
change that keypress into a string, you have to convert it.  See the ASM
for Keymap for more details on that.  All keymap does is sit and wait for
the user to press a key.  Then it shows the getkey code for that code. 
(this is useful for programmers as not all keycodes are shown in the
manual)  BTW, if you just want to check to see if a key was pressed,
clear d0, start an Idle loop and cmp #0,d0.  Next put a beq or somthing
for it to loop back to.  After this, put what you want the prog to do if
a key is hit.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Geek used to be a four-letter word.  Now it's a six-figure one.
When you tell the truth, you never have to worry about your lousy memory.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Stephen Grigg      grigg@juno.com     (208)237-6749    Chubbuck, ID


On Tue, 27 May 1997 15:14:26 +0200 "=?ISO-8859-1?Q?Georg_=C5berg?="
<georg.aaberg@eraconn.se> writes:
>Can anyone explain to me how you check for keypresses?!
>I can't find any routines for that in the Fargo libraries!
>Thanks!
>
>	/Gorby
>
>
>---------------------------------------------------------------
>Georg Aberg <georg.aberg@usa.net>
>IRC nickname: <Gorby>
>Homepage: <http://gorby.home.ml.org>
>---------------------------------------------------------------
>


References: