Path: utzoo!utgpu!news-server.csri.toronto.edu!rpi!zaphod.mps.ohio-state.edu!mips!spool.mu.edu!uunet!mcsun!hp4nl!utrcu1!mi.eltn.utwente.nl!klamer From: klamer@mi.eltn.utwente.nl (Klamer Schutte) Newsgroups: comp.sys.atari.st.tech Subject: Re: Getting ASCII value from scancode Message-ID: Date: 29 Apr 91 08:50:26 GMT References: <1991Apr26.232519.12216@zip.eecs.umich.edu> <80354@bu.edu.bu.edu> <1991Apr27.172516.29313@zip.eecs.umich.edu> Sender: news@utrcu1.UUCP Distribution: all Organization: University of Twente, BSC-El Lines: 57 In <1991Apr27.172516.29313@zip.eecs.umich.edu> heavy@zip.eecs.umich.edu (Richard Scott Hall) writes: >Yes, it does, but not if someone presses 'ATL+A'. The low order >bits in this case are zero. I want to be able to see that they >pressed 'A' while holding down 'ATL'. I can get the keyboard >state with vq_key_s() (this tells me if they are holding down >shift/control/alt), but what I need to know now is what ASCII >key they pressed with it. So if I can get some method to find >this out, I won'd need some big if-then-else-if structure to >key for a specific value...for instance, 'ATL+A' = 0x1e00, >'ATL+B' = 0x3000. Now the only what I know which ASCII key >they pressed is by having some code like: > if (key == 0x1e00) > c = 'A'; > else if (key == 0x3000) > c = 'B'; > . > . > . > ad infinitum >I don't really want to do this, but it might be necessary. How about this code: /* correct this table to the correct values. * * From your example it seems that position 0x1e should have 'A' */ char alt_to_ascii[256] = { 'a', 'b', 'c', ... }; if ((key & 0xff) == 0) /* is the low byte 0? */ c = alt_to_ascii[key >> 8]; else c = key && 0xff; Or otherwise: switch (key) {case 0x1e00: c = 'A'; break; case 0x3000: c = 'B'; break; . . . ad infinitum Just some thoughts Klamer -- Klamer Schutte Faculty of electrical engineering -- University of Twente, The Netherlands klamer@mi.eltn.utwente.nl {backbone}!mcsun!mi.eltn.utwente.nl!klamer