Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
wine
Manage
Activity
Members
Labels
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Package registry
Container Registry
Model registry
Operate
Terraform modules
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Yoann Laissus
wine
Commits
bb7f0de7
Commit
bb7f0de7
authored
26 years ago
by
Ove Kåven
Committed by
Alexandre Julliard
26 years ago
Browse files
Options
Downloads
Patches
Plain Diff
Implemented a int 0x09 handler, and a scancode queue that simulates
IRQ 1 in the dos box.
parent
384a8944
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
msdos/int09.c
+72
-0
72 additions, 0 deletions
msdos/int09.c
with
72 additions
and
0 deletions
msdos/int09.c
0 → 100644
+
72
−
0
View file @
bb7f0de7
/*
* DOS interrupt 09h handler (IRQ1 - KEYBOARD)
*/
#include
<stdlib.h>
#include
"winuser.h"
#include
"miscemu.h"
#include
"input.h"
#include
"debug.h"
#include
"dosexe.h"
typedef
struct
{
BYTE
queuelen
,
queue
[
15
];
}
KBDSYSTEM
;
/**********************************************************************
* INT_Int09Handler
*
* Handler for int 09h.
*/
void
WINAPI
INT_Int09Handler
(
CONTEXT
*
context
)
{
BYTE
scan
=
INT_Int09ReadScan
();
UINT
vkey
=
MapVirtualKeyA
(
scan
&
0x7f
,
1
);
BYTE
ch
[
2
];
int
cnt
;
if
(
!
(
scan
&
0x80
))
{
/* as in TranslateMessage, windows/input.c */
cnt
=
ToAscii
(
vkey
,
scan
&
0x7f
,
QueueKeyStateTable
,
(
LPWORD
)
ch
,
0
);
if
(
cnt
==
1
)
{
FIXME
(
int
,
"enter character %c into console input, not implemented
\n
"
,
ch
[
0
]);
}
}
DOSVM_PIC_ioport_out
(
0x20
,
0x20
);
/* send EOI */
}
static
void
KbdRelay
(
LPDOSTASK
lpDosTask
,
PCONTEXT
context
,
void
*
data
)
{
KBDSYSTEM
*
sys
=
(
KBDSYSTEM
*
)
DOSVM_GetSystemData
(
0x09
);
if
(
sys
&&
sys
->
queuelen
)
{
/* cleanup operation, called from DOSVM_PIC_ioport_out:
* 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
(
--
sys
->
queuelen
)
memmove
(
sys
->
queue
,
sys
->
queue
+
1
,
sys
->
queuelen
);
}
}
void
WINAPI
INT_Int09SendScan
(
BYTE
scan
)
{
KBDSYSTEM
*
sys
=
(
KBDSYSTEM
*
)
DOSVM_GetSystemData
(
0x09
);
if
(
!
sys
)
{
sys
=
calloc
(
1
,
sizeof
(
KBDSYSTEM
));
DOSVM_SetSystemData
(
0x09
,
sys
);
}
/* add scancode to queue */
sys
->
queue
[
sys
->
queuelen
++
]
=
scan
;
/* tell app to read it by triggering IRQ 1 (int 09) */
DOSVM_QueueEvent
(
1
,
DOS_PRIORITY_KEYBOARD
,
KbdRelay
,
NULL
);
}
BYTE
WINAPI
INT_Int09ReadScan
(
void
)
{
KBDSYSTEM
*
sys
=
(
KBDSYSTEM
*
)
DOSVM_GetSystemData
(
0x09
);
if
(
sys
)
return
sys
->
queue
[
0
];
else
return
0
;
}
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment