2 * DOS interrupt 09h handler (IRQ1 - KEYBOARD)
13 BYTE queuelen
,queue
[15];
16 /**********************************************************************
19 * Handler for int 09h.
21 void WINAPI
INT_Int09Handler( CONTEXT
*context
)
23 BYTE scan
= INT_Int09ReadScan();
24 UINT vkey
= MapVirtualKeyA(scan
&0x7f, 1);
29 /* as in TranslateMessage, windows/input.c */
30 cnt
= ToAscii(vkey
, scan
&0x7f, QueueKeyStateTable
, (LPWORD
)ch
, 0);
32 FIXME(int,"enter character %c into console input, not implemented\n",ch
[0]);
35 DOSVM_PIC_ioport_out(0x20, 0x20); /* send EOI */
38 static void KbdRelay( LPDOSTASK lpDosTask
, PCONTEXT context
, void *data
)
40 KBDSYSTEM
*sys
= (KBDSYSTEM
*)DOSVM_GetSystemData(0x09);
42 if (sys
&& sys
->queuelen
) {
43 /* cleanup operation, called from DOSVM_PIC_ioport_out:
44 * we'll remove current scancode from keyboard buffer here,
45 * rather than in ReadScan, because some DOS apps depend on
46 * the scancode being available for reading multiple times... */
48 memmove(sys
->queue
,sys
->queue
+1,sys
->queuelen
);
52 void WINAPI
INT_Int09SendScan( BYTE scan
)
54 KBDSYSTEM
*sys
= (KBDSYSTEM
*)DOSVM_GetSystemData(0x09);
56 sys
= calloc(1,sizeof(KBDSYSTEM
));
57 DOSVM_SetSystemData(0x09,sys
);
59 /* add scancode to queue */
60 sys
->queue
[sys
->queuelen
++] = scan
;
61 /* tell app to read it by triggering IRQ 1 (int 09) */
62 DOSVM_QueueEvent(1,DOS_PRIORITY_KEYBOARD
,KbdRelay
,NULL
);
65 BYTE WINAPI
INT_Int09ReadScan( void )
67 KBDSYSTEM
*sys
= (KBDSYSTEM
*)DOSVM_GetSystemData(0x09);