Path: utzoo!mnetor!uunet!husc6!bloom-beacon!mit-eddie!uw-beaver!cornell!batcomputer!braner From: braner@batcomputer.tn.cornell.edu (braner) Newsgroups: comp.sys.atari.st Subject: Re: st keyboard buffering Message-ID: <4694@batcomputer.tn.cornell.edu> Date: 5 May 88 13:19:33 GMT References: <4215@dasys1.UUCP> <478@philmds.UUCP> Reply-To: braner@tcgould.tn.cornell.edu (braner) Organization: Cornell Theory Center, Cornell University, Ithaca NY Lines: 47 Keywords: keyboard input Crawcin Bconin Summary: some comments [] 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 ...) : >The keyboard ACIA chip reads the keyboard and makes the characters available >... The processor, as part of the VBL routine, reads the byte... - the keyboard (and mouse and joystick) events have their own interrupt. >#define CONTROLC 0x2e0003 > ... > 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... > 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) ^^^^^^^^^^ > a) Lattice has int == 4 bytes, short == 2 (Megamax I thought int == 2). > So you should replace the *(int *) by *(long *), and the short by int. - yup, in Megamax (and Laser) int==16 bits, long==32 bits. Avoid shorts. (I _think_ they're 8 bits in old Megamax, 16 in Laser.) 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.) >I hope this helps and is raw enough? Have a nice byte ( %-) ! - thanks, Leo! > Leo. (What you C is what you get). - Moshe Braner. (YAFIYGI) (You asked for it, you got it.) (TeX) (Still looking for a used 520ST system) STOP CONTRA AID: BOYCOTT COCAINE