Path: utzoo!utgpu!news-server.csri.toronto.edu!rpi!zaphod.mps.ohio-state.edu!samsung!think.com!paperboy!osf!dbrooks From: dbrooks@osf.osf.org (David Brooks) Newsgroups: comp.sys.atari.st.tech Subject: Re: Getting ASCII value from scancode Message-ID: <21490@paperboy.OSF.ORG> Date: 28 Apr 91 17:49:50 GMT References: <1991Apr26.232519.12216@zip.eecs.umich.edu> <80354@bu.edu.bu.edu> <1991Apr27.172516.29313@zip.eecs.umich.edu> Sender: news@OSF.ORG Reply-To: dbrooks@osf.org (David Brooks) Distribution: all Organization: Open Software Foundation Lines: 31 heavy@zip.eecs.umich.edu (Richard Scott Hall) writes: >>> is there >>> anyway to go from scancode to ASCII without having to define >>> all the values in my program? >> >> You should use evnt_keybd() which returns an integer. >> >> Now, the high-order byte contains the scan code of the key pressed, >> and the low-order byte contains the ASCII code. > >Yes, it does, but not if someone presses 'ATL+A'. The low order >bits in this case are zero. Right. Unfortunately, the low-order bytes are zero in lots of other cases: function keys and cursor keys, to name two. Here's what I do when I see a null byte. First, kbshift(-1) & 8 tells me if ALT is depressed. Now you take the scancode and look it up again in the key mapping table. The address of this table is handed to you as the return value of keytbl(-1L, -1L, -1L), which you need call only once; this points to a vector of pointers to the unshift, shift and capslock tables (each 128 bytes indexed by scancode). Now all you have to do is undo the GSX nonsense -- hello? Are you still there? -- best to experiment with values between '1' and '='; I get terribly confused at this point. -- David Brooks dbrooks@osf.org Systems Engineering, OSF uunet!osf.org!dbrooks Donnie Wahlberg is brought to you by three billion years of evolution.