Path: utzoo!utgpu!news-server.csri.toronto.edu!rpi!zaphod.mps.ohio-state.edu!pacific.mps.ohio-state.edu!linac!unixhub!stanford.edu!snorkelwacker.mit.edu!bloom-beacon!eru!hagbard!sunic!isgate!krafla!adamd From: adamd@rhi.hi.is (Adam David) Newsgroups: comp.sys.atari.st.tech Subject: Re: Simulating keypress Message-ID: <3032@krafla.rhi.hi.is> Date: 10 Apr 91 02:47:36 GMT References: <1991Apr5.151946.25763@etek.chalmers.se> <1991Apr6.000637.20676@jato.jpl.nasa.gov> <1991Apr8.160108.22367@etek.chalmers.se> Organization: University of Iceland Lines: 42 In <1991Apr5.151946.25763@etek.chalmers.se> fabian@etek.chalmers.se (Martin Fabian) writes: >Is there any (legal) way to simulate a keypress from inside a program. You find the address of the raw keyboard buffer using the XBIOS function iovec. Keyboard scancodes can then be inserted directly into the buffer. You will want to disable interrupts or otherwise stop the real keyboard input while you are simulating keypresses (if you prefer not to have mixed input). Whatever you put into that buffer will be picked up by the BIOS the next time(s) it gets some input from the keyboard device, just as if it was actually typed in. In <1991Apr8.160108.22367@etek.chalmers.se> fabian@etek.chalmers.se (Martin Fabian) writes: >In <1991Apr6.000637.20676@jato.jpl.nasa.gov>, vsnyder@jato.jpl.nasa.gov (Van Snyder) writes: >|> I'd like to get hold of keypresses. It's easy to get hold of mouse >|> motions by inserting your own handler in place of the mousevec in >|> the struct returned by XBIOS' kbdvec function. >This seems like exactly my problem. Since the ikbdsys, address of >which is also returned by kbdvec, reads the keys off the UART there >really does not seem to be any other way of doing that. >Perhaps you could intercept the actual interrupt routine in some way ? This can be done but is not to be recommended. This is the system programmer's domain and is the right place to modify the keyboard handling systemwide. This is for instance the only sensible place to patch in a national keyboard routine. If applications programmers start fiddling with this we might end up having to replace the ikbd chip to get tamper-proof keyboard handling. This is Iceland, we need access to weird key combinations within other peoples' programs, to get the full range of characters even when programs read the scancodes directly. Please stay away from patching the ikbdsys routine unless: 1) you fully understand the implications of the changes made, this includes certain timing constraints. 2) the change does not destroy or undo any previously applied patches. (but you don't know what these patches are, so leave it alone). The normal way of modifying keyboard input is by patching the BIOS bconin routine. The scancode is also returned here so you can do just about anything you like with the keyboard input using bconin. -- Adam David. (adamd@rhi.hi.is)