Separated stuff for shv background contextmenu to separate file.
[wine.git] / include / miscemu.h
blobb27c070a7cd5c01530152d1360956e451b458354
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 "ldt.h"
13 /* msdos/dosconf.c */
14 extern int DOSCONF_ReadConfig(void);
16 /* msdos/dosmem.c */
17 #include "pshpack1.h"
19 typedef struct
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;
77 #include "poppack.h"
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 */
104 /* msdos/devices.c */
105 extern void DOSDEV_InstallDOSDevices(void);
107 /* msdos/interrupts.c */
108 extern FARPROC16 INT_GetPMHandler( BYTE intnum );
109 extern void INT_SetPMHandler( BYTE intnum, FARPROC16 handler );
110 extern FARPROC16 INT_GetRMHandler( BYTE intnum );
111 extern void INT_SetRMHandler( BYTE intnum, FARPROC16 handler );
112 extern FARPROC16 INT_CtxGetHandler( CONTEXT86 *context, BYTE intnum );
113 extern void INT_CtxSetHandler( CONTEXT86 *context, BYTE intnum, FARPROC16 handler );
114 extern int INT_RealModeInterrupt( BYTE intnum, CONTEXT86 *context );
116 /* msdos/ioports.c */
117 extern void IO_port_init (void);
118 extern DWORD IO_inport( int port, int count );
119 extern void IO_outport( int port, int count, DWORD value );
121 /* msdos/int09.c */
122 extern void WINAPI INT_Int09Handler(CONTEXT86*);
123 extern void WINAPI INT_Int09SendScan(BYTE);
124 extern BYTE WINAPI INT_Int09ReadScan(void);
126 /* msdos/int10.c */
127 extern void WINAPI INT_Int10Handler(CONTEXT86*);
129 /* msdos/int11.c */
130 extern void WINAPI INT_Int11Handler(CONTEXT86*);
132 /* msdos/int12.c */
133 extern void WINAPI INT_Int12Handler(CONTEXT86*);
135 /* msdos/int13.c */
136 extern void WINAPI INT_Int13Handler(CONTEXT86*);
138 /* msdos/int15.c */
139 extern void WINAPI INT_Int15Handler(CONTEXT86*);
141 /* msdos/int16.c */
142 extern void WINAPI INT_Int16Handler(CONTEXT86*);
143 extern int WINAPI INT_Int16AddChar(BYTE ascii,BYTE scan);
145 /* msdos/int17.c */
146 extern void WINAPI INT_Int17Handler(CONTEXT86*);
148 /* msdos/int19.c */
149 extern void WINAPI INT_Int19Handler(CONTEXT86*);
151 /* msdos/int1a.c */
152 extern DWORD INT1A_GetTicksSinceMidnight(void);
153 extern void WINAPI INT_Int1aHandler(CONTEXT86*);
155 /* msdos/int20.c */
156 extern void WINAPI INT_Int20Handler(CONTEXT86*);
158 /* msdos/int25.c */
159 extern void WINAPI INT_Int25Handler(CONTEXT86*);
161 /* msdos/int26.c */
162 extern void WINAPI INT_Int26Handler(CONTEXT86*);
164 /* msdos/int29.c */
165 extern void WINAPI INT_Int29Handler(CONTEXT86*);
167 /* msdos/int2f.c */
168 extern void WINAPI INT_Int2fHandler(CONTEXT86*);
170 /* msdos/int33.c */
171 extern void WINAPI INT_Int33Handler(CONTEXT86*);
172 extern void WINAPI INT_Int33Message(UINT,WPARAM,LPARAM);
174 /* msdos/dpmi.c */
175 typedef void WINAPI (*RMCBPROC)(CONTEXT86*);
176 extern void WINAPI INT_Int31Handler(CONTEXT86*);
177 extern FARPROC16 WINAPI DPMI_AllocInternalRMCB(RMCBPROC);
178 extern void WINAPI DPMI_FreeInternalRMCB(FARPROC16);
179 extern int DPMI_CallRMProc(CONTEXT86*,LPWORD,int,int);
181 /* msdos/xms.c */
182 extern void WINAPI XMS_Handler(CONTEXT86*);
184 /* loader/signal.c */
185 extern BOOL SIGNAL_Init(void);
186 extern void SIGNAL_SetHandler( int sig, void (*func)(), int flags );
187 extern void SIGNAL_MaskAsyncEvents( BOOL flag );
189 /* misc/aspi.c */
190 extern void ASPI_DOS_HandleInt(CONTEXT86 *context);
192 /* NOTE: Interrupts might get called from three modes: real mode, 16-bit, and
193 * (via DeviceIoControl) 32-bit. For automatic conversion of pointer
194 * parameters, interrupt handlers should use CTX_SEG_OFF_TO_LIN with
195 * the contents of a segement register as second and the contents of
196 * a *32-bit* general register as third parameter, e.g.
197 * CTX_SEG_OFF_TO_LIN( context, DS_reg(context), EDX_reg(context) )
198 * This will generate a linear pointer in all three cases:
199 * Real-Mode: Seg*16 + LOWORD(Offset) + V86BASE
200 * 16-bit: convert (Seg, LOWORD(Offset)) to linear
201 * 32-bit: use Offset as linear address (DeviceIoControl!)
203 * Real-mode is recognized by checking the V86 bit in the flags register,
204 * 32-bit mode is recognized by checking whether 'seg' is a system selector
205 * (0 counts also as 32-bit segment).
207 #define CTX_SEG_OFF_TO_LIN(context,seg,off) \
208 (ISV86(context) ? (void*)(V86BASE(context)+((seg)<<4)+(off&0xffff)) : \
209 (!seg || IS_SELECTOR_SYSTEM(seg))? (void *)off : PTR_SEG_OFF_TO_LIN(seg,off&0xffff))
211 #define INT_BARF(context,num) \
212 fprintf( stderr, "int%x: unknown/not implemented parameters:\n" \
213 "int%x: AX %04x, BX %04x, CX %04x, DX %04x, " \
214 "SI %04x, DI %04x, DS %04x, ES %04x\n", \
215 (num), (num), AX_reg(context), BX_reg(context), CX_reg(context), \
216 DX_reg(context), SI_reg(context), DI_reg(context), \
217 (WORD)DS_reg(context), (WORD)ES_reg(context) )
219 #endif /* __WINE_MISCEMU_H */