2 * Interrupt vectors emulation
4 * Copyright 1995 Alexandre Julliard
12 #include "registers.h"
13 #include "stackframe.h"
17 static SEGPTR INT_Vectors
[256];
19 /* Ordinal number for interrupt 0 handler in WINPROCS.DLL */
20 #define FIRST_INTERRUPT_ORDINAL 100
23 /**********************************************************************
29 HMODULE hModule
= GetModuleHandle( "WINPROCS" );
31 for (vector
= 0; vector
< 256; vector
++)
33 if (!(INT_Vectors
[vector
] = MODULE_GetEntryPoint( hModule
,
34 FIRST_INTERRUPT_ORDINAL
+vector
)))
36 fprintf(stderr
,"Internal error: no vector for int %02x\n",vector
);
44 /**********************************************************************
47 * Return the interrupt vector for a given interrupt.
49 SEGPTR
INT_GetHandler( BYTE intnum
)
51 return INT_Vectors
[intnum
];
55 /**********************************************************************
58 * Set the interrupt handler for a given interrupt.
60 void INT_SetHandler( BYTE intnum
, SEGPTR handler
)
62 dprintf_int( stddeb
, "Set interrupt vector %02x <- %04x:%04x\n",
63 intnum
, HIWORD(handler
), LOWORD(handler
) );
64 INT_Vectors
[intnum
] = handler
;
68 /**********************************************************************
71 void INT_DummyHandler( struct sigcontext_struct context
)
74 CURRENT_STACK16
->ordinal_number
- FIRST_INTERRUPT_ORDINAL
);
78 /**********************************************************************
81 * Handler for int 11h (get equipment list).
83 void INT_Int11Handler( struct sigcontext_struct context
)
86 int parallelports
= 0;
90 /* borrowed from Ralph Brown's interrupt lists
92 bits 15-14: number of parallel devices
93 bit 13: [Conv] Internal modem
95 bits 11- 9: number of serial devices
97 bits 7- 6: number of diskette drives minus one
98 bits 5- 4: Initial video mode:
104 bit 2: [PS] =1 if pointing device
106 bit 1: =1 if math co-processor
107 bit 0: =1 if diskette available for boot
109 /* Currently the only of these bits correctly set are:
110 bits 15-14 } Added by William Owen Smith,
111 bits 11-9 } wos@dcs.warwick.ac.uk
116 if (DRIVE_IsValid(0)) diskdrives
++;
117 if (DRIVE_IsValid(1)) diskdrives
++;
118 if (diskdrives
) diskdrives
--;
120 for (x
=0; x
!=MAX_PORTS
; x
++)
122 if (COM
[x
].devicename
)
124 if (LPT
[x
].devicename
)
127 if (serialports
> 7) /* 3 bits -- maximum value = 7 */
129 if (parallelports
> 3) /* 2 bits -- maximum value = 3 */
132 AX_reg(&context
) = (diskdrives
<< 6) | (serialports
<< 9) |
133 (parallelports
<< 14) | 0x02;
137 /**********************************************************************
140 * Handler for int 12h (get memory size).
142 void INT_Int12Handler( struct sigcontext_struct context
)
144 AX_reg(&context
) = 640;
148 /**********************************************************************
151 * Handler for int 15h.
153 void INT_Int15Handler( struct sigcontext_struct context
)
155 INT_BARF( &context
, 0x15 );
159 /**********************************************************************
162 * Handler for int 16h (keyboard).
164 void INT_Int16Handler( struct sigcontext_struct context
)
166 INT_BARF( &context
, 0x16 );