2 * Misc. emulation definitions
4 * Copyright 1995 Alexandre Julliard
7 #ifndef __WINE_MISCEMU_H
8 #define __WINE_MISCEMU_H
12 #include "wine/windef16.h"
15 extern int DOSCONF_ReadConfig(void);
22 WORD Com1Addr; /* 00: COM1 I/O address */
23 WORD Com2Addr; /* 02: COM2 I/O address */
24 WORD Com3Addr; /* 04: COM3 I/O address */
25 WORD Com4Addr; /* 06: COM4 I/O address */
26 WORD Lpt1Addr; /* 08: LPT1 I/O address */
27 WORD Lpt2Addr; /* 0a: LPT2 I/O address */
28 WORD Lpt3Addr; /* 0c: LPT3 I/O address */
29 WORD Lpt4Addr; /* 0e: LPT4 I/O address */
30 WORD InstalledHardware; /* 10: Installed hardware flags */
31 BYTE POSTstatus; /* 12: Power-On Self Test status */
32 WORD MemSize WINE_PACKED; /* 13: Base memory size in Kb */
33 WORD unused1 WINE_PACKED; /* 15: Manufacturing test scratch pad */
34 BYTE KbdFlags1; /* 17: Keyboard flags 1 */
35 BYTE KbdFlags2; /* 18: Keyboard flags 2 */
36 BYTE unused2; /* 19: Keyboard driver workspace */
37 WORD NextKbdCharPtr; /* 1a: Next character in kbd buffer */
38 WORD FirstKbdCharPtr; /* 1c: First character in kbd buffer */
39 WORD KbdBuffer[16]; /* 1e: Keyboard buffer */
40 BYTE DisketteStatus1; /* 3e: Diskette recalibrate status */
41 BYTE DisketteStatus2; /* 3f: Diskette motor status */
42 BYTE DisketteStatus3; /* 40: Diskette motor timeout */
43 BYTE DisketteStatus4; /* 41: Diskette last operation status */
44 BYTE DiskStatus[7]; /* 42: Disk status/command bytes */
45 BYTE VideoMode; /* 49: Video mode */
46 WORD VideoColumns; /* 4a: Number of columns */
47 WORD VideoPageSize; /* 4c: Video page size in bytes */
48 WORD VideoPageStartAddr; /* 4e: Video page start address */
49 BYTE VideoCursorPos[16]; /* 50: Cursor position for 8 pages */
50 WORD VideoCursorType; /* 60: Video cursor type */
51 BYTE VideoCurPage; /* 62: Video current page */
52 WORD VideoCtrlAddr WINE_PACKED; /* 63: Video controller address */
53 BYTE VideoReg1; /* 65: Video mode select register */
54 BYTE VideoReg2; /* 66: Video CGA palette register */
55 DWORD ResetEntry WINE_PACKED; /* 67: Warm reset entry point */
56 BYTE LastIRQ; /* 6b: Last unexpected interrupt */
57 DWORD Ticks; /* 6c: Ticks since midnight */
58 BYTE TicksOverflow; /* 70: Timer overflow if past midnight */
59 BYTE CtrlBreakFlag; /* 71: Ctrl-Break flag */
60 WORD ResetFlag; /* 72: POST Reset flag */
61 BYTE DiskOpStatus; /* 74: Last hard-disk operation status */
62 BYTE NbHardDisks; /* 75: Number of hard disks */
63 BYTE DiskCtrlByte; /* 76: Disk control byte */
64 BYTE DiskIOPort; /* 77: Disk I/O port offset */
65 BYTE LptTimeout[4]; /* 78: Timeouts for parallel ports */
66 BYTE ComTimeout[4]; /* 7c: Timeouts for serial ports */
67 WORD KbdBufferStart; /* 80: Keyboard buffer start */
68 WORD KbdBufferEnd; /* 82: Keyboard buffer end */
69 BYTE RowsOnScreenMinus1; /* 84: EGA only */
70 WORD BytesPerChar WINE_PACKED; /* 85: EGA only */
71 BYTE ModeOptions; /* 87: EGA only */
72 BYTE FeatureBitsSwitches; /* 88: EGA only */
73 BYTE VGASettings; /* 89: VGA misc settings */
74 BYTE DisplayCombination; /* 8A: VGA display combinations */
75 BYTE DiskDataRate; /* 8B: Last disk data rate selected */
80 DWORD StaticFuncTable; /* 00: static functionality table */
81 BYTE VideoMode; /* 04: video mode in effect */
82 WORD NumberColumns; /* 05: number of columns */
83 WORD RegenBufLen; /* 07: length of regen buffer in bytes */
84 WORD RegenBufAddr; /* 09: starting address of regen buffer */
85 WORD CursorPos[8]; /* 0B: cursor position for page 0..7 */
86 WORD CursorType; /* 1B: cursor "type" (start/stop scan lines) */
87 BYTE ActivePage; /* 1D: active display page */
88 WORD CRTCPort; /* 1E: CRTC port address */
89 BYTE Port3x8; /* 20: current setting of PORT 03x8h */
90 BYTE Port3x9; /* 21: current setting of PORT 03x9h */
91 BYTE NumberRows; /* 22: number of rows - 1 */
92 WORD BytesPerChar; /* 23: bytes/character */
93 BYTE DCCActive; /* 25: display combination code of active display */
94 BYTE DCCAlternate; /* 26: DCC of alternate display */
95 WORD NumberColors; /* 27: number of colors supported in current mode (0000h = mono) */
96 BYTE NumberPages; /* 29: number of pages supported in current mode */
97 BYTE NumberScanlines; /* 2A: number of scan lines active */
98 BYTE CharBlockPrimary; /* 2B: primary character block */
99 BYTE CharBlockSecondary; /* 2C: secondary character block */
100 BYTE MiscFlags; /* 2D: miscellaneous flags */
101 BYTE NonVGASupport; /* 2E: non-VGA mode support */
102 BYTE _reserved1[2]; /* 2F: */
103 BYTE VideoMem; /* 31: video memory available */
104 BYTE SavePointerState; /* 32: save pointer state flags */
105 BYTE DisplayStatus; /* 33: display information and status */
106 BYTE _reserved2[12]; /* 34: */
112 BYTE ModeSupport[7]; /* 00: modes supported 1..7 */
113 BYTE ScanlineSupport; /* 07: scan lines supported */
114 BYTE NumberCharBlocks; /* 08: total number of character blocks */
115 BYTE ActiveCharBlocks; /* 09: max. number of active character blocks */
116 WORD MiscFlags; /* 0A: miscellaneous function support flags */
117 WORD _reserved1; /* 0C: */
118 BYTE SavePointerFlags; /* 0E: save pointer function flags */
119 BYTE _reserved2; /* OF: */
121 } VIDEOFUNCTIONALITY;
125 extern WORD DOSMEM_0000H;
126 extern WORD DOSMEM_BiosDataSeg;
127 extern WORD DOSMEM_BiosSysSeg;
128 extern BIOSDATA * DOSMEM_BiosData();
129 extern BYTE * DOSMEM_BiosSys();
131 extern DWORD DOSMEM_CollateTable;
133 /* various real-mode code stubs */
134 extern WORD DOSMEM_wrap_seg;
135 extern WORD DOSMEM_xms_seg;
136 extern WORD DOSMEM_dpmi_seg;
137 extern WORD DOSMEM_dpmi_sel;
139 extern DWORD DOS_LOLSeg;
140 extern struct _DOS_LISTOFLISTS * DOSMEM_LOL();
142 extern BOOL DOSMEM_Init(BOOL);
143 extern void DOSMEM_Tick(WORD timer);
144 extern WORD DOSMEM_AllocSelector(WORD);
145 extern char * DOSMEM_MemoryBase(void);
146 extern LPVOID DOSMEM_GetBlock(UINT size, WORD* p);
147 extern BOOL DOSMEM_FreeBlock(void* ptr);
148 extern LPVOID DOSMEM_ResizeBlock(void* ptr, UINT size, WORD* p);
149 extern UINT DOSMEM_Available(void);
150 extern LPVOID DOSMEM_MapRealToLinear(DWORD); /* real-mode to linear */
151 extern LPVOID DOSMEM_MapDosToLinear(UINT); /* linear DOS to Wine */
152 extern UINT DOSMEM_MapLinearToDos(LPVOID); /* linear Wine to DOS */
155 extern BOOL INSTR_EmulateInstruction( CONTEXT86 *context );
157 /* msdos/devices.c */
158 extern void DOSDEV_InstallDOSDevices(void);
159 extern DWORD DOSDEV_Console(void);
160 extern DWORD DOSDEV_FindCharDevice(char*name);
161 extern int DOSDEV_Peek(DWORD dev, BYTE*data);
162 extern int DOSDEV_Read(DWORD dev, DWORD buf, int buflen);
163 extern int DOSDEV_Write(DWORD dev, DWORD buf, int buflen, int verify);
164 extern int DOSDEV_IoctlRead(DWORD dev, DWORD buf, int buflen);
165 extern int DOSDEV_IoctlWrite(DWORD dev, DWORD buf, int buflen);
167 /* msdos/interrupts.c */
168 extern FARPROC16 INT_GetPMHandler( BYTE intnum );
169 extern void INT_SetPMHandler( BYTE intnum, FARPROC16 handler );
170 extern FARPROC16 INT_GetRMHandler( BYTE intnum );
171 extern void INT_SetRMHandler( BYTE intnum, FARPROC16 handler );
172 extern FARPROC16 INT_CtxGetHandler( CONTEXT86 *context, BYTE intnum );
173 extern void INT_CtxSetHandler( CONTEXT86 *context, BYTE intnum, FARPROC16 handler );
174 extern int INT_RealModeInterrupt( BYTE intnum, CONTEXT86 *context );
176 /* msdos/ioports.c */
177 extern DWORD IO_inport( int port, int count );
178 extern void IO_outport( int port, int count, DWORD value );
181 extern void WINAPI INT_Int09Handler(CONTEXT86*);
182 extern void WINAPI INT_Int09SendScan(BYTE scan,BYTE ascii);
183 extern BYTE WINAPI INT_Int09ReadScan(BYTE*ascii);
186 extern void WINAPI INT_Int10Handler(CONTEXT86*);
189 extern void WINAPI INT_Int11Handler(CONTEXT86*);
192 extern void WINAPI INT_Int12Handler(CONTEXT86*);
195 extern void WINAPI INT_Int13Handler(CONTEXT86*);
198 extern void WINAPI INT_Int15Handler(CONTEXT86*);
201 extern void WINAPI INT_Int16Handler(CONTEXT86*);
202 extern int WINAPI INT_Int16ReadChar(BYTE*ascii,BYTE*scan,BOOL peek);
203 extern int WINAPI INT_Int16AddChar(BYTE ascii,BYTE scan);
206 extern void WINAPI INT_Int17Handler(CONTEXT86*);
209 extern void WINAPI INT_Int19Handler(CONTEXT86*);
212 extern DWORD INT1A_GetTicksSinceMidnight(void);
213 extern void WINAPI INT_Int1aHandler(CONTEXT86*);
216 extern void WINAPI INT_Int20Handler(CONTEXT86*);
219 extern void WINAPI INT_Int25Handler(CONTEXT86*);
222 extern void WINAPI INT_Int26Handler(CONTEXT86*);
225 extern void WINAPI INT_Int29Handler(CONTEXT86*);
228 extern void WINAPI INT_Int2aHandler(CONTEXT86*);
231 extern void WINAPI INT_Int2fHandler(CONTEXT86*);
234 extern void WINAPI INT_Int33Handler(CONTEXT86*);
235 extern void WINAPI INT_Int33Message(UINT,WPARAM,LPARAM);
238 typedef void WINAPI (*RMCBPROC)(CONTEXT86*);
239 extern void WINAPI INT_Int31Handler(CONTEXT86*);
240 extern FARPROC16 WINAPI DPMI_AllocInternalRMCB(RMCBPROC);
241 extern void WINAPI DPMI_FreeInternalRMCB(FARPROC16);
242 extern int DPMI_CallRMProc(CONTEXT86*,LPWORD,int,int);
245 extern void WINAPI XMS_Handler(CONTEXT86*);
248 extern void ASPI_DOS_HandleInt(CONTEXT86 *context);
250 /* NOTE: Interrupts might get called from three modes: real mode, 16-bit, and
251 * (via DeviceIoControl) 32-bit. For automatic conversion of pointer
252 * parameters, interrupt handlers should use CTX_SEG_OFF_TO_LIN with
253 * the contents of a segment register as second and the contents of
254 * a *32-bit* general register as third parameter, e.g.
255 * CTX_SEG_OFF_TO_LIN( context, DS_reg(context), EDX_reg(context) )
256 * This will generate a linear pointer in all three cases:
257 * Real-Mode: Seg*16 + LOWORD(Offset)
258 * 16-bit: convert (Seg, LOWORD(Offset)) to linear
259 * 32-bit: use Offset as linear address (DeviceIoControl!)
261 * Real-mode is recognized by checking the V86 bit in the flags register,
262 * 32-bit mode is recognized by checking whether 'seg' is a system selector
263 * (0 counts also as 32-bit segment).
265 #define CTX_SEG_OFF_TO_LIN(context,seg,off) \
266 (ISV86(context) ? PTR_REAL_TO_LIN((seg),(off)) : \
267 (!seg || IS_SELECTOR_SYSTEM(seg))? (void *)(off) : PTR_SEG_OFF_TO_LIN((seg),LOWORD(off)))
269 #define INT_BARF(context,num) \
270 ERR( "int%x: unknown/not implemented parameters:\n" \
271 "int%x: AX %04x, BX %04x, CX %04x, DX %04x, " \
272 "SI %04x, DI %04x, DS %04x, ES %04x\n", \
273 (num), (num), LOWORD((context)->Eax), LOWORD((context)->Ebx), \
274 LOWORD((context)->Ecx), LOWORD((context)->Edx), LOWORD((context)->Esi), \
275 LOWORD((context)->Edi), (WORD)(context)->SegDs, (WORD)(context)->SegEs )
277 #endif /* __WINE_MISCEMU_H */