Implemented SHBrowseForFolder() dialog.
[wine/multimedia.git] / msdos / interrupts.c
blobf18615f01d7878489511e190dd80510e48522699
1 /*
2 * Interrupt vectors emulation
4 * Copyright 1995 Alexandre Julliard
5 */
7 #include <sys/types.h>
9 #include "windows.h"
10 #include "drive.h"
11 #include "miscemu.h"
12 #include "msdos.h"
13 #include "module.h"
14 #include "stackframe.h"
15 #include "debug.h"
17 static FARPROC16 INT_Vectors[256];
20 /**********************************************************************
21 * INT_GetPMHandler
23 * Return the protected mode interrupt vector for a given interrupt.
25 FARPROC16 INT_GetPMHandler( BYTE intnum )
27 return INT_Vectors[intnum];
31 /**********************************************************************
32 * INT_SetPMHandler
34 * Set the protected mode interrupt handler for a given interrupt.
36 void INT_SetPMHandler( BYTE intnum, FARPROC16 handler )
38 TRACE(int, "Set protected mode interrupt vector %02x <- %04x:%04x\n",
39 intnum, HIWORD(handler), LOWORD(handler) );
40 INT_Vectors[intnum] = handler;
44 /**********************************************************************
45 * INT_GetRMHandler
47 * Return the real mode interrupt vector for a given interrupt.
49 FARPROC16 INT_GetRMHandler( BYTE intnum )
51 return ((FARPROC16*)DOSMEM_MemoryBase(0))[intnum];
55 /**********************************************************************
56 * INT_SetRMHandler
58 * Set the real mode interrupt handler for a given interrupt.
60 void INT_SetRMHandler( BYTE intnum, FARPROC16 handler )
62 TRACE(int, "Set real mode interrupt vector %02x <- %04x:%04x\n",
63 intnum, HIWORD(handler), LOWORD(handler) );
64 ((FARPROC16*)DOSMEM_MemoryBase(0))[intnum] = handler;
68 /**********************************************************************
69 * INT_CtxGetHandler
71 * Return the interrupt vector for a given interrupt.
73 FARPROC16 INT_CtxGetHandler( CONTEXT *context, BYTE intnum )
75 if (ISV86(context))
76 return ((FARPROC16*)V86BASE(context))[intnum];
77 else
78 return INT_GetPMHandler(intnum);
82 /**********************************************************************
83 * INT_CtxSetHandler
85 * Set the interrupt handler for a given interrupt.
87 void INT_CtxSetHandler( CONTEXT *context, BYTE intnum, FARPROC16 handler )
89 if (ISV86(context)) {
90 TRACE(int, "Set real mode interrupt vector %02x <- %04x:%04x\n",
91 intnum, HIWORD(handler), LOWORD(handler) );
92 ((FARPROC16*)V86BASE(context))[intnum] = handler;
93 } else
94 INT_SetPMHandler(intnum, handler);
98 /**********************************************************************
99 * INT_RealModeInterrupt
101 * Handle real mode interrupts
103 int INT_RealModeInterrupt( BYTE intnum, PCONTEXT context )
105 /* we should really map to if1632/wprocs.spec, but not all
106 * interrupt handlers are adapted to support real mode yet */
107 switch (intnum) {
108 case 0x10:
109 INT_Int10Handler(context);
110 break;
111 case 0x11:
112 INT_Int11Handler(context);
113 break;
114 case 0x13:
115 INT_Int13Handler(context);
116 break;
117 case 0x16:
118 INT_Int16Handler(context);
119 break;
120 case 0x17:
121 INT_Int17Handler(context);
122 break;
123 case 0x1a:
124 INT_Int1aHandler(context);
125 break;
126 case 0x20:
127 INT_Int20Handler(context);
128 break;
129 case 0x21:
130 DOS3Call(context);
131 break;
132 case 0x25:
133 INT_Int25Handler(context);
134 break;
135 case 0x2f:
136 INT_Int2fHandler(context);
137 break;
138 case 0x31:
139 INT_Int31Handler(context);
140 break;
141 case 0x29:
142 INT_Int29Handler(context);
143 break;
144 default:
145 FIXME(int, "Unknown Interrupt in DOS mode: 0x%x\n", intnum);
146 return 1;
148 return 0;