dos int9 patch
Ove Kaaven
ovek at arcticnet.no
Wed Nov 7 22:29:03 CST 2001
OK, now I'm almost done cleaning out my tree... now only the Real
Restructure remains, it seems...
Log:
Moved the int 9 (keyboard) handler to dlls/winedos.
Index: dlls/winedos/Makefile.in
===================================================================
RCS file: /home/wine/wine/dlls/winedos/Makefile.in,v
retrieving revision 1.1
diff -u -r1.1 Makefile.in
--- dlls/winedos/Makefile.in 2000/12/26 00:22:46 1.1
+++ dlls/winedos/Makefile.in 2001/11/08 02:43:37
@@ -8,6 +8,7 @@
C_SRCS = \
dosvm.c \
+ int09.c \
module.c
@MAKE_DLL_RULES@
Index: dlls/winedos/dosvm.c
===================================================================
RCS file: /home/wine/wine/dlls/winedos/dosvm.c,v
retrieving revision 1.7
diff -u -r1.7 dosvm.c
--- dlls/winedos/dosvm.c 2001/07/02 19:59:44 1.7
+++ dlls/winedos/dosvm.c 2001/11/08 02:43:37
@@ -693,3 +693,18 @@
}
#endif
+
+BOOL WINAPI DOSVM_Init( HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved )
+{
+ TRACE_(module)("(0x%08x,%ld,%p)\n", hinstDLL, fdwReason, lpvReserved);
+
+ if (fdwReason == DLL_PROCESS_ATTACH) {
+ INT_SetWineHandler(9, INT_Int09Handler);
+ }
+ else if (fdwReason == DLL_PROCESS_DETACH)
+ {
+ INT_SetWineHandler(9, NULL);
+ }
+
+ return TRUE;
+}
Index: dlls/winedos/winedos.spec
===================================================================
RCS file: /home/wine/wine/dlls/winedos/winedos.spec,v
retrieving revision 1.4
diff -u -r1.4 winedos.spec
--- dlls/winedos/winedos.spec 2001/11/07 20:15:39 1.4
+++ dlls/winedos/winedos.spec 2001/11/08 02:43:37
@@ -1,5 +1,6 @@
name winedos
type win32
+init DOSVM_Init
import user32.dll
import kernel32.dll
@@ -20,3 +21,5 @@
@ stdcall OutPIC(long long) DOSVM_PIC_ioport_out
@ stdcall SetTimer(long) DOSVM_SetTimer
@ stdcall GetTimer() DOSVM_GetTimer
+
+@ stdcall KbdReadScan(ptr) INT_Int09ReadScan
Index: msdos/Makefile.in
===================================================================
RCS file: /home/wine/wine/msdos/Makefile.in,v
retrieving revision 1.13
diff -u -r1.13 Makefile.in
--- msdos/Makefile.in 2001/06/26 21:06:08 1.13
+++ msdos/Makefile.in 2001/11/08 02:43:39
@@ -12,7 +12,6 @@
dosmem.c \
dpmi.c \
xms.c \
- int09.c \
int10.c \
int11.c \
int12.c \
Index: msdos/interrupts.c
===================================================================
RCS file: /home/wine/wine/msdos/interrupts.c,v
retrieving revision 1.19
diff -u -r1.19 interrupts.c
--- msdos/interrupts.c 2001/11/05 23:48:36 1.19
+++ msdos/interrupts.c 2001/11/08 02:43:39
@@ -16,7 +16,7 @@
static INTPROC INT_WineHandler[256] = {
0, 0, 0, 0, 0, 0, 0, 0,
- 0, INT_Int09Handler, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
INT_Int10Handler, INT_Int11Handler, INT_Int12Handler, INT_Int13Handler,
0, INT_Int15Handler, INT_Int16Handler, INT_Int17Handler,
0, 0, INT_Int1aHandler, 0, 0, 0, 0, 0,
Index: msdos/ioports.c
===================================================================
RCS file: /home/wine/wine/msdos/ioports.c,v
retrieving revision 1.27
diff -u -r1.27 ioports.c
--- msdos/ioports.c 2001/08/15 23:19:45 1.27
+++ msdos/ioports.c 2001/11/08 02:43:39
@@ -37,9 +37,9 @@
BYTE ctrlbyte_ch;
WORD oldval;
} tmr_8253[3] = {
- {0xFFFF, FALSE, 0, FALSE, 0x06, 0},
- {0x0012, FALSE, 0, FALSE, 0x44, 0},
- {0x0001, FALSE, 0, FALSE, 0x86, 0},
+ {0xFFFF, FALSE, 0, FALSE, 0x36, 0},
+ {0x0012, FALSE, 0, FALSE, 0x74, 0},
+ {0x0001, FALSE, 0, FALSE, 0xB6, 0},
};
static int dummy_ctr = 0;
@@ -345,7 +345,7 @@
}
break;
case 0x60:
- res = INT_Int09ReadScan(NULL);
+ res = Dosvm.KbdReadScan ? Dosvm.KbdReadScan(NULL) : 0;
#if 0 /* what's this port got to do with parport ? */
res = (DWORD)parport_8255[0];
#endif
--- /dev/null Fri Nov 2 06:03:16 2001
+++ dlls/winedos/int09.c Tue Dec 26 09:03:22 2000
@@ -0,0 +1,94 @@
+/*
+ * DOS interrupt 09h handler (IRQ1 - KEYBOARD)
+ */
+
+#include <stdlib.h>
+#include <string.h>
+
+#include "windef.h"
+#include "winbase.h"
+#include "wingdi.h"
+#include "winuser.h"
+#include "miscemu.h"
+#include "debugtools.h"
+#include "callback.h"
+#include "dosexe.h"
+
+DEFAULT_DEBUG_CHANNEL(int);
+
+#define QUEUELEN 31
+
+static struct
+{
+ BYTE queuelen,queue[QUEUELEN],ascii[QUEUELEN];
+} kbdinfo;
+
+
+/**********************************************************************
+ * INT_Int09Handler
+ *
+ * Handler for int 09h.
+ */
+void WINAPI INT_Int09Handler( CONTEXT86 *context )
+{
+ BYTE ascii, scan = INT_Int09ReadScan(&ascii);
+ BYTE ch[2];
+ int cnt, c2;
+
+ TRACE("scan=%02x\n",scan);
+ if (!(scan & 0x80)) {
+ if (ascii) {
+ /* we already have an ASCII code, no translation necessary */
+ ch[0] = ascii;
+ cnt = 1;
+ } else {
+ UINT vkey = MapVirtualKeyA(scan&0x7f, 1);
+ BYTE keystate[256];
+ GetKeyboardState(keystate);
+ cnt = ToAscii(vkey, scan, keystate, (LPWORD)ch, 0);
+ }
+ if (cnt>0) {
+ for (c2=0; c2<cnt; c2++)
+ INT_Int16AddChar(ch[c2], scan);
+ } else
+ if (cnt==0) {
+ /* FIXME: need to handle things like shift-F-keys,
+ * 0xE0 extended keys, etc */
+ INT_Int16AddChar(0, scan);
+ }
+ }
+ Dosvm.OutPIC(0x20, 0x20); /* send EOI */
+}
+
+static void KbdRelay( CONTEXT86 *context, void *data )
+{
+ if (kbdinfo.queuelen) {
+ /* cleanup operation, called from Dosvm.OutPIC:
+ * we'll remove current scancode from keyboard buffer here,
+ * rather than in ReadScan, because some DOS apps depend on
+ * the scancode being available for reading multiple times... */
+ if (--kbdinfo.queuelen) {
+ memmove(kbdinfo.queue,kbdinfo.queue+1,kbdinfo.queuelen);
+ memmove(kbdinfo.ascii,kbdinfo.ascii+1,kbdinfo.queuelen);
+ }
+ }
+}
+
+void WINAPI INT_Int09SendScan( BYTE scan, BYTE ascii )
+{
+ if (kbdinfo.queuelen == QUEUELEN) {
+ ERR("keyboard queue overflow\n");
+ return;
+ }
+ /* add scancode to queue */
+ kbdinfo.queue[kbdinfo.queuelen] = scan;
+ kbdinfo.ascii[kbdinfo.queuelen++] = ascii;
+ /* tell app to read it by triggering IRQ 1 (int 09) */
+ Dosvm.QueueEvent(1,DOS_PRIORITY_KEYBOARD,KbdRelay,NULL);
+}
+
+BYTE WINAPI INT_Int09ReadScan( BYTE*ascii )
+{
+ if (ascii) *ascii = kbdinfo.ascii[0];
+ return kbdinfo.queue[0];
+}
--- msdos/int09.c Thu Dec 28 15:18:26 2000
+++ /dev/null Fri Nov 2 06:03:16 2001
@@ -1,97 +0,0 @@
-/*
- * DOS interrupt 09h handler (IRQ1 - KEYBOARD)
- */
-
-#include <stdlib.h>
-#include <string.h>
-
-#include "windef.h"
-#include "winbase.h"
-#include "wingdi.h"
-#include "winuser.h"
-#include "miscemu.h"
-#include "debugtools.h"
-#include "callback.h"
-#include "dosexe.h"
-
-DEFAULT_DEBUG_CHANNEL(int);
-
-#define QUEUELEN 31
-
-static struct
-{
- BYTE queuelen,queue[QUEUELEN],ascii[QUEUELEN];
-} kbdinfo;
-
-
-/**********************************************************************
- * INT_Int09Handler
- *
- * Handler for int 09h.
- */
-void WINAPI INT_Int09Handler( CONTEXT86 *context )
-{
- BYTE ascii, scan = INT_Int09ReadScan(&ascii);
- BYTE ch[2];
- int cnt, c2;
-
- TRACE("scan=%02x\n",scan);
- if (!(scan & 0x80)) {
- if (ascii) {
- /* we already have an ASCII code, no translation necessary */
- ch[0] = ascii;
- cnt = 1;
- } else {
-#if 0 /* FIXME: cannot call USER functions here */
- UINT vkey = MapVirtualKeyA(scan&0x7f, 1);
- /* as in TranslateMessage, windows/input.c */
- cnt = ToAscii(vkey, scan, QueueKeyStateTable, (LPWORD)ch, 0);
-#else
- cnt = 0;
-#endif
- }
- if (cnt>0) {
- for (c2=0; c2<cnt; c2++)
- INT_Int16AddChar(ch[c2], scan);
- } else
- if (cnt==0) {
- /* FIXME: need to handle things like shift-F-keys,
- * 0xE0 extended keys, etc */
- INT_Int16AddChar(0, scan);
- }
- }
- Dosvm.OutPIC(0x20, 0x20); /* send EOI */
-}
-
-static void KbdRelay( CONTEXT86 *context, void *data )
-{
- if (kbdinfo.queuelen) {
- /* cleanup operation, called from Dosvm.OutPIC:
- * we'll remove current scancode from keyboard buffer here,
- * rather than in ReadScan, because some DOS apps depend on
- * the scancode being available for reading multiple times... */
- if (--kbdinfo.queuelen) {
- memmove(kbdinfo.queue,kbdinfo.queue+1,kbdinfo.queuelen);
- memmove(kbdinfo.ascii,kbdinfo.ascii+1,kbdinfo.queuelen);
- }
- }
-}
-
-void WINAPI INT_Int09SendScan( BYTE scan, BYTE ascii )
-{
- if (kbdinfo.queuelen == QUEUELEN) {
- ERR("keyboard queue overflow\n");
- return;
- }
- /* add scancode to queue */
- kbdinfo.queue[kbdinfo.queuelen] = scan;
- kbdinfo.ascii[kbdinfo.queuelen++] = ascii;
- /* tell app to read it by triggering IRQ 1 (int 09) */
- Dosvm.QueueEvent(1,DOS_PRIORITY_KEYBOARD,KbdRelay,NULL);
-}
-
-BYTE WINAPI INT_Int09ReadScan( BYTE*ascii )
-{
- if (ascii) *ascii = kbdinfo.ascii[0];
- return kbdinfo.queue[0];
-}
More information about the wine-patches
mailing list