KDE 1.x has problems with using XShapeCombineMask when there was no
[wine] / include / miscemu.h
1 /*
2  * Misc. emulation definitions
3  *
4  * Copyright 1995 Alexandre Julliard
5  */
6
7 #ifndef __WINE_MISCEMU_H
8 #define __WINE_MISCEMU_H
9
10 #include "winnt.h"
11 #include "ldt.h"
12
13 /* msdos/dosconf.c */
14 extern int DOSCONF_ReadConfig(void);
15
16 /* msdos/dosmem.c */
17 #include "pshpack1.h"
18
19 typedef struct
20 {
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 */
75 } BIOSDATA;
76
77 typedef struct
78 {
79     DWORD StaticFuncTable;           /* 00: static functionality table */
80     BYTE  VideoMode;                 /* 04: video mode in effect */
81     WORD  NumberColumns;             /* 05: number of columns */
82     WORD  RegenBufLen;               /* 07: length of regen buffer in bytes */
83     WORD  RegenBufAddr;              /* 09: starting address of regen buffer */
84     WORD  CursorPos[8];              /* 0B: cursor position for page 0..7 */
85     WORD  CursorType;                /* 1B: cursor "type" (start/stop scan lines) */
86     BYTE  ActivePage;                /* 1D: active display page */
87     WORD  CRTCPort;                  /* 1E: CRTC port address */
88     BYTE  Port3x8;                   /* 20: current setting of PORT 03x8h */
89     BYTE  Port3x9;                   /* 21: current setting of PORT 03x9h */
90     BYTE  NumberRows;                /* 22: number of rows - 1 */
91     WORD  BytesPerChar;              /* 23: bytes/character */
92     BYTE  DCCActive;                 /* 25: display combination code of active display */
93     BYTE  DCCAlternate;              /* 26: DCC of alternate display */
94     WORD  NumberColors;              /* 27: number of colors supported in current mode (0000h = mono) */
95     BYTE  NumberPages;               /* 29: number of pages supported in current mode */
96     BYTE  NumberScanlines;           /* 2A: number of scan lines active */
97     BYTE  CharBlockPrimary;          /* 2B: primary character block */
98     BYTE  CharBlockSecondary;        /* 2C: secondary character block */
99     BYTE  MiscFlags;                 /* 2D: miscellaneous flags */
100     BYTE  NonVGASupport;             /* 2E: non-VGA mode support */
101     BYTE  _reserved1[2];             /* 2F: */
102     BYTE  VideoMem;                  /* 31: video memory available */
103     BYTE  SavePointerState;          /* 32: save pointer state flags */
104     BYTE  DisplayStatus;             /* 33: display information and status */
105     BYTE  _reserved2[12];            /* 34: */
106
107 } VIDEOSTATE;
108
109 typedef struct
110 {
111     BYTE  ModeSupport[7];           /* 00: modes supported 1..7 */
112     BYTE  ScanlineSupport;          /* 07: scan lines supported */
113     BYTE  NumberCharBlocks;         /* 08: total number of character blocks */
114     BYTE  ActiveCharBlocks;         /* 09: max. number of active character blocks */
115     WORD  MiscFlags;                /* 0A: miscellaneous function support flags */
116     WORD  _reserved1;               /* 0C: */
117     BYTE  SavePointerFlags;         /* 0E: save pointer function flags */
118     BYTE  _reserved2;               /* OF: */
119
120 } VIDEOFUNCTIONALITY;
121
122 #include "poppack.h"
123
124 extern HANDLE16 DOSMEM_BiosDataSeg;
125 extern HANDLE16 DOSMEM_BiosSysSeg;
126 extern BIOSDATA * DOSMEM_BiosData();
127 extern BYTE     * DOSMEM_BiosSys();
128
129 extern DWORD DOSMEM_CollateTable;
130
131 extern DWORD DOSMEM_ErrorCall;
132 extern DWORD DOSMEM_ErrorBuffer;
133
134 extern DWORD DOS_LOLSeg;
135 extern struct _DOS_LISTOFLISTS * DOSMEM_LOL();
136
137 extern BOOL DOSMEM_Init(BOOL);
138 extern void   DOSMEM_Tick(WORD timer);
139 extern WORD   DOSMEM_AllocSelector(WORD);
140 extern char * DOSMEM_MemoryBase(void);
141 extern LPVOID DOSMEM_GetBlock(UINT size, UINT16* p);
142 extern BOOL DOSMEM_FreeBlock(void* ptr);
143 extern LPVOID DOSMEM_ResizeBlock(void* ptr, UINT size, UINT16* p);
144 extern UINT DOSMEM_Available(void);
145 extern LPVOID DOSMEM_MapRealToLinear(DWORD); /* real-mode to linear */
146 extern LPVOID DOSMEM_MapDosToLinear(UINT); /* linear DOS to Wine */
147 extern UINT DOSMEM_MapLinearToDos(LPVOID); /* linear Wine to DOS */
148
149 /* memory/instr.c */
150 extern BOOL INSTR_EmulateInstruction( CONTEXT86 *context );
151
152 /* msdos/devices.c */
153 extern void DOSDEV_InstallDOSDevices(void);
154 extern DWORD DOSDEV_Console(void);
155 extern DWORD DOSDEV_FindCharDevice(char*name);
156 extern int DOSDEV_Peek(DWORD dev, BYTE*data);
157 extern int DOSDEV_Read(DWORD dev, DWORD buf, int buflen);
158 extern int DOSDEV_Write(DWORD dev, DWORD buf, int buflen, int verify);
159 extern int DOSDEV_IoctlRead(DWORD dev, DWORD buf, int buflen);
160 extern int DOSDEV_IoctlWrite(DWORD dev, DWORD buf, int buflen);
161
162 /* msdos/interrupts.c */
163 extern FARPROC16 INT_GetPMHandler( BYTE intnum );
164 extern void INT_SetPMHandler( BYTE intnum, FARPROC16 handler );
165 extern FARPROC16 INT_GetRMHandler( BYTE intnum );
166 extern void INT_SetRMHandler( BYTE intnum, FARPROC16 handler );
167 extern FARPROC16 INT_CtxGetHandler( CONTEXT86 *context, BYTE intnum );
168 extern void INT_CtxSetHandler( CONTEXT86 *context, BYTE intnum, FARPROC16 handler );
169 extern int INT_RealModeInterrupt( BYTE intnum, CONTEXT86 *context );
170
171 /* msdos/ioports.c */
172 extern DWORD IO_inport( int port, int count );
173 extern void IO_outport( int port, int count, DWORD value );
174
175 /* msdos/int09.c */
176 extern void WINAPI INT_Int09Handler(CONTEXT86*);
177 extern void WINAPI INT_Int09SendScan(BYTE scan,BYTE ascii);
178 extern BYTE WINAPI INT_Int09ReadScan(BYTE*ascii);
179
180 /* msdos/int10.c */
181 extern void WINAPI INT_Int10Handler(CONTEXT86*);
182
183 /* msdos/int11.c */
184 extern void WINAPI INT_Int11Handler(CONTEXT86*);
185
186 /* msdos/int12.c */
187 extern void WINAPI INT_Int12Handler(CONTEXT86*);
188
189 /* msdos/int13.c */
190 extern void WINAPI INT_Int13Handler(CONTEXT86*);
191
192 /* msdos/int15.c */
193 extern void WINAPI INT_Int15Handler(CONTEXT86*);
194
195 /* msdos/int16.c */
196 extern void WINAPI INT_Int16Handler(CONTEXT86*);
197 extern int WINAPI INT_Int16ReadChar(BYTE*ascii,BYTE*scan,BOOL peek);
198 extern int WINAPI INT_Int16AddChar(BYTE ascii,BYTE scan);
199
200 /* msdos/int17.c */
201 extern void WINAPI INT_Int17Handler(CONTEXT86*);
202
203 /* msdos/int19.c */
204 extern void WINAPI INT_Int19Handler(CONTEXT86*);
205
206 /* msdos/int1a.c */
207 extern DWORD INT1A_GetTicksSinceMidnight(void);
208 extern void WINAPI INT_Int1aHandler(CONTEXT86*);
209
210 /* msdos/int20.c */
211 extern void WINAPI INT_Int20Handler(CONTEXT86*);
212
213 /* msdos/int25.c */
214 extern void WINAPI INT_Int25Handler(CONTEXT86*);
215
216 /* msdos/int26.c */
217 extern void WINAPI INT_Int26Handler(CONTEXT86*);
218
219 /* msdos/int29.c */
220 extern void WINAPI INT_Int29Handler(CONTEXT86*);
221
222 /* msdos/int2a.c */
223 extern void WINAPI INT_Int2aHandler(CONTEXT86*);
224
225 /* msdos/int2f.c */
226 extern void WINAPI INT_Int2fHandler(CONTEXT86*);
227
228 /* msdos/int33.c */
229 extern void WINAPI INT_Int33Handler(CONTEXT86*);
230 extern void WINAPI INT_Int33Message(UINT,WPARAM,LPARAM);
231
232 /* msdos/dpmi.c */
233 typedef void WINAPI (*RMCBPROC)(CONTEXT86*);
234 extern void WINAPI INT_Int31Handler(CONTEXT86*);
235 extern FARPROC16 WINAPI DPMI_AllocInternalRMCB(RMCBPROC);
236 extern void WINAPI DPMI_FreeInternalRMCB(FARPROC16);
237 extern int DPMI_CallRMProc(CONTEXT86*,LPWORD,int,int);
238
239 /* msdos/xms.c */
240 extern void WINAPI XMS_Handler(CONTEXT86*);
241
242 /* misc/aspi.c */
243 extern void ASPI_DOS_HandleInt(CONTEXT86 *context);
244
245 /* NOTE: Interrupts might get called from three modes: real mode, 16-bit, and 
246  *        (via DeviceIoControl) 32-bit. For automatic conversion of pointer 
247  *       parameters, interrupt handlers should use CTX_SEG_OFF_TO_LIN with
248  *       the contents of a segment register as second and the contents of
249  *       a *32-bit* general register as third parameter, e.g.
250  *          CTX_SEG_OFF_TO_LIN( context, DS_reg(context), EDX_reg(context) )
251  *       This will generate a linear pointer in all three cases:
252  *         Real-Mode:   Seg*16 + LOWORD(Offset) + V86BASE
253  *         16-bit:      convert (Seg, LOWORD(Offset)) to linear
254  *         32-bit:      use Offset as linear address (DeviceIoControl!)
255  *
256  *       Real-mode is recognized by checking the V86 bit in the flags register,
257  *       32-bit mode is recognized by checking whether 'seg' is a system selector
258  *       (0 counts also as 32-bit segment).
259  */
260 #define CTX_SEG_OFF_TO_LIN(context,seg,off) \
261     (ISV86(context) ? (void*)(V86BASE(context)+((seg)<<4)+(off&0xffff)) : \
262      (!seg || IS_SELECTOR_SYSTEM(seg))? (void *)off : PTR_SEG_OFF_TO_LIN(seg,off&0xffff))
263
264 #define INT_BARF(context,num) \
265     ERR( "int%x: unknown/not implemented parameters:\n" \
266                      "int%x: AX %04x, BX %04x, CX %04x, DX %04x, " \
267                      "SI %04x, DI %04x, DS %04x, ES %04x\n", \
268              (num), (num), AX_reg(context), BX_reg(context), CX_reg(context), \
269              DX_reg(context), SI_reg(context), DI_reg(context), \
270              (WORD)DS_reg(context), (WORD)ES_reg(context) )
271
272 #endif /* __WINE_MISCEMU_H */