Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!mnetor!seismo!rutgers!ames!ucbcad!ucbvax!jade!violet.berkeley.edu!ephram From: ephram@violet.berkeley.edu Newsgroups: comp.sys.ibm.pc Subject: Re: Reading scan codes Message-ID: <3559@jade.BERKELEY.EDU> Date: Thu, 14-May-87 23:37:36 EDT Article-I.D.: jade.3559 Posted: Thu May 14 23:37:36 1987 Date-Received: Tue, 19-May-87 01:29:09 EDT References: <476@catnip.UUCP> <311@nonvon.UUCP> Sender: usenet@jade.BERKELEY.EDU Reply-To: ephram@violet.berkeley.edu () Organization: University of California, Berkeley Lines: 43 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