Release 950817
[wine/multimedia.git] / miscemu / interrupts.c
bloba9b8b8abdcd4b1435527c0cb889714ecd397840e
1 /*
2 * Interrupt vectors emulation
4 * Copyright 1995 Alexandre Julliard
5 */
7 #include "windows.h"
8 #include "miscemu.h"
9 #include "dos_fs.h"
10 #include "module.h"
11 #include "registers.h"
12 #include "stackframe.h"
13 #include "stddebug.h"
14 #include "debug.h"
16 static SEGPTR INT_Vectors[256];
18 /* Ordinal number for interrupt 0 handler in WINPROCS.DLL */
19 #define FIRST_INTERRUPT_ORDINAL 100
22 /**********************************************************************
23 * INT_Init
25 BOOL INT_Init(void)
27 WORD vector;
28 HMODULE hModule = GetModuleHandle( "WINPROCS" );
30 for (vector = 0; vector < 256; vector++)
32 if (!(INT_Vectors[vector] = MODULE_GetEntryPoint( hModule,
33 FIRST_INTERRUPT_ORDINAL+vector )))
35 fprintf(stderr,"Internal error: no vector for int %02x\n",vector);
36 return FALSE;
39 return TRUE;
43 /**********************************************************************
44 * INT_GetHandler
46 * Return the interrupt vector for a given interrupt.
48 SEGPTR INT_GetHandler( BYTE intnum )
50 return INT_Vectors[intnum];
54 /**********************************************************************
55 * INT_SetHandler
57 * Set the interrupt handler for a given interrupt.
59 void INT_SetHandler( BYTE intnum, SEGPTR handler )
61 dprintf_int( stddeb, "Set interrupt vector %02x <- %04x:%04x\n",
62 intnum, HIWORD(handler), LOWORD(handler) );
63 INT_Vectors[intnum] = handler;
67 /**********************************************************************
68 * INT_DummyHandler
70 void INT_DummyHandler( struct sigcontext_struct context )
72 INT_BARF( &context,
73 CURRENT_STACK16->ordinal_number - FIRST_INTERRUPT_ORDINAL );
77 /**********************************************************************
78 * INT_Int11Handler
80 * Handler for int 11h (get equipment list).
82 void INT_Int11Handler( struct sigcontext_struct context )
84 AX_reg(&context) = DOS_GetEquipment();
88 /**********************************************************************
89 * INT_Int12Handler
91 * Handler for int 12h (get memory size).
93 void INT_Int12Handler( struct sigcontext_struct context )
95 AX_reg(&context) = 640;
99 /**********************************************************************
100 * INT_Int15Handler
102 * Handler for int 15h.
104 void INT_Int15Handler( struct sigcontext_struct context )
106 INT_BARF( &context, 0x15 );
110 /**********************************************************************
111 * INT_Int16Handler
113 * Handler for int 16h (keyboard).
115 void INT_Int16Handler( struct sigcontext_struct context )
117 INT_BARF( &context, 0x16 );