Hi y'all. I'm looking for a fast way to write a loop that waits till all keys have been released. On TI-82 I simply output 0 to the keypad port once, then poll it repeatedly to see if any bit is reset. However, the same method doesn't seem to work reliably on 84+. So, what's the best method to do it (without a bcall/romcall)?
Off the top of my head, this should probably work. Not tested. Not particularly size-efficient, but unless you're willing to count clock cycles against the delay, you won't get much faster than this.. And yes, you do need the delay in there since the keyboard hardware can't react fast enough to a straight consecutive in/outs.
Monochrome 84+ and CSE:

Code:

 ld a,$FF
 out (1),a  ;reset keygroups
 call keydelay
 xor a
 out (1),a  ;activate all keygroups
-:
 call keydelay
 in a,(1)   ;read in keys
 inc a
 jr nz,{-}  ;if result was wasn't $FF, keys were pressed. Loop back and keep waiting
 ret

keydelay:
 push hl
 pop hl
 ret
Thanks Iambian. Haven't tested your code yet either (actually a friend does the testing on 84+ for me since I don't own one myself), but I have high hopes Razz

I didn't expect the 84+ keyhandler to be that sluggish Surprised Same with other ports, too, sometimes they're even slower than mentioned on wikiti. For example I've come across a 84+ which needs a whopping 150+ t-states wait between LCD writes. Unthinkable on 82, even the lazy a** Parcus.


I would actually well be willing to count cycles. So, does anybody know what's the exact amout of delay needed between reads?
I think the issue is that it doesn't always appear to be the same between calcs, even of the same model/serial. the_mad_joob did a bit of research into it:
http://www.cemetech.net/forum/viewtopic.php?t=9101
And a couple topics over at Omnimaga, too:
https://www.omnimaga.org/asm-language/8x-gt-port-1-questions/
https://www.omnimaga.org/asm-language/8x%28se%29-testers-needed/
https://www.omnimaga.org/asm-language/port-1-stuff/
Very interesting read, thanks!
  
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