Path: utzoo!utgpu!jarvis.csri.toronto.edu!clyde.concordia.ca!uunet!mcsun!sunic!tut!santra!tko-sony-7.hut.fi!justus From: justus@tko-sony-7.hut.fi (Juhana R{s{nen) Newsgroups: comp.sys.amiga.tech Subject: Re: Reading the keyboard without a window. Keywords: keyboard,read,easy? Message-ID: <1990Feb9.150945.29787@santra.uucp> Date: 9 Feb 90 15:09:45 GMT References: <6675@ucdavis.ucdavis.edu> Sender: news@santra.uucp (Cnews - USENET news system) Reply-To: justus@niksula.hut.fi (Juhana R{s{nen) Organization: Helsinki University of Technology, Finland Lines: 31 In article <6675@ucdavis.ucdavis.edu> rogers@iris.ucdavis.edu (Brewski Rogers) writes: >For a game I am working on, I need to be able to read the keyboard >without having a window open. I already have a routine that intercepts >input events before intuition sees them, but before I write down the >code and qualifier for each key, I'd like to know if there is an easier >way, or if someone has already written it. While the game DOES multitask, >the current interface with intuition is a total kludge, and we are trying >to make it cleaner/more reliable. One (quite brutal) way to do this is to read the keyboard input register directly. The address is (I belive) $bfec01, and there you'll see the latest keyboard event (both presses and releases). I'm not quite sure about the keycodes, they don't seem to correspond to the raw key codes you get from intuition. Reading an address constantly to decide whether something has happened or not is rather a clumsy thing to do, a better way would be to install an interrupt server that is invoked by PORTS-interrupt, which occurs (at least) every time a key is pressed or released. The interrupt-routine should peek into the keyboard register and then, if necessary, send a signal to the main program that there's a keypress available in a common memory area. However, this requires assembly programming and a firm knowledge of what one is doing (to keep the multitasking alive). >------------------------------------------------------ Quantum _\/_ >2727 Eel Bruce (6502 RULES!) Rogers |\ Duck ( 0 0) >Davis, Ca 95616 Quantum Duck Software, |\ \______/ / \\\ >916-756-2684 rogers@iris.ucdavis.edu |\ < < | \/ >"My brain is on fire!" \________/ Quark! Juhana Rasanen / justus@niksula.hut.fi