2 * Misc. emulation definitions
4 * Copyright 1995 Alexandre Julliard
7 #ifndef __WINE_MISCEMU_H
8 #define __WINE_MISCEMU_H
14 extern int DOSCONF_ReadConfig(void);
21 WORD Com1Addr; /* 00: COM1 I/O address */
22 WORD Com2Addr; /* 02: COM2 I/O address */
23 WORD Com3Addr; /* 04: COM3 I/O address */
24 WORD Com4Addr; /* 06: COM4 I/O address */
25 WORD Lpt1Addr; /* 08: LPT1 I/O address */
26 WORD Lpt2Addr; /* 0a: LPT2 I/O address */
27 WORD Lpt3Addr; /* 0c: LPT3 I/O address */
28 WORD Lpt4Addr; /* 0e: LPT4 I/O address */
29 WORD InstalledHardware; /* 10: Installed hardware flags */
30 BYTE POSTstatus; /* 12: Power-On Self Test status */
31 WORD MemSize WINE_PACKED; /* 13: Base memory size in Kb */
32 WORD unused1 WINE_PACKED; /* 15: Manufacturing test scratch pad */
33 BYTE KbdFlags1; /* 17: Keyboard flags 1 */
34 BYTE KbdFlags2; /* 18: Keyboard flags 2 */
35 BYTE unused2; /* 19: Keyboard driver workspace */
36 WORD NextKbdCharPtr; /* 1a: Next character in kbd buffer */
37 WORD FirstKbdCharPtr; /* 1c: First character in kbd buffer */
38 WORD KbdBuffer[16]; /* 1e: Keyboard buffer */
39 BYTE DisketteStatus1; /* 3e: Diskette recalibrate status */
40 BYTE DisketteStatus2; /* 3f: Diskette motor status */
41 BYTE DisketteStatus3; /* 40: Diskette motor timeout */
42 BYTE DisketteStatus4; /* 41: Diskette last operation status */
43 BYTE DiskStatus[7]; /* 42: Disk status/command bytes */
44 BYTE VideoMode; /* 49: Video mode */
45 WORD VideoColumns; /* 4a: Number of columns */
46 WORD VideoPageSize; /* 4c: Video page size in bytes */
47 WORD VideoPageStartAddr; /* 4e: Video page start address */
48 BYTE VideoCursorPos[16]; /* 50: Cursor position for 8 pages */
49 WORD VideoCursorType; /* 60: Video cursor type */
50 BYTE VideoCurPage; /* 62: Video current page */
51 WORD VideoCtrlAddr WINE_PACKED; /* 63: Video controller address */
52 BYTE VideoReg1; /* 65: Video mode select register */
53 BYTE VideoReg2; /* 66: Video CGA palette register */
54 DWORD ResetEntry WINE_PACKED; /* 67: Warm reset entry point */
55 BYTE LastIRQ; /* 6b: Last unexpected interrupt */
56 DWORD Ticks; /* 6c: Ticks since midnight */
57 BYTE TicksOverflow; /* 70: Timer overflow if past midnight */
58 BYTE CtrlBreakFlag; /* 71: Ctrl-Break flag */
59 WORD ResetFlag; /* 72: POST Reset flag */
60 BYTE DiskOpStatus; /* 74: Last hard-disk operation status */
61 BYTE NbHardDisks; /* 75: Number of hard disks */
62 BYTE DiskCtrlByte; /* 76: Disk control byte */
63 BYTE DiskIOPort; /* 77: Disk I/O port offset */
64 BYTE LptTimeout[4]; /* 78: Timeouts for parallel ports */
65 BYTE ComTimeout[4]; /* 7c: Timeouts for serial ports */
66 WORD KbdBufferStart; /* 80: Keyboard buffer start */
67 WORD KbdBufferEnd; /* 82: Keyboard buffer end */
68 BYTE RowsOnScreenMinus1; /* 84: EGA only */
69 WORD BytesPerChar WINE_PACKED; /* 85: EGA only */
70 BYTE ModeOptions; /* 87: EGA only */
71 BYTE FeatureBitsSwitches; /* 88: EGA only */
72 BYTE VGASettings; /* 89: VGA misc settings */
73 BYTE DisplayCombination; /* 8A: VGA display combinations */
74 BYTE DiskDataRate; /* 8B: Last disk data rate selected */
79 extern HANDLE16 DOSMEM_BiosDataSeg;
80 extern HANDLE16 DOSMEM_BiosSysSeg;
81 extern BIOSDATA * DOSMEM_BiosData();
82 extern BYTE * DOSMEM_BiosSys();
84 extern DWORD DOSMEM_CollateTable;
86 extern DWORD DOSMEM_ErrorCall;
87 extern DWORD DOSMEM_ErrorBuffer;
89 extern DWORD DOS_LOLSeg;
90 extern struct _DOS_LISTOFLISTS * DOSMEM_LOL();
92 extern BOOL DOSMEM_Init(HMODULE16 hModule);
93 extern void DOSMEM_Tick(WORD timer);
94 extern WORD DOSMEM_AllocSelector(WORD);
95 extern char * DOSMEM_MemoryBase(HMODULE16 hModule);
96 extern LPVOID DOSMEM_GetBlock(HMODULE16 hModule, UINT size, UINT16* p);
97 extern BOOL DOSMEM_FreeBlock(HMODULE16 hModule, void* ptr);
98 extern LPVOID DOSMEM_ResizeBlock(HMODULE16 hModule, void* ptr, UINT size, UINT16* p);
99 extern UINT DOSMEM_Available(HMODULE16 hModule);
100 extern LPVOID DOSMEM_MapRealToLinear(DWORD); /* real-mode to linear */
101 extern LPVOID DOSMEM_MapDosToLinear(UINT); /* linear DOS to Wine */
102 extern UINT DOSMEM_MapLinearToDos(LPVOID); /* linear Wine to DOS */
105 extern BOOL INSTR_EmulateInstruction( CONTEXT86 *context );
107 /* msdos/devices.c */
108 extern void DOSDEV_InstallDOSDevices(void);
110 /* msdos/interrupts.c */
111 extern FARPROC16 INT_GetPMHandler( BYTE intnum );
112 extern void INT_SetPMHandler( BYTE intnum, FARPROC16 handler );
113 extern FARPROC16 INT_GetRMHandler( BYTE intnum );
114 extern void INT_SetRMHandler( BYTE intnum, FARPROC16 handler );
115 extern FARPROC16 INT_CtxGetHandler( CONTEXT86 *context, BYTE intnum );
116 extern void INT_CtxSetHandler( CONTEXT86 *context, BYTE intnum, FARPROC16 handler );
117 extern int INT_RealModeInterrupt( BYTE intnum, CONTEXT86 *context );
119 /* msdos/ioports.c */
120 extern void IO_port_init (void);
121 extern DWORD IO_inport( int port, int count );
122 extern void IO_outport( int port, int count, DWORD value );
125 extern void WINAPI INT_Int09Handler(CONTEXT86*);
126 extern void WINAPI INT_Int09SendScan(BYTE);
127 extern BYTE WINAPI INT_Int09ReadScan(void);
130 extern void WINAPI INT_Int10Handler(CONTEXT86*);
133 extern void WINAPI INT_Int11Handler(CONTEXT86*);
136 extern void WINAPI INT_Int12Handler(CONTEXT86*);
139 extern void WINAPI INT_Int13Handler(CONTEXT86*);
142 extern void WINAPI INT_Int15Handler(CONTEXT86*);
145 extern void WINAPI INT_Int16Handler(CONTEXT86*);
146 extern int WINAPI INT_Int16AddChar(BYTE ascii,BYTE scan);
149 extern void WINAPI INT_Int17Handler(CONTEXT86*);
152 extern void WINAPI INT_Int19Handler(CONTEXT86*);
155 extern DWORD INT1A_GetTicksSinceMidnight(void);
156 extern void WINAPI INT_Int1aHandler(CONTEXT86*);
159 extern void WINAPI INT_Int20Handler(CONTEXT86*);
162 extern void WINAPI INT_Int25Handler(CONTEXT86*);
165 extern void WINAPI INT_Int26Handler(CONTEXT86*);
168 extern void WINAPI INT_Int29Handler(CONTEXT86*);
171 extern void WINAPI INT_Int2aHandler(CONTEXT86*);
174 extern void WINAPI INT_Int2fHandler(CONTEXT86*);
177 extern void WINAPI INT_Int33Handler(CONTEXT86*);
178 extern void WINAPI INT_Int33Message(UINT,WPARAM,LPARAM);
181 typedef void WINAPI (*RMCBPROC)(CONTEXT86*);
182 extern void WINAPI INT_Int31Handler(CONTEXT86*);
183 extern FARPROC16 WINAPI DPMI_AllocInternalRMCB(RMCBPROC);
184 extern void WINAPI DPMI_FreeInternalRMCB(FARPROC16);
185 extern int DPMI_CallRMProc(CONTEXT86*,LPWORD,int,int);
188 extern void WINAPI XMS_Handler(CONTEXT86*);
191 extern void ASPI_DOS_HandleInt(CONTEXT86 *context);
193 /* NOTE: Interrupts might get called from three modes: real mode, 16-bit, and
194 * (via DeviceIoControl) 32-bit. For automatic conversion of pointer
195 * parameters, interrupt handlers should use CTX_SEG_OFF_TO_LIN with
196 * the contents of a segement register as second and the contents of
197 * a *32-bit* general register as third parameter, e.g.
198 * CTX_SEG_OFF_TO_LIN( context, DS_reg(context), EDX_reg(context) )
199 * This will generate a linear pointer in all three cases:
200 * Real-Mode: Seg*16 + LOWORD(Offset) + V86BASE
201 * 16-bit: convert (Seg, LOWORD(Offset)) to linear
202 * 32-bit: use Offset as linear address (DeviceIoControl!)
204 * Real-mode is recognized by checking the V86 bit in the flags register,
205 * 32-bit mode is recognized by checking whether 'seg' is a system selector
206 * (0 counts also as 32-bit segment).
208 #define CTX_SEG_OFF_TO_LIN(context,seg,off) \
209 (ISV86(context) ? (void*)(V86BASE(context)+((seg)<<4)+(off&0xffff)) : \
210 (!seg || IS_SELECTOR_SYSTEM(seg))? (void *)off : PTR_SEG_OFF_TO_LIN(seg,off&0xffff))
212 #define INT_BARF(context,num) \
213 fprintf( stderr, "int%x: unknown/not implemented parameters:\n" \
214 "int%x: AX %04x, BX %04x, CX %04x, DX %04x, " \
215 "SI %04x, DI %04x, DS %04x, ES %04x\n", \
216 (num), (num), AX_reg(context), BX_reg(context), CX_reg(context), \
217 DX_reg(context), SI_reg(context), DI_reg(context), \
218 (WORD)DS_reg(context), (WORD)ES_reg(context) )
220 #endif /* __WINE_MISCEMU_H */