Jump to content
IGNORED

Ever wonder what the keyboard was really doing?


FALCOR4

Recommended Posts

Enjoying a relaxing day, browsing through some of my archives and saw the old 99/4A keyboard scanning routine that I coded a long time ago.  Nothing special but, it really helped me to understand what that goofy keyboard was doing sometimes.  For example, the "phantom key" that Thierry talks about really gave me fits when coding the mg explorer.  You can easily see it with this tool, just press FCTN SHIFT D for the right arrow and you'll see that a fourth "phantom" key appears.  That was a key sequence in the explorer memory editor for dragging the window around.  That fourth key had to be trapped in the software and ignored.  Hook up the joysticks and play with the dreaded alpha lock/up stick to see what happens.

 

Anyway, enjoy.  The code may have appeared in one of the Smart Programmer issues but I didn't look to see.  Again, nothing special, very simple, just came in handy sometimes.  Loads with the E/A (uncompressed tagged object file) and named, "keybrd."  QUIT is disabled so you have to cycle power to get out of it.

 

KSCAN.dsk

  • Like 6
Link to comment
Share on other sites

  • 1 year later...

Sometimes you may want to scan a key or two directly from the keyboard in your software rather than going through the TI KSCAN routine.  This routine, that loads into cartridge ROM, is a quick and easy way to identify the key column and row that you can use for directly addressing the TMS9901.  Also see Thierry's page on the TI keyboard implementation for a good rundown on how it works.  Just another tool in the tool set.   And, yes, the columns are listed vertically and the rows are listed horizontally ?

 

 

KBCART.bin

KEYBITs.pdf

  • Like 8
Link to comment
Share on other sites

  • 2 weeks later...
On 12/20/2020 at 12:21 PM, FALCOR4 said:

Sometimes you may want to scan a key or two directly from the keyboard in your software rather than going through the TI KSCAN routine.  This routine, that loads into cartridge ROM, is a quick and easy way to identify the key column and row that you can use for directly addressing the TMS9901.  Also see Thierry's page on the TI keyboard implementation for a good rundown on how it works.  Just another tool in the tool set.   And, yes, the columns are listed vertically and the rows are listed horizontally ?

 

 

KBCART.bin 1.49 kB · 11 downloads

 

NICE! ? I've just became aware of this little gem.  I tried it out on my beige system and discovered that it's pretty slick!

I'll link to this in the FR99/FG99 repository.

 

INFO.thumb.jpg.620051bfd4a7e869fc4d9c1a8a0143ed.jpg

 

 

 

 

 

Link to comment
Share on other sites

Thanks for providing this. Like it a lot. 

 

Just noticed that when pressing the right FCTN key while alpha lock is up, it shows alpha lock going down. Is that actually the case?

 

On a sidenote, In my Stevie editor I'm using a variant of the keyscan routine published by Simon Koppelmann taken from the book "TMS9900 assembler auf dem TI-99-4A".
Not using the TI99-4A ROM keyscan routine. 
Before I'll release Stevie, I have to revisit and have to learn more on how to properly debounce keys. Because that is what is required for getting a fluent typing experience.
Is there a good way to do a reliable keyboard debounce, without using a very precise CPU loop? I tought about the 9901 timer function here for a moment.
Seems like a waste spending CPU cycles while reading the keyboard. Also makes it difficult if you are on a machine that has a higher clock rate.

Link to comment
Share on other sites

BTW, here is a chart that I once drew for my TI-as-USB-keyboard project that could be helpful. There is one downside of directly accessing the keyboard (not going through KSCAN): It won't work on the Geneve. This is one of those showstoppers for the otherwise almost perfect compatibility.

 

keyboard_matrix.png

  • Like 4
Link to comment
Share on other sites

23 hours ago, retroclouds said:

Thanks for providing this. Like it a lot. 

 

Just noticed that when pressing the right FCTN key while alpha lock is up, it shows alpha lock going down. Is that actually the case?

 

On a sidenote, In my Stevie editor I'm using a variant of the keyscan routine published by Simon Koppelmann taken from the book "TMS9900 assembler auf dem TI-99-4A".
Not using the TI99-4A ROM keyscan routine. 
Before I'll release Stevie, I have to revisit and have to learn more on how to properly debounce keys. Because that is what is required for getting a fluent typing experience.
Is there a good way to do a reliable keyboard debounce, without using a very precise CPU loop? I tought about the 9901 timer function here for a moment.
Seems like a waste spending CPU cycles while reading the keyboard. Also makes it difficult if you are on a machine that has a higher clock rate.

That really happens with the FCTN key.  Also the 1,2,3,4,5 keys since they are all on the same line as the alpha key.  Just one of those goofy design choices that TI made.  Try this; press the FCTN, Shift and D keys together.  You'll notice a fourth "phantom key" pop up.

 

  • Like 4
Link to comment
Share on other sites

18 minutes ago, mizapf said:

BTW, here is a chart that I once drew for my TI-as-USB-keyboard project that could be helpful. There is one downside of directly accessing the keyboard (not going through KSCAN): It won't work on the Geneve. This is one of those showstoppers for the otherwise almost perfect compatibility.

 

keyboard_matrix.png

Nice!  This will be very handy!  Thanks

Link to comment
Share on other sites

RXB has this command CALL IO:

100 CALL CLEAR :: CALL HPUT(1,1,"THIS PROGRAM CHECKS FOR UNUSUAL KEYS BEING PRESSED, EVEN IF MORE THEN FOUR KEY ARE BEING PRESSED AT ONCE")
110 CALL IO(2,16,3,A,B):: IF A=18 AND B=255 THEN 110 ELSE CALL HPUT(24,3,RPT$(" ",30),24,24,STR$(A)&" "&STR$(B))
120 IF A=146 THEN CALL HPUT(24,3,"FUNCTION KEY")ELSE IF B=191 THEN CALL HPUT(24,3,"CONTROL KEY")ELSE IF B=223 THEN CALL HPUT(24,3,"SHIFT KEY")
130 IF B=251 THEN CALL HPUT(24,3,"ENTER KEY")ELSE IF B=253 THEN CALL HPUT(24,3,"SPACE BAR")ELSE IF B=254 THEN CALL HPUT(24,3,"PLUS/EQUAL KEY")
140 GOTO 110

This command unlike your other programs you see uses the IO CRU chip that talks to keyboard directly.

Thus the program returns the values of both sides of keyboard of a key, this is much better then other examples as it does a better job.

And it does it from XB with no assembly having direct access to the IO CRU chip.

 

Same command was used for the Weather Station control program.

  • Like 5
Link to comment
Share on other sites

6 minutes ago, RXB said:

RXB has this command CALL IO:


100 CALL CLEAR :: CALL HPUT(1,1,"THIS PROGRAM CHECKS FOR UNUSUAL KEYS BEING PRESSED, EVEN IF MORE THEN FOUR KEY ARE BEING PRESSED AT ONCE")
110 CALL IO(2,16,3,A,B):: IF A=18 AND B=255 THEN 110 ELSE CALL HPUT(24,3,RPT$(" ",30),24,24,STR$(A)&" "&STR$(B))
120 IF A=146 THEN CALL HPUT(24,3,"FUNCTION KEY")ELSE IF B=191 THEN CALL HPUT(24,3,"CONTROL KEY")ELSE IF B=223 THEN CALL HPUT(24,3,"SHIFT KEY")
130 IF B=251 THEN CALL HPUT(24,3,"ENTER KEY")ELSE IF B=253 THEN CALL HPUT(24,3,"SPACE BAR")ELSE IF B=254 THEN CALL HPUT(24,3,"PLUS/EQUAL KEY")
140 GOTO 110

This command unlike your other programs you see uses the IO CRU chip that talks to keyboard directly.

Thus the program returns the values of both sides of keyboard of a key, this is much better then other examples as it does a better job.

And it does it from XB with no assembly having direct access to the IO CRU chip.

 

Same command was used for the Weather Station control program.

That's pretty nifty, Rich!  How did you implement it?  Are you using the GPL Call IO command as part of the code sequence?  Just curious.

  • Like 1
Link to comment
Share on other sites

2 hours ago, FALCOR4 said:

That's pretty nifty, Rich!  How did you implement it?  Are you using the GPL Call IO command as part of the code sequence?  Just curious.

Yea it uses the GPL subroutine built into GPL itself from GPL Programming Manual: 

Spoiler

image.thumb.png.736f5caa29da98240eff245824d51269.png

 

  • Like 4
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...