Added INT_Int16ReadChar and made int09 handle special keys.
This commit is contained in:
parent
c9307edf0c
commit
c956f67f46
|
@ -106,6 +106,13 @@ extern BOOL INSTR_EmulateInstruction( CONTEXT86 *context );
|
|||
|
||||
/* msdos/devices.c */
|
||||
extern void DOSDEV_InstallDOSDevices(void);
|
||||
extern DWORD DOSDEV_Console(void);
|
||||
extern DWORD DOSDEV_FindCharDevice(char*name);
|
||||
extern int DOSDEV_Peek(DWORD dev, BYTE*data);
|
||||
extern int DOSDEV_Read(DWORD dev, DWORD buf, int buflen);
|
||||
extern int DOSDEV_Write(DWORD dev, DWORD buf, int buflen, int verify);
|
||||
extern int DOSDEV_IoctlRead(DWORD dev, DWORD buf, int buflen);
|
||||
extern int DOSDEV_IoctlWrite(DWORD dev, DWORD buf, int buflen);
|
||||
|
||||
/* msdos/interrupts.c */
|
||||
extern FARPROC16 INT_GetPMHandler( BYTE intnum );
|
||||
|
@ -143,6 +150,7 @@ extern void WINAPI INT_Int15Handler(CONTEXT86*);
|
|||
|
||||
/* msdos/int16.c */
|
||||
extern void WINAPI INT_Int16Handler(CONTEXT86*);
|
||||
extern int WINAPI INT_Int16ReadChar(BYTE*ascii,BYTE*scan,BOOL peek);
|
||||
extern int WINAPI INT_Int16AddChar(BYTE ascii,BYTE scan);
|
||||
|
||||
/* msdos/int17.c */
|
||||
|
|
|
@ -28,6 +28,7 @@ void WINAPI INT_Int09Handler( CONTEXT86 *context )
|
|||
BYTE ch[2];
|
||||
int cnt, c2;
|
||||
|
||||
TRACE("scan=%02x\n",scan);
|
||||
if (!(scan & 0x80)) {
|
||||
/* as in TranslateMessage, windows/input.c */
|
||||
cnt = ToAscii(vkey, scan, QueueKeyStateTable, (LPWORD)ch, 0);
|
||||
|
@ -36,8 +37,9 @@ void WINAPI INT_Int09Handler( CONTEXT86 *context )
|
|||
INT_Int16AddChar(ch[c2], scan);
|
||||
} else
|
||||
if (cnt==0) {
|
||||
/* need to handle things like shift-F-keys etc */
|
||||
FIXME("DOS special key translation not implemented\n");
|
||||
/* FIXME: need to handle things like shift-F-keys,
|
||||
* 0xE0 extended keys, etc */
|
||||
INT_Int16AddChar(0, scan);
|
||||
}
|
||||
}
|
||||
DOSVM_PIC_ioport_out(0x20, 0x20); /* send EOI */
|
||||
|
|
|
@ -123,12 +123,40 @@ void WINAPI INT_Int16Handler( CONTEXT86 *context )
|
|||
}
|
||||
}
|
||||
|
||||
int WINAPI INT_Int16ReadChar(BYTE*ascii,BYTE*scan,BOOL peek)
|
||||
{
|
||||
BIOSDATA *data = DOSMEM_BiosData();
|
||||
WORD CurOfs = data->NextKbdCharPtr;
|
||||
|
||||
/* check if there's data in buffer */
|
||||
if (peek) {
|
||||
if (CurOfs == data->FirstKbdCharPtr)
|
||||
return 0;
|
||||
} else {
|
||||
while (CurOfs == data->FirstKbdCharPtr) {
|
||||
/* no input available yet, so wait... */
|
||||
DOSVM_Wait( -1, 0 );
|
||||
}
|
||||
}
|
||||
/* read from keyboard queue */
|
||||
TRACE("(%p,%p,%d) -> %02x %02x\n",ascii,scan,peek,((BYTE*)data)[CurOfs],((BYTE*)data)[CurOfs+1]);
|
||||
if (ascii) *ascii = ((BYTE*)data)[CurOfs];
|
||||
if (scan) *scan = ((BYTE*)data)[CurOfs+1];
|
||||
if (!peek) {
|
||||
CurOfs += 2;
|
||||
if (CurOfs >= data->KbdBufferEnd) CurOfs = data->KbdBufferStart;
|
||||
data->NextKbdCharPtr = CurOfs;
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
||||
int WINAPI INT_Int16AddChar(BYTE ascii,BYTE scan)
|
||||
{
|
||||
BIOSDATA *data = DOSMEM_BiosData();
|
||||
WORD CurOfs = data->FirstKbdCharPtr;
|
||||
WORD NextOfs = CurOfs + 2;
|
||||
|
||||
TRACE("(%02x,%02x)\n",ascii,scan);
|
||||
if (NextOfs >= data->KbdBufferEnd) NextOfs = data->KbdBufferStart;
|
||||
/* check if buffer is full */
|
||||
if (NextOfs == data->NextKbdCharPtr) return 0;
|
||||
|
|
Loading…
Reference in New Issue