Article View: comp.os.msdos.programmer
Article #2273"wanted -- c-code fragment to source keys into DOS key buffer"
From: Jeff Sondeen
Date: Mon, 17 Sep 1990 23:27
Date: Mon, 17 Sep 1990 23:27
47 lines
1828 bytes
1828 bytes
Having succeeded in getting a popup routine to grab some text off the
screen, I'm having trouble sourcing it into DOS's key buffer: I think
I need to replace the interrupt 16 (keyboard services) routine until
all the grabbed chars have been read (stuffing each of them one at a
time into the DOS key buffer), but my attempt locks up my machine
frequently. Could someone supply an int16 fragment in c, or give me
pointers to books that would explain this? Thanks, /jeff
Here's my code fragment, using Zortech popup, mouse, interrupt packages:
...
#define MAXBUFFER 80
char chars[MAXBUFFER+1];
char scans[MAXBUFFER+1];
int maxkey, numkey;
volatile int far* kbhead = (int far *) 0x41a;
volatile int far* kbtail = (int far *) 0x41c;
volatile char far* kbbuf = (char far *) 0x400;
...
/* intercept int16, while there are chars and scancodes, putting each
into the DOS keyboard buffer one at a time */
int cdecl do_keyboard(struct INT_DATA *pd) {
if (numkey < maxkey) {
kbbuf[*kbtail] = chars[numkey++];
kbbuf[*kbtail+1] = scans[numkey];
*kbtail = *kbtail+2;
if (*kbtail > 0x3c) *kbtail = 0x1e;
} else int_restore(0x16);
return(0);
}
void popmain(popmain)
{
...
if (maxkey > 0) int_intercept(0x16, do_keyboard, 512);
/* if there are keys, intercept int16 */
}
--
/jeff sondeen@isi.edu "happiness is a non-negative cash flow"
Technical Details
Message-ID:
<15000@venera.isi.edu>Path:
arc1-ca.pugleaf.net!utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!usc!isi.edu!sondeenShow Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!usc!isi.edu!sondeen From: sondeen@isi.edu (Jeff Sondeen) Newsgroups: comp.os.msdos.programmer Subject: "wanted -- c-code fragment to source keys into DOS key buffer" Message-ID: <15000@venera.isi.edu> Date: 17 Sep 90 23:27:50 GMT Reply-To: sondeen@venera.isi.edu (Jeff Sondeen) Organization: Information Sciences Institute, Univ. of So. California Lines: 47