ben@catnip.UUCP (Bennett Broder) (05/11/87)
I am writing a program using Quick Basic, and I would like to be able to determine if the shift keys are pressed. I figure that there must be a way to read the port that the keyboard is connected to in order to determine this, but I am unsure of exactly what must be done. Could someone shed a little light on the subject? Thanks. -- Ben Broder {ihnp4,decvax} !hjuxa!catnip!ben {houxm,clyde}/
apn@nonvon.UUCP (root) (05/13/87)
in article <476@catnip.UUCP>, ben@catnip.UUCP (Bennett Broder) says: > > I am writing a program using Quick Basic, and I would like to be able to > determine if the shift keys are pressed. I figure that there must be > a way to read the port that the keyboard is connected to in order to > determine this, but I am unsure of exactly what must be done. Could > someone shed a little light on the subject? > > Thanks. > > -- > > Ben Broder > {ihnp4,decvax} !hjuxa!catnip!ben > {houxm,clyde}/ shift keys are just like any other keys... you get a make code and a break code. I do not know under what facilities you can access this in QB. -Alex Novickis
ephram@violet.berkeley.edu (05/15/87)
in article <476@catnip.UUCP>, ben@catnip.UUCP (Bennett Broder) says: > > I am writing a program using Quick Basic, and I would like to be able to > determine if the shift keys are pressed. I figure that there must be > a way to read the port that the keyboard is connected to in order to > determine this, but I am unsure of exactly what must be done. Could > someone shed a little light on the subject? > > Thanks. > > -- > > Ben Broder > {ihnp4,decvax} !hjuxa!catnip!ben > {houxm,clyde}/ The status of things like shift keys, alt key ctrl key and some others are all bitmapped into a byte called the keyboard status flag. The byte is at segment 40H offset 17H. the bit are as follows 80H insert state is active 40H Caps lock state has been toggled 20H num lock " " " " 10H scroll lock state " " " 08H alternate key depressed 04H ctrl key depressed 02H left shift key depressed 01H right shift key depressed above source PC tech ref july 82 in order to test to see if both shift keys are depressed (no pun) do something like the pascal construct if (40:17 and 3) eq 3 then {code to do if both keys are depressed simultaneously (sp?) } else {some other action} endif; Ephram Cohen ephram@violet.berkeley.edu