Path: utzoo!mnetor!uunet!mcvax!philmds!leo From: leo@philmds.UUCP (Leo de Wit) Newsgroups: comp.sys.atari.st Subject: Re: st keyboard buffering Message-ID: <480@philmds.UUCP> Date: 6 May 88 10:02:42 GMT References: <4215@dasys1.UUCP> <478@philmds.UUCP> <4694@batcomputer.tn.cornell.edu> Reply-To: leo@philmds.UUCP (L.J.M. de Wit) Organization: Philips I&E DTS Eindhoven Lines: 40 Keywords: keyboard input Crawcin Bconin In article <4694@batcomputer.tn.cornell.edu> braner@tcgould.tn.cornell.edu (braner) writes: >In article <478@philmds.UUCP> leo@philmds.UUCP (L.J.M. de Wit) writes: >>Here's how keyboard buffering is done (at least I thought so ...) : >> ...[stuff deleted]... >> for (i = iop->ibufhead; i != iop->ibuftail; ) { >- note that what "they" call head and tail may be the reverse of what you > (or I, anyway) would call them... Agree, but I got (a hint for) the names from Data Becker's Atari ST Intern. I think with a circular buffer, a reader and a writer it's anyway a question whose side you're on. >> for (i = iop->ibufhead; i != iop->ibuftail; ) { >> if (*(int *)(iop->ibuf + i) == CONTROLC) { >- this may fail if "conterm" is set so that the kbdshift info is in the top > byte of the top word. Better use: > if (((*(int *)(iop->ibuf + i)) & 0xFF00FF) == CONTROLC) > ^^^^^^^^^^ Still better maybe: for (i = iop->ibufhead; i != iop->ibuftail; ) { if (((*(int *)(iop->ibuf + i)) & 0xFF0000) == CONTROLC) the ascii bindings may be changed by an xbios call, it's safer to use just the scancode. But thanks for the correction, anyway! > Better to write code like this: > #define WORD int /* this is for megamax */ > ... WORD ... /* all through the code where it matters */ > (Makes it a lot easier to port to another compiler.) or to use: #include "portab.h" which just includes such definitions (at least for Lattice there's such a file). >- Moshe Braner. (YAFIYGI) (You asked for it, you got it.) (TeX) >(Still looking for a used 520ST system) I use one. A plus that is (520 ST++ :=) Leo (C-ing is believing).