Moved DCX_* constants to winuser.h.
[wine/multimedia.git] / include / miscemu.h
blobd8ff0159599a68a64d0b5009affce7164f2e64f5
1 /*
2 * Misc. emulation definitions
4 * Copyright 1995 Alexandre Julliard
5 */
7 #ifndef __WINE_MISCEMU_H
8 #define __WINE_MISCEMU_H
10 #include "winnt.h"
11 #include "selectors.h"
12 #include "wine/windef16.h"
14 /* msdos/dosconf.c */
15 extern int DOSCONF_ReadConfig(void);
17 /* msdos/dosmem.c */
18 #include "pshpack1.h"
20 typedef struct
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 */
76 } BIOSDATA;
78 typedef struct
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: */
108 } VIDEOSTATE;
110 typedef struct
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;
123 #include "poppack.h"
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 char * DOSMEM_SystemBase(void);
147 extern LPVOID DOSMEM_GetBlock(UINT size, WORD* p);
148 extern BOOL DOSMEM_FreeBlock(void* ptr);
149 extern LPVOID DOSMEM_ResizeBlock(void* ptr, UINT size, WORD* p);
150 extern UINT DOSMEM_Available(void);
151 extern LPVOID DOSMEM_MapRealToLinear(DWORD); /* real-mode to linear */
152 extern LPVOID DOSMEM_MapDosToLinear(UINT); /* linear DOS to Wine */
153 extern UINT DOSMEM_MapLinearToDos(LPVOID); /* linear Wine to DOS */
155 /* memory/instr.c */
156 extern BOOL INSTR_EmulateInstruction( CONTEXT86 *context );
158 /* msdos/devices.c */
159 extern void DOSDEV_InstallDOSDevices(void);
160 extern DWORD DOSDEV_Console(void);
161 extern DWORD DOSDEV_FindCharDevice(char*name);
162 extern int DOSDEV_Peek(DWORD dev, BYTE*data);
163 extern int DOSDEV_Read(DWORD dev, DWORD buf, int buflen);
164 extern int DOSDEV_Write(DWORD dev, DWORD buf, int buflen, int verify);
165 extern int DOSDEV_IoctlRead(DWORD dev, DWORD buf, int buflen);
166 extern int DOSDEV_IoctlWrite(DWORD dev, DWORD buf, int buflen);
168 /* msdos/interrupts.c */
169 extern FARPROC16 INT_GetPMHandler( BYTE intnum );
170 extern void INT_SetPMHandler( BYTE intnum, FARPROC16 handler );
171 extern FARPROC16 INT_GetRMHandler( BYTE intnum );
172 extern void INT_SetRMHandler( BYTE intnum, FARPROC16 handler );
173 extern FARPROC16 INT_CtxGetHandler( CONTEXT86 *context, BYTE intnum );
174 extern void INT_CtxSetHandler( CONTEXT86 *context, BYTE intnum, FARPROC16 handler );
175 extern int INT_RealModeInterrupt( BYTE intnum, CONTEXT86 *context );
177 /* msdos/ioports.c */
178 extern DWORD IO_inport( int port, int count );
179 extern void IO_outport( int port, int count, DWORD value );
181 /* msdos/int09.c */
182 extern void WINAPI INT_Int09Handler(CONTEXT86*);
183 extern void WINAPI INT_Int09SendScan(BYTE scan,BYTE ascii);
184 extern BYTE WINAPI INT_Int09ReadScan(BYTE*ascii);
186 /* msdos/int10.c */
187 extern void WINAPI INT_Int10Handler(CONTEXT86*);
189 /* msdos/int11.c */
190 extern void WINAPI INT_Int11Handler(CONTEXT86*);
192 /* msdos/int12.c */
193 extern void WINAPI INT_Int12Handler(CONTEXT86*);
195 /* msdos/int13.c */
196 extern void WINAPI INT_Int13Handler(CONTEXT86*);
198 /* msdos/int15.c */
199 extern void WINAPI INT_Int15Handler(CONTEXT86*);
201 /* msdos/int16.c */
202 extern void WINAPI INT_Int16Handler(CONTEXT86*);
203 extern int WINAPI INT_Int16ReadChar(BYTE*ascii,BYTE*scan,BOOL peek);
204 extern int WINAPI INT_Int16AddChar(BYTE ascii,BYTE scan);
206 /* msdos/int17.c */
207 extern void WINAPI INT_Int17Handler(CONTEXT86*);
209 /* msdos/int19.c */
210 extern void WINAPI INT_Int19Handler(CONTEXT86*);
212 /* msdos/int1a.c */
213 extern DWORD INT1A_GetTicksSinceMidnight(void);
214 extern void WINAPI INT_Int1aHandler(CONTEXT86*);
216 /* msdos/int20.c */
217 extern void WINAPI INT_Int20Handler(CONTEXT86*);
219 /* msdos/int25.c */
220 extern void WINAPI INT_Int25Handler(CONTEXT86*);
222 /* msdos/int26.c */
223 extern void WINAPI INT_Int26Handler(CONTEXT86*);
225 /* msdos/int29.c */
226 extern void WINAPI INT_Int29Handler(CONTEXT86*);
228 /* msdos/int2a.c */
229 extern void WINAPI INT_Int2aHandler(CONTEXT86*);
231 /* msdos/int2f.c */
232 extern void WINAPI INT_Int2fHandler(CONTEXT86*);
234 /* msdos/int33.c */
235 extern void WINAPI INT_Int33Handler(CONTEXT86*);
236 extern void WINAPI INT_Int33Message(UINT,WPARAM,LPARAM);
238 /* msdos/dpmi.c */
239 typedef void WINAPI (*RMCBPROC)(CONTEXT86*);
240 extern void WINAPI INT_Int31Handler(CONTEXT86*);
241 extern BOOL DPMI_LoadDosSystem(void);
242 extern FARPROC16 WINAPI DPMI_AllocInternalRMCB(RMCBPROC);
243 extern void WINAPI DPMI_FreeInternalRMCB(FARPROC16);
244 extern int DPMI_CallRMProc(CONTEXT86*,LPWORD,int,int);
246 /* msdos/xms.c */
247 extern void WINAPI XMS_Handler(CONTEXT86*);
249 /* misc/aspi.c */
250 extern void ASPI_DOS_HandleInt(CONTEXT86 *context);
252 #define PTR_REAL_TO_LIN(seg,off) \
253 ((void*)(((unsigned int)(seg) << 4) + LOWORD(off)))
255 /* NOTE: Interrupts might get called from three modes: real mode, 16-bit, and
256 * (via DeviceIoControl) 32-bit. For automatic conversion of pointer
257 * parameters, interrupt handlers should use CTX_SEG_OFF_TO_LIN with
258 * the contents of a segment register as second and the contents of
259 * a *32-bit* general register as third parameter, e.g.
260 * CTX_SEG_OFF_TO_LIN( context, DS_reg(context), EDX_reg(context) )
261 * This will generate a linear pointer in all three cases:
262 * Real-Mode: Seg*16 + LOWORD(Offset)
263 * 16-bit: convert (Seg, LOWORD(Offset)) to linear
264 * 32-bit: use Offset as linear address (DeviceIoControl!)
266 * Real-mode is recognized by checking the V86 bit in the flags register,
267 * 32-bit mode is recognized by checking whether 'seg' is a system selector
268 * (0 counts also as 32-bit segment).
270 #define CTX_SEG_OFF_TO_LIN(context,seg,off) \
271 (ISV86(context) ? PTR_REAL_TO_LIN((seg),(off)) : \
272 (!seg || IS_SELECTOR_SYSTEM(seg))? (void *)(off) : MapSL(MAKESEGPTR((seg),(off))))
274 #define INT_BARF(context,num) \
275 ERR( "int%x: unknown/not implemented parameters:\n" \
276 "int%x: AX %04x, BX %04x, CX %04x, DX %04x, " \
277 "SI %04x, DI %04x, DS %04x, ES %04x\n", \
278 (num), (num), LOWORD((context)->Eax), LOWORD((context)->Ebx), \
279 LOWORD((context)->Ecx), LOWORD((context)->Edx), LOWORD((context)->Esi), \
280 LOWORD((context)->Edi), (WORD)(context)->SegDs, (WORD)(context)->SegEs )
282 #endif /* __WINE_MISCEMU_H */