[Hp48xgcc] [hp48xgcc - Open Discussion] Input from keyboard ..
Status: Beta
Brought to you by:
alex_ramos
From: <no...@so...> - 2002-07-14 17:26:00
|
Read and respond to this message at: http://sourceforge.net/forum/message.php?msg_id=1619011 By: nobody I was thrilled when I first discovered Alex's work to target the hp48 with gcc back in 1997. I started working on basic keyboard input and display output routines (never finishing the latter). Included below are the keyboard input routines I wrote. They're not elegant, and they're not guaranteed to work on anything other than my HP48GX. They use the built in ROM routines to grab the next available character from the keyboard buffer and return the raw keycode. 0 is returned otherwise. Enjoy, --- Zach === input.s === POPKEY equ $04840 FLUSH equ $00D57 xdef _getrawkey xdef _flushkeyb _flushkeyb ;; ;; exg.a d1, c ; move frame pointer out to safe register move.a c, r0 jsr FLUSH move.a r0, c ; restore frame pointer move.a c, d1 rtcc _getrawkey ;; ;; exg.a d1, c ; move frame pointer out to safe register move.a c, r0 jsr POPKEY bcs no_pop clr.w a move.b c, a move.a r0, c ; restore frame pointer move.a c, d1 clr.w c move.b a, c ; and put it back for return value move.1 #7, p ; restore p rtcc no_pop move.a r0, c move.a c, d1 clr.w c move.1 #7, p ; restore p rtcs === test.c === #include <hp48/object.h> #include <hp48/core.h> #include "input.h" char getrawkey(void); int main (int argc, char *argv[]) { char blat; while ((blat = getrawkey()) == 0) ; return blat; } ______________________________________________________________________ You are receiving this email because you elected to monitor this forum. To stop monitoring this forum, login to SourceForge and visit: http://sourceforge.net/forum/monitor.php?forum_id=22089 |