2 * Interrupt vectors emulation
4 * Copyright 1995 Alexandre Julliard
14 #include "registers.h"
15 #include "stackframe.h"
19 static SEGPTR INT_Vectors
[256];
21 /* Ordinal number for interrupt 0 handler in WINPROCS.DLL */
22 #define FIRST_INTERRUPT_ORDINAL 100
25 /**********************************************************************
31 HMODULE hModule
= GetModuleHandle( "WINPROCS" );
33 for (vector
= 0; vector
< 256; vector
++)
35 if (!(INT_Vectors
[vector
] = MODULE_GetEntryPoint( hModule
,
36 FIRST_INTERRUPT_ORDINAL
+vector
)))
38 fprintf(stderr
,"Internal error: no vector for int %02x\n",vector
);
46 /**********************************************************************
49 * Return the interrupt vector for a given interrupt.
51 SEGPTR
INT_GetHandler( BYTE intnum
)
53 return INT_Vectors
[intnum
];
57 /**********************************************************************
60 * Set the interrupt handler for a given interrupt.
62 void INT_SetHandler( BYTE intnum
, SEGPTR handler
)
64 dprintf_int( stddeb
, "Set interrupt vector %02x <- %04x:%04x\n",
65 intnum
, HIWORD(handler
), LOWORD(handler
) );
66 INT_Vectors
[intnum
] = handler
;
70 /**********************************************************************
73 void INT_DummyHandler( struct sigcontext_struct context
)
76 CURRENT_STACK16
->ordinal_number
- FIRST_INTERRUPT_ORDINAL
);
80 /**********************************************************************
83 * Handler for int 11h (get equipment list).
85 void INT_Int11Handler( struct sigcontext_struct context
)
88 int parallelports
= 0;
92 /* borrowed from Ralph Brown's interrupt lists
94 bits 15-14: number of parallel devices
95 bit 13: [Conv] Internal modem
97 bits 11- 9: number of serial devices
99 bits 7- 6: number of diskette drives minus one
100 bits 5- 4: Initial video mode:
106 bit 2: [PS] =1 if pointing device
108 bit 1: =1 if math co-processor
109 bit 0: =1 if diskette available for boot
111 /* Currently the only of these bits correctly set are:
112 bits 15-14 } Added by William Owen Smith,
113 bits 11-9 } wos@dcs.warwick.ac.uk
118 if (DRIVE_IsValid(0)) diskdrives
++;
119 if (DRIVE_IsValid(1)) diskdrives
++;
120 if (diskdrives
) diskdrives
--;
122 for (x
=0; x
!=MAX_PORTS
; x
++)
124 if (COM
[x
].devicename
)
126 if (LPT
[x
].devicename
)
129 if (serialports
> 7) /* 3 bits -- maximum value = 7 */
131 if (parallelports
> 3) /* 2 bits -- maximum value = 3 */
134 AX_reg(&context
) = (diskdrives
<< 6) | (serialports
<< 9) |
135 (parallelports
<< 14) | 0x02;
139 /**********************************************************************
142 * Handler for int 12h (get memory size).
144 void INT_Int12Handler( struct sigcontext_struct context
)
146 AX_reg(&context
) = 640;
150 /**********************************************************************
153 * Handler for int 15h.
155 void INT_Int15Handler( struct sigcontext_struct context
)
157 INT_BARF( &context
, 0x15 );
161 /**********************************************************************
164 * Handler for int 16h (keyboard).
166 void INT_Int16Handler( struct sigcontext_struct context
)
168 INT_BARF( &context
, 0x16 );