Release 950606
[wine/gsoc_dplay.git] / miscemu / interrupts.c
blob01f957e837413c95be377b8019955353a9f3b28b
1 /*
2 * Interrupt vectors emulation
4 * Copyright 1995 Alexandre Julliard
5 */
7 #include "windows.h"
8 #include "miscemu.h"
9 #include "module.h"
10 #include "stddebug.h"
11 #include "debug.h"
13 static SEGPTR INT_Vectors[256];
15 /* Ordinal number for interrupt 0 handler in WINPROCS.DLL */
16 #define FIRST_INTERRUPT_ORDINAL 100
19 /**********************************************************************
20 * INT_Init
22 BOOL INT_Init(void)
24 SEGPTR addr, dummyHandler;
25 WORD vector;
26 HMODULE hModule = GetModuleHandle( "WINPROCS" );
28 dummyHandler = MODULE_GetEntryPoint( hModule, FIRST_INTERRUPT_ORDINAL+256);
29 for (vector = 0; vector < 256; vector++)
31 addr = MODULE_GetEntryPoint( hModule, FIRST_INTERRUPT_ORDINAL+vector );
32 INT_Vectors[vector] = addr ? addr : dummyHandler;
34 return TRUE;
38 /**********************************************************************
39 * INT_GetHandler
41 * Return the interrupt vector for a given interrupt.
43 SEGPTR INT_GetHandler( BYTE intnum )
45 dprintf_int( stddeb, "Get interrupt vector %02x -> %04x:%04x\n",
46 intnum, HIWORD(INT_Vectors[intnum]),
47 LOWORD(INT_Vectors[intnum]) );
48 return INT_Vectors[intnum];
52 /**********************************************************************
53 * INT_SetHandler
55 * Set the interrupt handler for a given interrupt.
57 void INT_SetHandler( BYTE intnum, SEGPTR handler )
59 dprintf_int( stddeb, "Set interrupt vector %02x <- %04x:%04x\n",
60 intnum, HIWORD(handler), LOWORD(handler) );
61 INT_Vectors[intnum] = handler;
65 /**********************************************************************
66 * INT_DummyHandler
68 void INT_DummyHandler( struct sigcontext_struct context )
70 dprintf_int( stddeb, "Dummy handler called!\n" );
73 /**********************************************************************
74 * INT_Int10Handler
76 void INT_Int10Handler( struct sigcontext_struct context )
78 dprintf_int( stddeb, "int 10 called indirectly through handler!\n" );
79 do_int10( &context );
83 /**********************************************************************
84 * INT_Int13Handler
86 void INT_Int13Handler( struct sigcontext_struct context )
88 dprintf_int( stddeb, "int 13 called indirectly through handler!\n" );
89 do_int13( &context );
93 /**********************************************************************
94 * INT_Int15Handler
96 void INT_Int15Handler( struct sigcontext_struct context )
98 dprintf_int( stddeb, "int 15 called indirectly through handler!\n" );
99 do_int15( &context );
103 /**********************************************************************
104 * INT_Int16Handler
106 void INT_Int16Handler( struct sigcontext_struct context )
108 dprintf_int( stddeb, "int 16 called indirectly through handler!\n" );
109 do_int16( &context );
113 /**********************************************************************
114 * INT_Int1aHandler
116 void INT_Int1aHandler( struct sigcontext_struct context )
118 dprintf_int( stddeb, "int 1a called indirectly through handler!\n" );
119 do_int1a( &context );
123 /**********************************************************************
124 * INT_Int21Handler
126 void INT_Int21Handler( struct sigcontext_struct context )
128 dprintf_int( stddeb, "int 21 called indirectly through handler!\n" );
129 do_int21( &context );
133 /**********************************************************************
134 * INT_Int25Handler
136 void INT_Int25Handler( struct sigcontext_struct context )
138 dprintf_int( stddeb, "int 25 called indirectly through handler!\n" );
139 do_int25( &context );
143 /**********************************************************************
144 * INT_Int26Handler
146 void INT_Int26Handler( struct sigcontext_struct context )
148 dprintf_int( stddeb, "int 26 called indirectly through handler!\n" );
149 do_int26( &context );
153 /**********************************************************************
154 * INT_Int2aHandler
156 void INT_Int2aHandler( struct sigcontext_struct context )
158 dprintf_int( stddeb, "int 2a called indirectly through handler!\n" );
159 do_int2a( &context );
163 /**********************************************************************
164 * INT_Int2fHandler
166 void INT_Int2fHandler( struct sigcontext_struct context )
168 dprintf_int( stddeb, "int 2f called indirectly through handler!\n" );
169 do_int2f( &context );
173 /**********************************************************************
174 * INT_Int31Handler
176 void INT_Int31Handler( struct sigcontext_struct context )
178 dprintf_int( stddeb, "int 31 called indirectly through handler!\n" );
179 do_int31( &context );
183 /**********************************************************************
184 * INT_Int5cHandler
186 void INT_Int5cHandler( struct sigcontext_struct context )
188 dprintf_int( stddeb, "int 5c called indirectly through handler!\n" );
189 do_int5c( &context );