Commit 8cd55d0e authored by Alexandre Julliard's avatar Alexandre Julliard

Moved most of the real-mode stuff to dlls/winedos.

parent a5d882dc
......@@ -76,9 +76,6 @@ static BOOL process_attach(void)
/* Force loading of some dlls */
if (LoadLibrary16( "system" ) < 32) return FALSE;
/* Read DOS config.sys */
if (!DOSCONF_ReadConfig()) return FALSE;
/* Create 16-bit task */
TASK_CreateMainTask();
......
......@@ -4,7 +4,6 @@ owner kernel32
# Interrupt vectors 0-255 are ordinals 100-355
# The 'interrupt' keyword takes care of the flags pushed on the stack by the interrupt
116 interrupt INT_Int10Handler() INT_Int10Handler
117 interrupt INT_Int11Handler() INT_Int11Handler
118 interrupt INT_Int12Handler() INT_Int12Handler
119 interrupt INT_Int13Handler() INT_Int13Handler
......
......@@ -28,7 +28,6 @@ C_SRCS = \
wcstring.c
EXTRA_OBJS = \
$(TOPOBJDIR)/console/console.o \
$(TOPOBJDIR)/files/files.o \
$(TOPOBJDIR)/if1632/if1632.o \
$(TOPOBJDIR)/loader/loader.o \
......@@ -42,7 +41,6 @@ EXTRA_OBJS = \
$(TOPOBJDIR)/win32/win32.o
SUBDIRS = \
$(TOPOBJDIR)/console \
$(TOPOBJDIR)/files \
$(TOPOBJDIR)/if1632 \
$(TOPOBJDIR)/loader \
......
name ntdll
type win32
debug_channels (aspi atom cdrom console ddraw debug delayhlp dll dosfs dosmem
file fixup global heap int int10 int16 int17 int19 int21 int31
io loaddll local module ntdll process profile reg relay resource
segment seh selector server snoop string system tape task thread
thunk tid timer toolhelp ver virtual vxd win32)
debug_channels (atom cdrom console debug delayhlp dll dosfs dosmem file fixup
global heap int int21 int31 io loaddll local module ntdll process
profile reg relay resource segment seh selector server snoop
string system tape task thread thunk tid timer toolhelp ver
virtual vxd win32)
#note that the Zw... functions are alternate names for the
#Nt... functions. (see www.sysinternals.com for details)
......
......@@ -7,10 +7,33 @@ SOVERSION = 1.0
IMPORTS = user32 kernel32 ntdll
C_SRCS = \
dosaspi.c \
devices.c \
dosvm.c \
int09.c \
module.c
int10.c \
int16.c \
int17.c \
int19.c \
int20.c \
int21.c \
int29.c \
int31.c \
int33.c \
ioports.c \
module.c \
vga.c \
xms.c
EXTRA_OBJS = \
$(TOPOBJDIR)/console/console.o
SUBDIRS = \
$(TOPOBJDIR)/console
@MAKE_DLL_RULES@
$(EXTRA_OBJS): dummy
@cd `dirname $@` && $(MAKE) `basename $@`
### Dependencies:
......@@ -10,7 +10,6 @@
#include "msdos.h"
#include "miscemu.h"
#include "dosexe.h"
#include "callback.h"
#include "debugtools.h"
#include "pshpack1.h"
......@@ -107,7 +106,6 @@ typedef struct
WORD attr;
RMCBPROC strategy;
RMCBPROC interrupt;
} WINEDEV;
static WINEDEV devs[] =
......@@ -136,7 +134,11 @@ typedef struct
#define DOS_DATASEG_OFF(xxx) FIELD_OFFSET(DOS_DATASEG, xxx)
DWORD DOS_LOLSeg;
struct _DOS_LISTOFLISTS * DOSMEM_LOL()
{
return (struct _DOS_LISTOFLISTS *)DOSMEM_MapRealToLinear
(MAKESEGPTR(HIWORD(DOS_LOLSeg),0));
}
/* the device implementations */
......@@ -265,7 +267,7 @@ static void WINAPI con_interrupt(CONTEXT86*ctx)
/* check for new keyboard input */
while (CurOfs == bios->FirstKbdCharPtr) {
/* no input available yet, so wait... */
Dosvm.Wait( -1, 0 );
DOSVM_Wait( -1, 0 );
}
/* read from keyboard queue (call int16?) */
data = ((WORD*)bios)[CurOfs];
......@@ -284,7 +286,7 @@ static void WINAPI con_interrupt(CONTEXT86*ctx)
/* check for new keyboard input */
while (CurOfs == bios->FirstKbdCharPtr) {
/* no input available yet, so wait... */
Dosvm.Wait( -1, 0 );
DOSVM_Wait( -1, 0 );
}
/* read from keyboard queue (call int16?) */
data = ((WORD*)bios)[CurOfs];
......
......@@ -167,8 +167,12 @@ void WINAPI ASPI_DOS_func(CONTEXT86 *context)
}
/* returns the address of a real mode callback to ASPI_DOS_func() */
void ASPI_DOS_HandleInt(CONTEXT86 *context)
/**********************************************************************
* DOSVM_ASPIHandler (WINEDOS.@)
*
* returns the address of a real mode callback to ASPI_DOS_func()
*/
void WINAPI DOSVM_ASPIHandler( CONTEXT86 *context )
{
FARPROC16 *p = (FARPROC16 *)CTX_SEG_OFF_TO_LIN(context, context->SegDs, context->Edx);
TRACE("DOS ASPI opening\n");
......
......@@ -7,7 +7,7 @@
#ifndef __WINE_DOSEXE_H
#define __WINE_DOSEXE_H
#include <sys/types.h> /* pid_t */
#include "wine/windef16.h"
#include "winbase.h" /* for LPSTARTUPINFO32A */
#include "winnt.h" /* for PCONTEXT */
......@@ -15,17 +15,15 @@ struct _DOSEVENT;
typedef void (*DOSRELAY)(CONTEXT86*,void*);
typedef struct _DOSTASK {
WORD psp_seg, retval;
WORD dpmi_flag;
} DOSTASK, *LPDOSTASK;
#define DOS_PRIORITY_REALTIME 0 /* IRQ0 */
#define DOS_PRIORITY_KEYBOARD 1 /* IRQ1 */
#define DOS_PRIORITY_VGA 2 /* IRQ9 */
#define DOS_PRIORITY_MOUSE 5 /* IRQ12 */
#define DOS_PRIORITY_SERIAL 10 /* IRQ4 */
extern WORD DOSVM_psp; /* psp of current DOS task */
extern WORD DOSVM_retval; /* return value of previous DOS task */
#if defined(linux) && defined(__i386__)
#define MZ_SUPPORTED
#endif /* linux-i386 */
......@@ -35,8 +33,8 @@ typedef struct _DOSTASK {
extern void WINAPI MZ_LoadImage( LPCSTR filename, HANDLE hFile );
extern BOOL WINAPI MZ_Exec( CONTEXT86 *context, LPCSTR filename, BYTE func, LPVOID paramblk );
extern void WINAPI MZ_Exit( CONTEXT86 *context, BOOL cs_psp, WORD retval );
extern LPDOSTASK WINAPI MZ_Current( void );
extern LPDOSTASK WINAPI MZ_AllocDPMITask( void );
extern BOOL WINAPI MZ_Current( void );
extern void WINAPI MZ_AllocDPMITask( void );
extern void WINAPI MZ_RunInThread( PAPCFUNC proc, ULONG_PTR arg );
extern INT WINAPI DOSVM_Enter( CONTEXT86 *context );
extern void WINAPI DOSVM_Wait( INT read_pipe, HANDLE hObject );
......@@ -45,5 +43,56 @@ extern void WINAPI DOSVM_QueueEvent( INT irq, INT priority, DOSRELAY relay, LPVO
extern void WINAPI DOSVM_PIC_ioport_out( WORD port, BYTE val );
extern void WINAPI DOSVM_SetTimer( UINT ticks );
extern UINT WINAPI DOSVM_GetTimer( void );
extern FARPROC16 DOSVM_GetRMHandler( BYTE intnum );
extern void DOSVM_SetRMHandler( BYTE intnum, FARPROC16 handler );
extern void DOSVM_RealModeInterrupt( BYTE intnum, CONTEXT86 *context );
/* 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);
/* int09.c */
extern void WINAPI DOSVM_Int09Handler(CONTEXT86*);
extern void WINAPI DOSVM_Int09SendScan(BYTE scan,BYTE ascii);
extern BYTE WINAPI DOSVM_Int09ReadScan(BYTE*ascii);
/* int10.c */
extern void WINAPI DOSVM_Int10Handler(CONTEXT86*);
/* int16.c */
extern void WINAPI DOSVM_Int16Handler(CONTEXT86*);
extern int WINAPI DOSVM_Int16ReadChar(BYTE*ascii,BYTE*scan,BOOL peek);
extern int WINAPI DOSVM_Int16AddChar(BYTE ascii,BYTE scan);
/* int17.c */
extern void WINAPI DOSVM_Int17Handler(CONTEXT86*);
/* int19.c */
extern void WINAPI DOSVM_Int19Handler(CONTEXT86*);
/* int20.c */
extern void WINAPI DOSVM_Int20Handler(CONTEXT86*);
/* int21.c */
extern void WINAPI DOSVM_Int21Handler(CONTEXT86*);
/* int29.c */
extern void WINAPI DOSVM_Int29Handler(CONTEXT86*);
/* int31.c */
extern void WINAPI DOSVM_Int31Handler(CONTEXT86*);
/* int33.c */
extern void WINAPI DOSVM_Int33Handler(CONTEXT86*);
extern void WINAPI DOSVM_Int33Message(UINT,WPARAM,LPARAM);
/* xms.c */
extern void WINAPI XMS_Handler(CONTEXT86*);
#endif /* __WINE_DOSEXE_H */
......@@ -11,7 +11,6 @@
#include "winuser.h"
#include "miscemu.h"
#include "debugtools.h"
#include "callback.h"
#include "dosexe.h"
DEFAULT_DEBUG_CHANNEL(int);
......@@ -25,13 +24,13 @@ static struct
/**********************************************************************
* INT_Int09Handler
* DOSVM_Int09Handler
*
* Handler for int 09h.
*/
void WINAPI INT_Int09Handler( CONTEXT86 *context )
void WINAPI DOSVM_Int09Handler( CONTEXT86 *context )
{
BYTE ascii, scan = INT_Int09ReadScan(&ascii);
BYTE ascii, scan = DOSVM_Int09ReadScan(&ascii);
BYTE ch[2];
int cnt, c2;
......@@ -49,21 +48,21 @@ void WINAPI INT_Int09Handler( CONTEXT86 *context )
}
if (cnt>0) {
for (c2=0; c2<cnt; c2++)
INT_Int16AddChar(ch[c2], scan);
DOSVM_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_Int16AddChar(0, scan);
}
}
Dosvm.OutPIC(0x20, 0x20); /* send EOI */
DOSVM_PIC_ioport_out( 0x20, 0x20 ); /* send EOI */
}
static void KbdRelay( CONTEXT86 *context, void *data )
{
if (kbdinfo.queuelen) {
/* cleanup operation, called from Dosvm.OutPIC:
/* 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... */
......@@ -74,7 +73,7 @@ static void KbdRelay( CONTEXT86 *context, void *data )
}
}
void WINAPI INT_Int09SendScan( BYTE scan, BYTE ascii )
void WINAPI DOSVM_Int09SendScan( BYTE scan, BYTE ascii )
{
if (kbdinfo.queuelen == QUEUELEN) {
ERR("keyboard queue overflow\n");
......@@ -84,13 +83,13 @@ void WINAPI INT_Int09SendScan( BYTE scan, BYTE ascii )
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);
DOSVM_QueueEvent(1,DOS_PRIORITY_KEYBOARD,KbdRelay,NULL);
}
/**********************************************************************
* KbdReadScan (WINEDOS.@)
*/
BYTE WINAPI INT_Int09ReadScan( BYTE*ascii )
BYTE WINAPI DOSVM_Int09ReadScan( BYTE*ascii )
{
if (ascii) *ascii = kbdinfo.ascii[0];
return kbdinfo.queue[0];
......
......@@ -11,7 +11,7 @@
#include "debugtools.h"
#include "console.h"
DEFAULT_DEBUG_CHANNEL(int10);
DEFAULT_DEBUG_CHANNEL(int);
static void conv_text_mode_attributes(char attribute, int *fg, int *bg,
int *wattribute);
......@@ -37,7 +37,7 @@ static void BIOS_SetCursorPos(BIOSDATA*data,unsigned page,unsigned X,unsigned Y)
}
/**********************************************************************
* INT_Int10Handler (WPROCS.116)
* DOSVM_Int10Handler (WPROCS.116)
*
* Handler for int 10h (video).
*
......@@ -70,7 +70,7 @@ static void BIOS_SetCursorPos(BIOSDATA*data,unsigned page,unsigned X,unsigned Y)
* Added additional vga graphic support - 3/99
*/
void WINAPI INT_Int10Handler( CONTEXT86 *context )
void WINAPI DOSVM_Int10Handler( CONTEXT86 *context )
{
static int registered_colors = FALSE;
BIOSDATA *data = DOSMEM_BiosData();
......
......@@ -9,7 +9,6 @@
#include <unistd.h>
#include "module.h"
#include "callback.h"
#include "dosexe.h"
#include "wincon.h"
#include "debugtools.h"
......@@ -18,10 +17,10 @@
#include "winuser.h"
#include "miscemu.h"
DEFAULT_DEBUG_CHANNEL(int16);
DEFAULT_DEBUG_CHANNEL(int);
/**********************************************************************
* INT_Int16Handler
* DOSVM_Int16Handler
*
* Handler for int 16h (keyboard)
*
......@@ -31,15 +30,15 @@ DEFAULT_DEBUG_CHANNEL(int16);
* not currently listed here.
*/
void WINAPI INT_Int16Handler( CONTEXT86 *context )
void WINAPI DOSVM_Int16Handler( CONTEXT86 *context )
{
switch AH_reg(context) {
case 0x00: /* Get Keystroke */
/* Returns: AH = Scan code
AL = ASCII character */
AL = ASCII character */
TRACE("Get Keystroke\n");
INT_Int16ReadChar(&AL_reg(context), &AH_reg(context), FALSE);
DOSVM_Int16ReadChar(&AL_reg(context), &AH_reg(context), FALSE);
break;
case 0x01: /* Check for Keystroke */
......@@ -47,7 +46,7 @@ void WINAPI INT_Int16Handler( CONTEXT86 *context )
/* AH = Scan code */
/* AL = ASCII character */
TRACE("Check for Keystroke\n");
if (!INT_Int16ReadChar(&AL_reg(context), &AH_reg(context), TRUE))
if (!DOSVM_Int16ReadChar(&AL_reg(context), &AH_reg(context), TRUE))
{
SET_ZFLAG(context);
}
......@@ -57,10 +56,9 @@ void WINAPI INT_Int16Handler( CONTEXT86 *context )
}
break;
case 0x02: /* Get Shift Flags */
case 0x02: /* Get Shift Flags */
AL_reg(context) = 0;
#if 0 /* FIXME: cannot call USER functions here */
if (GetAsyncKeyState(VK_RSHIFT))
AL_reg(context) |= 0x01;
if (GetAsyncKeyState(VK_LSHIFT))
......@@ -77,7 +75,6 @@ void WINAPI INT_Int16Handler( CONTEXT86 *context )
AL_reg(context) |= 0x40;
if (GetAsyncKeyState(VK_INSERT))
AL_reg(context) |= 0x80;
#endif
TRACE("Get Shift Flags: returning 0x%02x\n", AL_reg(context));
break;
......@@ -98,17 +95,17 @@ void WINAPI INT_Int16Handler( CONTEXT86 *context )
case 0x10: /* Get Enhanced Keystroke */
TRACE("Get Enhanced Keystroke - Partially supported\n");
/* Returns: AH = Scan code
AL = ASCII character */
INT_Int16ReadChar(&AL_reg(context), &AH_reg(context), FALSE);
AL = ASCII character */
DOSVM_Int16ReadChar(&AL_reg(context), &AH_reg(context), FALSE);
break;
case 0x11: /* Check for Enhanced Keystroke */
/* Returns: ZF set if no keystroke */
/* AH = Scan code */
/* AL = ASCII character */
TRACE("Check for Enhanced Keystroke - Partially supported\n");
if (!INT_Int16ReadChar(&AL_reg(context), &AH_reg(context), TRUE))
if (!DOSVM_Int16ReadChar(&AL_reg(context), &AH_reg(context), TRUE))
{
SET_ZFLAG(context);
}
......@@ -121,15 +118,15 @@ void WINAPI INT_Int16Handler( CONTEXT86 *context )
case 0x12: /* Get Extended Shift States */
FIXME("Get Extended Shift States - Not Supported\n");
break;
default:
FIXME("Unknown INT 16 function - 0x%x\n", AH_reg(context));
FIXME("Unknown INT 16 function - 0x%x\n", AH_reg(context));
break;
}
}
int WINAPI INT_Int16ReadChar(BYTE*ascii,BYTE*scan,BOOL peek)
int WINAPI DOSVM_Int16ReadChar(BYTE*ascii,BYTE*scan,BOOL peek)
{
BIOSDATA *data = DOSMEM_BiosData();
WORD CurOfs = data->NextKbdCharPtr;
......@@ -141,7 +138,7 @@ int WINAPI INT_Int16ReadChar(BYTE*ascii,BYTE*scan,BOOL peek)
} else {
while (CurOfs == data->FirstKbdCharPtr) {
/* no input available yet, so wait... */
Dosvm.Wait( -1, 0 );
DOSVM_Wait( -1, 0 );
}
}
/* read from keyboard queue */
......@@ -156,7 +153,7 @@ int WINAPI INT_Int16ReadChar(BYTE*ascii,BYTE*scan,BOOL peek)
return 1;
}
int WINAPI INT_Int16AddChar(BYTE ascii,BYTE scan)
int WINAPI DOSVM_Int16AddChar(BYTE ascii,BYTE scan)
{
BIOSDATA *data = DOSMEM_BiosData();
WORD CurOfs = data->FirstKbdCharPtr;
......
......@@ -9,14 +9,14 @@
#include "msdos.h"
#include "winnt.h"
DEFAULT_DEBUG_CHANNEL(int17);
DEFAULT_DEBUG_CHANNEL(int);
/**********************************************************************
* INT_Int17Handler
* DOSVM_Int17Handler
*
* Handler for int 17h (printer - output character).
*/
void WINAPI INT_Int17Handler( CONTEXT86 *context )
void WINAPI DOSVM_Int17Handler( CONTEXT86 *context )
{
switch( AH_reg(context) )
{
......
......@@ -6,15 +6,15 @@
#include "miscemu.h"
#include "debugtools.h"
DEFAULT_DEBUG_CHANNEL(int19);
DEFAULT_DEBUG_CHANNEL(int);
/**********************************************************************
* INT_Int19Handler
* DOSVM_Int19Handler
*
* Handler for int 19h (Reboot).
*/
void WINAPI INT_Int19Handler( CONTEXT86 *context )
void WINAPI DOSVM_Int19Handler( CONTEXT86 *context )
{
WARN("Attempted Reboot\n");
}
/*
* DOS interrupt 20h handler (TERMINATE PROGRAM)
*/
#include <stdlib.h>
#include "winbase.h"
#include "dosexe.h"
#include "miscemu.h"
/**********************************************************************
* DOSVM_Int20Handler
*
* Handler for int 20h.
*/
void WINAPI DOSVM_Int20Handler( CONTEXT86 *context )
{
MZ_Exit( context, TRUE, 0 );
}
/*
* DOS interrupt 21h handler
*/
#include "config.h"
#include "windef.h"
#include "winbase.h"
#include "ntddk.h"
#include "wine/winbase16.h"
#include "dosexe.h"
#include "miscemu.h"
#include "msdos.h"
#include "console.h"
#include "debugtools.h"
DEFAULT_DEBUG_CHANNEL(int21);
/***********************************************************************
* DOSVM_Int21Handler
*
* int 21h real-mode handler. Most calls are passed directly to DOS3Call.
*/
void WINAPI DOSVM_Int21Handler( CONTEXT86 *context )
{
RESET_CFLAG(context); /* Not sure if this is a good idea */
switch(AH_reg(context))
{
case 0x00: /* TERMINATE PROGRAM */
TRACE("TERMINATE PROGRAM\n");
MZ_Exit( context, FALSE, 0 );
break;
case 0x01: /* READ CHARACTER FROM STANDARD INPUT, WITH ECHO */
TRACE("DIRECT CHARACTER INPUT WITH ECHO\n");
AL_reg(context) = CONSOLE_GetCharacter();
/* FIXME: no echo */
break;
case 0x02: /* WRITE CHARACTER TO STANDARD OUTPUT */
TRACE("Write Character to Standard Output\n");
CONSOLE_Write(DL_reg(context), 0, 0, 0);
break;
case 0x06: /* DIRECT CONSOLE IN/OUTPUT */
/* FIXME: Use DOSDEV_Peek/Read/Write(DOSDEV_Console(),...) !! */
if (DL_reg(context) == 0xff) {
static char scan = 0;
TRACE("Direct Console Input\n");
if (scan) {
/* return pending scancode */
AL_reg(context) = scan;
RESET_ZFLAG(context);
scan = 0;
} else {
char ascii;
if (DOSVM_Int16ReadChar(&ascii,&scan,TRUE)) {
DOSVM_Int16ReadChar(&ascii,&scan,FALSE);
/* return ASCII code */
AL_reg(context) = ascii;
RESET_ZFLAG(context);
/* return scan code on next call only if ascii==0 */
if (ascii) scan = 0;
} else {
/* nothing pending, clear everything */
AL_reg(context) = 0;
SET_ZFLAG(context);
scan = 0; /* just in case */
}
}
} else {
TRACE("Direct Console Output\n");
CONSOLE_Write(DL_reg(context), 0, 0, 0);
}
break;
case 0x07: /* DIRECT CHARACTER INPUT WITHOUT ECHO */
/* FIXME: Use DOSDEV_Peek/Read(DOSDEV_Console(),...) !! */
TRACE("DIRECT CHARACTER INPUT WITHOUT ECHO\n");
DOSVM_Int16ReadChar(&AL_reg(context), NULL, FALSE);
break;
case 0x08: /* CHARACTER INPUT WITHOUT ECHO */
/* FIXME: Use DOSDEV_Peek/Read(DOSDEV_Console(),...) !! */
TRACE("CHARACTER INPUT WITHOUT ECHO\n");
DOSVM_Int16ReadChar(&AL_reg(context), NULL, FALSE);
break;
case 0x0b: /* GET STDIN STATUS */
{
char x1,x2;
if (CONSOLE_CheckForKeystroke(&x1,&x2))
AL_reg(context) = 0xff;
else
AL_reg(context) = 0;
}
break;
case 0x25: /* SET INTERRUPT VECTOR */
DOSVM_SetRMHandler( AL_reg(context),
(FARPROC16)MAKESEGPTR( context->SegDs, DX_reg(context)));
break;
case 0x35: /* GET INTERRUPT VECTOR */
TRACE("GET INTERRUPT VECTOR 0x%02x\n",AL_reg(context));
{
FARPROC16 addr = DOSVM_GetRMHandler( AL_reg(context) );
context->SegEs = SELECTOROF(addr);
BX_reg(context) = OFFSETOF(addr);
}
break;
case 0x44: /* IOCTL */
switch (AL_reg(context))
{
case 0x0b: /* SET SHARING RETRY COUNT */
TRACE("IOCTL - SET SHARING RETRY COUNT pause %d retries %d\n",
CX_reg(context), DX_reg(context));
if (!CX_reg(context))
{
AX_reg(context) = 1;
SET_CFLAG(context);
break;
}
DOSMEM_LOL()->sharing_retry_delay = CX_reg(context);
if (!DX_reg(context))
DOSMEM_LOL()->sharing_retry_count = DX_reg(context);
RESET_CFLAG(context);
break;
}
break;
case 0x4b: /* "EXEC" - LOAD AND/OR EXECUTE PROGRAM */
TRACE("EXEC %s\n", (LPCSTR)CTX_SEG_OFF_TO_LIN(context, context->SegDs, context->Edx ));
if (!MZ_Exec( context, CTX_SEG_OFF_TO_LIN(context, context->SegDs, context->Edx),
AL_reg(context), CTX_SEG_OFF_TO_LIN(context, context->SegEs, context->Ebx) ))
{
AX_reg(context) = GetLastError();
SET_CFLAG(context);
}
break;
case 0x4c: /* "EXIT" - TERMINATE WITH RETURN CODE */
TRACE("EXIT with return code %d\n",AL_reg(context));
MZ_Exit( context, FALSE, AL_reg(context) );
break;
case 0x4d: /* GET RETURN CODE */
TRACE("GET RETURN CODE (ERRORLEVEL)\n");
AX_reg(context) = DOSVM_retval;
DOSVM_retval = 0;
break;
case 0x50: /* SET CURRENT PROCESS ID (SET PSP ADDRESS) */
TRACE("SET CURRENT PROCESS ID (SET PSP ADDRESS)\n");
DOSVM_psp = BX_reg(context);
break;
case 0x51: /* GET PSP ADDRESS */
TRACE("GET CURRENT PROCESS ID (GET PSP ADDRESS)\n");
/* FIXME: should we return the original DOS PSP upon */
/* Windows startup ? */
BX_reg(context) = DOSVM_psp;
break;
case 0x52: /* "SYSVARS" - GET LIST OF LISTS */
TRACE("SYSVARS - GET LIST OF LISTS\n");
{
context->SegEs = HIWORD(DOS_LOLSeg);
BX_reg(context) = FIELD_OFFSET(DOS_LISTOFLISTS, ptr_first_DPB);
}
break;
case 0x62: /* GET PSP ADDRESS */
TRACE("GET CURRENT PSP ADDRESS\n");
/* FIXME: should we return the original DOS PSP upon */
/* Windows startup ? */
BX_reg(context) = DOSVM_psp;
break;
default:
DOS3Call( context );
}
}
......@@ -10,11 +10,11 @@
#include "miscemu.h"
/**********************************************************************
* INT_Int29Handler
* DOSVM_Int29Handler
*
* Handler for int 29h (fast console output)
*/
void WINAPI INT_Int29Handler( CONTEXT86 *context )
void WINAPI DOSVM_Int29Handler( CONTEXT86 *context )
{
/* Yes, it seems that this is really all this interrupt does. */
CONSOLE_Write(AL_reg(context), 0, 0, 0);
......
......@@ -10,7 +10,6 @@
#include "wingdi.h"
#include "winuser.h"
#include "miscemu.h"
#include "callback.h"
#include "dosexe.h"
#include "vga.h"
#include "debugtools.h"
......@@ -25,11 +24,11 @@ static struct
} mouse_info;
/**********************************************************************
* INT_Int33Handler
* DOSVM_Int33Handler
*
* Handler for int 33h (MS MOUSE).
*/
void WINAPI INT_Int33Handler( CONTEXT86 *context )
void WINAPI DOSVM_Int33Handler( CONTEXT86 *context )
{
switch (LOWORD(context->Eax)) {
case 0x00:
......@@ -100,7 +99,7 @@ static void MouseRelay(CONTEXT86 *context,void *mdata)
DPMI_CallRMProc(&ctx, NULL, 0, 0);
}
void WINAPI INT_Int33Message(UINT message,WPARAM wParam,LPARAM lParam)
void WINAPI DOSVM_Int33Message(UINT message,WPARAM wParam,LPARAM lParam)
{
WORD mask = 0;
unsigned Height, Width, SX=1, SY=1;
......@@ -152,6 +151,6 @@ void WINAPI INT_Int33Message(UINT message,WPARAM wParam,LPARAM lParam)
data->but = mouse_info.but;
data->x = mouse_info.x;
data->y = mouse_info.y;
Dosvm.QueueEvent(-1, DOS_PRIORITY_MOUSE, MouseRelay, data);
DOSVM_QueueEvent(-1, DOS_PRIORITY_MOUSE, MouseRelay, data);
}
}
/*
* Emulation of processor ioports.
*
* Copyright 1995 Morten Welinder
* Copyright 1998 Andreas Mohr, Ove Kaaven
*/
#include "config.h"
#include "windef.h"
#include "dosexe.h"
#include "vga.h"
/**********************************************************************
* DOSVM_inport
*/
BOOL WINAPI DOSVM_inport( int port, int size, DWORD *res )
{
switch (port)
{
case 0x60:
*res = DOSVM_Int09ReadScan(NULL);
break;
case 0x3ba:
case 0x3da:
*res = (DWORD)VGA_ioport_in( port );
break;
default:
return FALSE; /* not handled */
}
return TRUE; /* handled */
}
/**********************************************************************
* DOSVM_outport
*/
BOOL WINAPI DOSVM_outport( int port, int size, DWORD value )
{
switch (port)
{
case 0x20:
DOSVM_PIC_ioport_out( port, (BYTE)value );
break;
case 0x3c8:
case 0x3c9:
VGA_ioport_out( port, (BYTE)value );
break;
default:
return FALSE; /* not handled */
}
return TRUE; /* handled */
}
......@@ -11,7 +11,7 @@
#include "winuser.h"
#include "wincon.h"
#include "miscemu.h"
#include "callback.h"
#include "dosexe.h"
#include "vga.h"
#include "ddraw.h"
#include "services.h"
......@@ -29,9 +29,6 @@ static HANDLE poll_timer;
typedef HRESULT WINAPI (*DirectDrawCreateProc)(LPGUID,LPDIRECTDRAW *,LPUNKNOWN);
static DirectDrawCreateProc pDirectDrawCreate;
typedef HWND WINAPI (*CreateWindowExAProc)(DWORD,LPCSTR,LPCSTR,DWORD,INT,INT, INT,INT,HWND,HMENU,HINSTANCE,LPVOID);
static CreateWindowExAProc pCreateWindowExA;
static PALETTEENTRY vga_def_palette[256]={
/* red green blue */
{0x00, 0x00, 0x00}, /* 0 - Black */
......@@ -105,25 +102,12 @@ static void WINAPI VGA_DoSetMode(ULONG_PTR arg)
return;
}
}
if (!pCreateWindowExA)
{
HMODULE hmod = LoadLibraryA( "user32.dll" );
if (!hmod) {
ERR("Can't load user32.dll.\n");
return;
}
if (hmod) pCreateWindowExA = (CreateWindowExAProc)GetProcAddress( hmod, "CreateWindowExA" );
if (!pCreateWindowExA) {
ERR("Can't lookup CreateWindowExA from user32.dll.\n");
return;
}
}
res = pDirectDrawCreate(NULL,&lpddraw,NULL);
if (!lpddraw) {
ERR("DirectDraw is not available (res = %lx)\n",res);
return;
}
hwnd = pCreateWindowExA(0,"STATIC","WINEDOS VGA",WS_POPUP|WS_BORDER|WS_CAPTION|WS_SYSMENU,0,0,par->Xres,par->Yres,0,0,0,NULL);
hwnd = CreateWindowExA(0,"STATIC","WINEDOS VGA",WS_POPUP|WS_BORDER|WS_CAPTION|WS_SYSMENU,0,0,par->Xres,par->Yres,0,0,0,NULL);
if (!hwnd) {
ERR("Failed to create user window.\n");
}
......@@ -174,8 +158,7 @@ int VGA_SetMode(unsigned Xres,unsigned Yres,unsigned Depth)
par.Xres = Xres;
par.Yres = Yres;
par.Depth = Depth;
if (Dosvm.RunInThread) Dosvm.RunInThread(VGA_DoSetMode, (ULONG_PTR)&par);
else VGA_DoSetMode((ULONG_PTR)&par);
MZ_RunInThread(VGA_DoSetMode, (ULONG_PTR)&par);
return par.ret;
}
......@@ -203,10 +186,7 @@ static void WINAPI VGA_DoExit(ULONG_PTR arg)
void VGA_Exit(void)
{
if (lpddraw) {
if (Dosvm.RunInThread) Dosvm.RunInThread(VGA_DoExit, 0);
else VGA_DoExit(0);
}
if (lpddraw) MZ_RunInThread(VGA_DoExit, 0);
}
void VGA_SetPalette(PALETTEENTRY*pal,int start,int len)
......@@ -352,8 +332,7 @@ void CALLBACK VGA_Poll( ULONG_PTR arg )
ch[X].Attributes = *dat++;
}
dest.Left=0; dest.Right=Width+1;
FIXME("output commented out for now, should be moved to winedos.dll\n");
/*WriteConsoleOutputA(con, ch, siz, off, &dest);*/
WriteConsoleOutputA(con, ch, siz, off, &dest);
}
}
vga_refresh=1;
......
......@@ -6,20 +6,19 @@ import user32.dll
import kernel32.dll
import ntdll.dll
debug_channels (int module relay)
debug_channels (aspi console ddraw int int21 int31 module relay)
@ stdcall GetCurrent() MZ_Current
@ stdcall LoadDPMI() MZ_AllocDPMITask
@ stdcall LoadDosExe(str long) MZ_LoadImage
@ stdcall Exec(ptr str long ptr) MZ_Exec
@ stdcall Exit(ptr long long) MZ_Exit
@ stdcall RunInThread(ptr long) MZ_RunInThread
@ stdcall Enter(ptr) DOSVM_Enter
@ stdcall Wait(long long) DOSVM_Wait
@ stdcall QueueEvent(long long ptr ptr) DOSVM_QueueEvent
@ stdcall OutPIC(long long) DOSVM_PIC_ioport_out
# DPMI functions
@ stdcall CallRMInt(ptr) DOSVM_CallRMInt
@ stdcall CallRMProc(ptr ptr long long) DOSVM_CallRMProc
@ stdcall AllocRMCB(ptr) DOSVM_AllocRMCB
@ stdcall FreeRMCB(ptr) DOSVM_FreeRMCB
# I/O functions
@ stdcall SetTimer(long) DOSVM_SetTimer
@ stdcall GetTimer() DOSVM_GetTimer
@ stdcall KbdReadScan(ptr) INT_Int09ReadScan
@ stdcall inport(long long ptr) DOSVM_inport
@ stdcall outport(long long long) DOSVM_outport
@ stdcall ASPIHandler(ptr) DOSVM_ASPIHandler
......@@ -9,13 +9,13 @@
#include "windef.h"
#include "wingdi.h"
#include "wine/wingdi16.h"
#include "miscemu.h"
#include "dispdib.h"
#include "vga.h"
#include "debugtools.h"
DEFAULT_DEBUG_CHANNEL(ddraw);
#if 0
static int dispdib_multi = 0;
static WORD DISPDIB_Begin(WORD wFlags)
......@@ -80,6 +80,8 @@ static void DISPDIB_Show(LPBITMAPINFOHEADER lpbi,LPSTR lpBits,WORD uFlags)
VGA_Poll(0);
}
#endif
/*********************************************************************
* DisplayDib (DISPDIB.1)
......@@ -115,6 +117,7 @@ WORD WINAPI DisplayDib(
WORD wFlags /* [in] */
)
{
#if 0
WORD ret;
if (wFlags&DISPLAYDIB_END) {
......@@ -138,5 +141,7 @@ WORD WINAPI DisplayDib(
FIXME("wait not implemented\n");
}
if (!dispdib_multi) DISPDIB_End();
#endif
FIXME( "broken, should be rewritten using ddraw\n" );
return DISPLAYDIB_NOERROR;
}
......@@ -31,19 +31,20 @@ extern CALLOUT_TABLE Callout;
typedef struct {
struct _DOSTASK* WINAPI (*Current)( void );
struct _DOSTASK* WINAPI (*LoadDPMI)( void );
void WINAPI (*LoadDosExe)( LPCSTR filename, HANDLE hFile );
BOOL WINAPI (*Exec)( CONTEXT86 *context, LPCSTR filename, BYTE func, LPVOID paramblk );
void WINAPI (*Exit)( CONTEXT86 *context, BOOL cs_psp, WORD retval );
int WINAPI (*Enter)( CONTEXT86 *context );
void WINAPI (*RunInThread)( PAPCFUNC proc, ULONG_PTR arg );
void WINAPI (*Wait)( int read_pipe, HANDLE hObject );
void WINAPI (*QueueEvent)( int irq, int priority, void (*relay)(CONTEXT86*,void*), void *data );
void WINAPI (*OutPIC)( WORD port, BYTE val );
/* DPMI functions */
void WINAPI (*CallRMInt)( CONTEXT86 *context );
void WINAPI (*CallRMProc)( CONTEXT86 *context, int iret );
void WINAPI (*AllocRMCB)( CONTEXT86 *context );
void WINAPI (*FreeRMCB)( CONTEXT86 *context );
/* I/O functions */
void WINAPI (*SetTimer)( unsigned ticks );
unsigned WINAPI (*GetTimer)( void );
BYTE WINAPI (*KbdReadScan)( BYTE *ascii );
BOOL WINAPI (*inport)( int port, int size, DWORD *res );
BOOL WINAPI (*outport)( int port, int size, DWORD val );
void WINAPI (*ASPIHandler)( CONTEXT86 *context );
} DOSVM_TABLE;
extern DOSVM_TABLE Dosvm;
......
......@@ -155,40 +155,15 @@ extern UINT DOSMEM_MapLinearToDos(LPVOID); /* linear Wine to DOS */
/* memory/instr.c */
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 */
typedef void WINAPI (*INTPROC)(CONTEXT86*);
extern FARPROC16 INT_GetPMHandler( BYTE intnum );
extern void INT_SetPMHandler( BYTE intnum, FARPROC16 handler );
extern FARPROC16 INT_GetRMHandler( BYTE intnum );
extern void INT_SetRMHandler( BYTE intnum, FARPROC16 handler );
extern FARPROC16 INT_CtxGetHandler( CONTEXT86 *context, BYTE intnum );
extern void INT_CtxSetHandler( CONTEXT86 *context, BYTE intnum, FARPROC16 handler );
extern int INT_RealModeInterrupt( BYTE intnum, CONTEXT86 *context );
extern INTPROC INT_GetWineHandler( BYTE intnum );
extern void INT_SetWineHandler( BYTE intnum, INTPROC proc );
/* msdos/ioports.c */
extern DWORD IO_inport( int port, int count );
extern void IO_outport( int port, int count, DWORD value );
/* msdos/int09.c */
extern void WINAPI INT_Int09Handler(CONTEXT86*);
extern void WINAPI INT_Int09SendScan(BYTE scan,BYTE ascii);
extern BYTE WINAPI INT_Int09ReadScan(BYTE*ascii);
/* msdos/int10.c */
extern void WINAPI INT_Int10Handler(CONTEXT86*);
/* msdos/int11.c */
extern void WINAPI INT_Int11Handler(CONTEXT86*);
......@@ -201,17 +176,6 @@ extern void WINAPI INT_Int13Handler(CONTEXT86*);
/* msdos/int15.c */
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 */
extern void WINAPI INT_Int17Handler(CONTEXT86*);
/* msdos/int19.c */
extern void WINAPI INT_Int19Handler(CONTEXT86*);
/* msdos/int1a.c */
extern DWORD INT1A_GetTicksSinceMidnight(void);
extern void WINAPI INT_Int1aHandler(CONTEXT86*);
......@@ -225,19 +189,12 @@ extern void WINAPI INT_Int25Handler(CONTEXT86*);
/* msdos/int26.c */
extern void WINAPI INT_Int26Handler(CONTEXT86*);
/* msdos/int29.c */
extern void WINAPI INT_Int29Handler(CONTEXT86*);
/* msdos/int2a.c */
extern void WINAPI INT_Int2aHandler(CONTEXT86*);
/* msdos/int2f.c */
extern void WINAPI INT_Int2fHandler(CONTEXT86*);
/* msdos/int33.c */
extern void WINAPI INT_Int33Handler(CONTEXT86*);
extern void WINAPI INT_Int33Message(UINT,WPARAM,LPARAM);
/* msdos/dpmi.c */
typedef void WINAPI (*RMCBPROC)(CONTEXT86*);
extern void WINAPI INT_Int31Handler(CONTEXT86*);
......@@ -246,12 +203,6 @@ extern FARPROC16 WINAPI DPMI_AllocInternalRMCB(RMCBPROC);
extern void WINAPI DPMI_FreeInternalRMCB(FARPROC16);
extern int DPMI_CallRMProc(CONTEXT86*,LPWORD,int,int);
/* msdos/xms.c */
extern void WINAPI XMS_Handler(CONTEXT86*);
/* misc/aspi.c */
extern void ASPI_DOS_HandleInt(CONTEXT86 *context);
/* misc/ppdev.c */
extern BOOL IO_pp_outp(int port, DWORD* res);
......
......@@ -11,7 +11,6 @@
#include "miscemu.h"
#include "callback.h"
#include "options.h"
#include "dosexe.h"
#include "debugtools.h"
static char main_exe_name[MAX_PATH];
......
......@@ -6,29 +6,20 @@ VPATH = @srcdir@
MODULE = msdos
C_SRCS = \
devices.c \
dosaspi.c \
dosconf.c \
dosmem.c \
dpmi.c \
xms.c \
int10.c \
int11.c \
int12.c \
int13.c \
int15.c \
int16.c \
int17.c \
int19.c \
int1a.c \
int20.c \
int21.c \
int25.c \
int26.c \
int29.c \
int2a.c \
int2f.c \
int33.c \
int3d.c \
int41.c \
int4b.c \
......@@ -36,7 +27,6 @@ C_SRCS = \
interrupts.c \
ioports.c \
ppdev.c \
vga.c \
vxd.c
all: $(MODULE).o
......
......@@ -22,8 +22,6 @@
#include "global.h"
#include "selectors.h"
#include "miscemu.h"
#include "vga.h"
#include "dosexe.h"
#include "debugtools.h"
DEFAULT_DEBUG_CHANNEL(dosmem);
......@@ -76,6 +74,8 @@ WORD DOSMEM_xms_seg;
WORD DOSMEM_dpmi_seg;
WORD DOSMEM_dpmi_sel;
DWORD DOS_LOLSeg;
/***********************************************************************
* DOSMEM_SystemBase
*
......@@ -225,12 +225,6 @@ BYTE * DOSMEM_BiosSys()
return DOSMEM_dosmem+0xf0000;
}
struct _DOS_LISTOFLISTS * DOSMEM_LOL()
{
return (struct _DOS_LISTOFLISTS *)DOSMEM_MapRealToLinear
(MAKESEGPTR(HIWORD(DOS_LOLSeg),0));
}
/***********************************************************************
* DOSMEM_FillBiosSegments
*
......@@ -516,7 +510,6 @@ BOOL DOSMEM_Init(BOOL dos_init)
DOSMEM_InitCollateTable();
DOSMEM_InitErrorTable();
DOSMEM_InitDPMI();
DOSDEV_InstallDOSDevices();
already_done = 1;
}
else if (dos_init && !already_mapped)
......
......@@ -5,9 +5,6 @@
#include <stdlib.h>
#include "winbase.h"
#include "miscemu.h"
/* #define DEBUG_INT */
#include "debugtools.h"
#include "callback.h"
/**********************************************************************
* INT_Int20Handler (WPROCS.132)
......@@ -16,6 +13,5 @@
*/
void WINAPI INT_Int20Handler( CONTEXT86 *context )
{
if (Dosvm.Exit) Dosvm.Exit( context, TRUE, 0 );
else ExitThread( 0 );
ExitThread( 0 );
}
......@@ -11,7 +11,6 @@
#include <string.h>
#include "wine/winbase16.h"
#include "dosexe.h"
#include "miscemu.h"
#include "module.h"
/* #define DEBUG_INT */
......
......@@ -14,17 +14,6 @@
DEFAULT_DEBUG_CHANNEL(int);
static INTPROC INT_WineHandler[256] = {
0, 0, 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,
INT_Int20Handler, DOS3Call, 0, 0, 0, INT_Int25Handler, 0, 0,
0, INT_Int29Handler, INT_Int2aHandler, 0, 0, 0, 0, INT_Int2fHandler,
0, INT_Int31Handler, 0, INT_Int33Handler
};
static FARPROC16 INT_Vectors[256];
/* Ordinal number for interrupt 0 handler in WPROCS.DLL */
......@@ -74,97 +63,6 @@ void INT_SetPMHandler( BYTE intnum, FARPROC16 handler )
/**********************************************************************
* INT_GetRMHandler
*
* Return the real mode interrupt vector for a given interrupt.
*/
FARPROC16 INT_GetRMHandler( BYTE intnum )
{
return ((FARPROC16*)DOSMEM_SystemBase())[intnum];
}
/**********************************************************************
* INT_SetRMHandler
*
* Set the real mode interrupt handler for a given interrupt.
*/
void INT_SetRMHandler( BYTE intnum, FARPROC16 handler )
{
TRACE("Set real mode interrupt vector %02x <- %04x:%04x\n",
intnum, HIWORD(handler), LOWORD(handler) );
((FARPROC16*)DOSMEM_SystemBase())[intnum] = handler;
}
/**********************************************************************
* INT_CtxGetHandler
*
* Return the interrupt vector for a given interrupt.
*/
FARPROC16 INT_CtxGetHandler( CONTEXT86 *context, BYTE intnum )
{
if (ISV86(context))
return INT_GetRMHandler(intnum);
else
return INT_GetPMHandler(intnum);
}
/**********************************************************************
* INT_CtxSetHandler
*
* Set the interrupt handler for a given interrupt.
*/
void INT_CtxSetHandler( CONTEXT86 *context, BYTE intnum, FARPROC16 handler )
{
if (ISV86(context))
INT_SetRMHandler(intnum, handler);
else
INT_SetPMHandler(intnum, handler);
}
/**********************************************************************
* INT_GetWineHandler
*
* Return the Wine interrupt handler for a given interrupt.
*/
INTPROC INT_GetWineHandler( BYTE intnum )
{
return INT_WineHandler[intnum];
}
/**********************************************************************
* INT_SetWineHandler
*
* Set the Wine interrupt handler for a given interrupt.
*/
void INT_SetWineHandler( BYTE intnum, INTPROC handler )
{
TRACE("Set Wine interrupt vector %02x <- %p\n", intnum, handler );
INT_WineHandler[intnum] = handler;
}
/**********************************************************************
* INT_RealModeInterrupt
*
* Handle real mode interrupts
*/
int INT_RealModeInterrupt( BYTE intnum, CONTEXT86 *context )
{
if (INT_WineHandler[intnum]) {
(*INT_WineHandler[intnum])(context);
return 0;
}
FIXME("Unknown Interrupt in DOS mode: 0x%x\n", intnum);
return 1;
}
/**********************************************************************
* INT_DefaultHandler (WPROCS.356)
*
* Default interrupt handler.
......
......@@ -20,9 +20,7 @@
#include <time.h>
#include <unistd.h>
#include "windef.h"
#include "vga.h"
#include "callback.h"
#include "dosexe.h"
#include "options.h"
#include "miscemu.h"
#include "debugtools.h"
......@@ -98,8 +96,7 @@ static void set_timer_maxval(unsigned timer, unsigned maxval)
{
switch (timer) {
case 0: /* System timer counter divisor */
if (Dosvm.Current())
Dosvm.SetTimer(maxval);
if (Dosvm.SetTimer) Dosvm.SetTimer(maxval);
break;
case 1: /* RAM refresh */
FIXME("RAM refresh counter handling not implemented !\n");
......@@ -292,6 +289,9 @@ DWORD IO_inport( int port, int size )
}
#endif
/* first give the DOS VM a chance to handle it */
if (Dosvm.inport && Dosvm.inport( port, size, &res )) return res;
switch (port)
{
case 0x40:
......@@ -308,7 +308,7 @@ DWORD IO_inport( int port, int size )
if (chan == 0) /* System timer counter divisor */
{
/* FIXME: Dosvm.GetTimer() returns quite rigid values */
if (Dosvm.Current())
if (Dosvm.GetTimer)
tempval = dummy_ctr + (WORD)Dosvm.GetTimer();
else
tempval = dummy_ctr;
......@@ -345,7 +345,6 @@ DWORD IO_inport( int port, int size )
}
break;
case 0x60:
res = Dosvm.KbdReadScan ? Dosvm.KbdReadScan(NULL) : 0;
#if 0 /* what's this port got to do with parport ? */
res = (DWORD)parport_8255[0];
#endif
......@@ -366,10 +365,6 @@ DWORD IO_inport( int port, int size )
case 0x201:
res = 0xffffffff; /* no joystick */
break;
case 0x3ba:
case 0x3da:
res = (DWORD)VGA_ioport_in( port );
break;
default:
WARN("Direct I/O read attempted from port %x\n", port);
res = 0xffffffff;
......@@ -416,12 +411,11 @@ void IO_outport( int port, int size, DWORD value )
}
#endif
/* first give the DOS VM a chance to handle it */
if (Dosvm.outport && Dosvm.outport( port, size, value )) return;
switch (port)
{
case 0x20:
if (Dosvm.Current())
Dosvm.OutPIC( port, (BYTE)value );
break;
case 0x40:
case 0x41:
case 0x42:
......@@ -477,7 +471,7 @@ void IO_outport( int port, int size, DWORD value )
tmr_8253[chan].latched = TRUE;
dummy_ctr -= 1 + (int)(10.0 * rand() / (RAND_MAX + 1.0));
if (chan == 0) /* System timer divisor */
if (Dosvm.Current())
if (Dosvm.GetTimer)
tmr_8253[chan].latch = dummy_ctr + (WORD)Dosvm.GetTimer();
else
tmr_8253[chan].latch = dummy_ctr;
......@@ -511,10 +505,6 @@ void IO_outport( int port, int size, DWORD value )
case 0x71:
cmosimage[cmosaddress & 0x3f] = (BYTE)value;
break;
case 0x3c8:
case 0x3c9:
VGA_ioport_out( port, (BYTE)value );
break;
default:
WARN("Direct I/O write attempted to port %x\n", port );
break;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment