Jump to content
Sign in to follow this  

Reading keyboard via TOS functions

Recommended Posts

I was on to write about this in thread where posted how to solve simply joystick read via TOS functions, but ..

It appears that hmm .. I need again to start with critic. You can not read keyboard in same way as joystick (and likely mouse) using Kbdvbase XBIOS 34 call, and changing vector to intercept scancode of pressed or released key. Yes - released key would be good, since sometime we need released key to start something.

So, not just not well documented, but is not consequent (that Kbdvbase) . It's done in pure ASM - because must be fast, but I think that they had no clear idea how to solve it best. Actually, IKBD chip does it better - it sends code when key is pressed, and sends code when key is released. 

And other really bad solution:  there IS system variable in all TOS versions, what holds code of pressed key, or 0 if nothing is pressed. Why they did not put it in regular system variable area $400-$600 is mystery. That would make very easy for SW too see what is pressed at moment. No, they put it in RAM area what is not documented, and every TOS version has different addresses. Btw. there is variable for joystick read too - but same error. STOS uses table with concrete addressed for diverse TOS versions. That's god, until new TOS version appears, then it needs STOS fixer. Joystick is main problem, because reading keyboard and mouse is possible via VDI, and that's luckily same in all TOS versions.

End I remembered that there is address in TOS headers, at pos. $24 which hold address of keyboard shift variable. Got idea to use it as base for accessing that variable for pressed key code. And yes, distance between 2 is same - $1E, in all TOS versions 1.02 -  2.06 . Did not check yet 3.xx - but it's basically same as 2.06, so most likely ..

4.xx - probably. And 1.00 ? It has shorter header, so no such value. But who needs 1.00 ?


All in all, there is no ideal way to read keyboard via TOS functions. I would say that what to use depends from current SW.  Even ikbdsys is possible to use, but in different way than joyvec.

  • Like 1

Share this post

Link to post
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.

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.

Sign in to follow this  

  • Recently Browsing   0 members

    No registered users viewing this page.

  • Create New...