1 PAGE
90,132 ;\ f\eA\b\e2
2 TITLE GRTABHAN
- INTERRUPT HANDLER FOR
INT 2FH
, GRAFTABL LOADED
3 ;****************** START OF SPECIFICATIONS *****************************
4 ; MODULE NAME: GRTABHAN.SAL
6 ; DESCRIPTIVE NAME: For GRAFTABL, this is the Multiplexor Interrupt Handler
8 ;FUNCTION: This module contains the Interrupt Handler that will be hooked
9 ; into the INT 2FH vector. When invoked with AL=0, it responds
10 ; that GRAFTABL is loaded by changing AL to contain hex FF. If
11 ; option AL=1 specified, it puts into the vector at DS:[BX] the
12 ; pointer to the previously loaded table.
15 ; This module should be processed with the SALUT preprocessor:
19 ; To assemble these modules, the alphabetical or sequential
20 ; ordering of segments may be used.
22 ; For LINK instructions, refer to the PROLOG of the main module,
23 ; GRTAB.SAL. This module, containing a resident interrupt handler,
24 ; should be first in the list of .OBJ to be linked.
26 ; At the time this handler code is made resident, the loader, GRTAB,
27 ; made certain instruction modifications. PATCH_OFF and PATCH_SEG
28 ; are the immediate word fields of two move word immediate to
29 ; storage type of instructions. The loaded Revised these to
30 ; contain the offset and the segid respectively of where the
31 ; resident font table would be that is to stay resident.
33 ; Also at load time, GRTAB made another instruction modification by
34 ; changing the JUMP DUMMY instruction's DWORD immediate field to
35 ; contain the vector pointing to the previous owner of the
36 ; Multiplexor Interrupt Vector.
38 ; ENTRY POINT: There are two entry points: one, from DOS at 100H, is
39 ; END_PSP. The jump instruction there has nothing to do with
40 ; the interrupt handler, but merely jumps to the GRTAB module to
41 ; what is effectively the real DOS entry point, ENTRY_POINT.
43 ; The other is where the interrupt vector will be set to point,
44 ; the entry point to the interrupt handler code: HANDLER.
46 ; For the rest of this module description, the HANDLER entry
47 ; point conditions are being described.
49 ; INPUT: AH = Multiplexor Number. I do nothing if this is not my own.
50 ; The value of the Multiplexor Number is defined in the EQU:
51 ; MY_MULTIPLEXOR_NUMBER as being the value, B0H.
52 ; AL = Function Request. There are two functions recognized:
53 ; 0 = "GET INSTALLED STATE"
54 ; 1 = "WHERE ARE YOU?"
55 ; and DS:BX points to vector to receive pointer
56 ; to the previously installed GRAFTABL table.
57 ; If Function request is not '1', it is assumed to be '0'.
59 ; EXIT-NORMAL: If the proper multiplexor number is presented, respond with
60 ; AH = 0FFH, otherwise, pass control to previous owner
65 ; INTERNAL REFERENCES:
70 ; PREV_OWN Far jump direct to previous owner of interrupt 2FH.
71 ; PATCH_OFF Offset portion of vector pointing to loaded char cable.
72 ; PATCH_SEG Segment portion of vector pointing to loaded char table.
73 ; HANDLER Entry point pointed to by the vector at interrupt 2FH.
74 ; HANDLER_SIZE Location of the end of the resident code portion of the
75 ; interrupt 2FH handler, including the 60H bytes left of
76 ; the PSP, so this offset is relative to the start of the PSP
77 ; after the code has been relocated downward into the PSP.
78 ; MPEXNUM The byte containing the value defined
79 ; as being the id checked for when INT 2FH is called used
80 ; to identify this GRAFTABL member of the multiplexor chain.
83 ; EXTERNAL REFERENCES:
88 ;****************** END OF SPECIFICATIONS *****************************
90 %
OUT COMPONENT
=GRAFTABL
, MODULE
=GRTABHAN
.SAL...
93 HEADER
<MACRO DEFINITIONS
, STRUC DEFINITIONS
, EQUATES
>
94 INCLUDE PATHMAC
.INC ;AN006;
101 ; = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = =
103 VECOFF
DW ?
;OFFSET PORTION OF VECTOR POINTER
104 VECSEG
DW ?
;SEGMENT PORTION OF VECTOR POINTER
106 ; = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = =
107 ; DEFINITION OF FUNCTIONS TO BE REQUESTED OF INT 2FH
108 GET_INST_STATE EQU
0 ;FUNCTION = "GET INSTALLED STATE"
109 WHERE_R_U EQU
1 ;FUNCTION = "WHERE ARE YOU?"
110 ; REQUESTS VECTOR OF LOADED TABLE BE
111 ; PUT IN VECTOR POINTED TO BY DS:[BX]
112 RES_FUNC EQU
0F8H ;RESERVED FUNCTIONS IN RANGE OF F8 TO FF, IGNORE
115 PATCHED EQU
0 ;DUMMY VALUE, TO BE REPLACED AT EXECUTION TIME
116 INSTALLED EQU
0FFH ;RESPONSE, INDICATES THIS HANDLER IS INSTALLED
117 MY_MULTIPLEX_NUMBER EQU
0B0H ;THE UNIQUE IDENTIFICATION NUMBER ASSIGNED
118 ; TO "GRAFTABL" FOR INT 2FH
119 ; = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = =
120 DUMMY_SEG
SEGMENT AT 0
121 DUMMY
LABEL FAR ;NOTHING HERE REALLY, ONLY
122 ; USED TO MAKE MASM GENERATE A FAR CALL DIRECT
123 ; THE ABSOLUTE VECTOR IN THAT INS WILL BE PATCHED
126 ; = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = =
127 HEADER
<DOS
ENTRY POINT
>
128 CSEG
SEGMENT PARA
PUBLIC
129 ;THIS SEGMENT IS ALIGNED ON PARA SINCE IT IS THE START OF THE LOAD MODULE,
130 ; WHICH IS ON A PARA BOUNDARY ANYWAY. THIS MODULE IS PADDED AT THE END
131 ; TO A MULTIPLE OF 16 BYTES, SO THE NEXT SEGMENT WILL ALSO START
132 ; ON A PARA BOUNDARY, WHICH WILL BE THE US CHARACTER SET TABLE.
136 EXTRN ENTRY_POINT
:NEAR
140 MOV_DEST
LABEL BYTE ;WHERE THIS INTERRUPT HANDLER
141 ; WILL BE MOVED TO, FOLLOWED BY THE 1K TABLE.
143 PUBLIC END_PSP
;BEGINNING HERE, THIS WILL BE MOVED TO "MOV_DEST"
144 END_PSP EQU
$ ;ENTRY POINT FROM DOS
145 JMP ENTRY_POINT
;INIT THE INT HANDLER, SET UP CHAR TABLES
146 ; THIS JUMP TARGET IS DEFINED
147 ; IN THE GRTAB.SAL MODULE
148 ; AREAS TO BE PATCHED WITHIN THIS MODULE
150 PUBLIC PREV_OWN
;PATCH IS IN JMP INSTR TO PREVIOUS OWNER
151 ;THE ABOVE PATCH IS FIXED BY THE GRTAB.SAL MODULE, JUST BEFORE ALTERING THE 2FH VECTOR
153 PUBLIC PATCH_OFF
;OFFSET PORTION OF VECTOR POINTING TO LOADED CHAR TABLE
154 PUBLIC PATCH_SEG
;SEGMENT PORTION OF VECTOR POINTING TO LOADED CHAR TABLE
155 ;THE ABOVE TWO PATCHES ARE FIXED BY THE GRTAB.SAL MODULE, AT THE VERY BEGINNING.
157 ;THIS NEXT ONE BYTE FIELD SHOULD BE KEPT AS THE BYTE JUST PREVIOUS TO THE
158 ;INTERRUPT HANDLER ENTRY POINT AT "HANDLER".
160 MPEXNUM
DB MY_MULTIPLEX_NUMBER
;PATCHING THIS ONE BYTE WILL CHANGE FOR ALL THE VALUE
161 HEADER
<MULTIPLEXOR INTERRUPT HANDLER
>
162 ;CONDITIONS OF REGS AT ENTRY TO HANDLER:
163 ;INPUT: AH = MULTIPLEXOR NUMBER. I DO NOTHING IF THIS IS NOT MY OWN.
164 ; AL = FUNCTION REQUEST. THERE ARE TWO FUNCTIONS RECOGNIZED:
165 ; 0 = "GET INSTALLED STATE"
166 ; 1 = "WHERE ARE YOU?"
167 ; AND DS:BX POINTS TO VECTOR TO RECEIVE POINTER
168 ; TO THE PREVIOUSLY INSTALLED GRAFTABL TABLE.
169 ; IF FUNCTION REQUEST IS NOT '1', IT IS ASSUMED TO BE '0'.
172 HANDLER PROC
FAR ;INTERRUPT HANDLER ENTRY POINT
174 PATHLABL GRTABHAN
;AN006;
175 CMP AH,MPEXNUM
;IS THIS MULTIPLEXOR REQUEST IS FOR ME?
176 ; $IF E ;IF MY MULTIPLEX NUMBER IS CALLED
178 CMP AL,RES_FUNC
;IF IN RANGE F8-FF, DO NOTHING, JUST RETURN
181 CMP AL,WHERE_R_U
;IF REQUEST FOR "WHERE ARE YOU?"
184 ;FOR THIS REQUEST, DS:BX POINTS TO A VECTOR
185 ; WHICH IS TO RECEIVE THE POINTER TO
186 ; WHERE THE ORIGINAL TABLE WAS LOADED
188 ;PASS OFFSET OF WHERE TABLE IS
189 MOV [BX].VECOFF
,PATCHED
; TO FIRST WORD OF RESPONSE AREA
190 PATCH_OFF EQU
WORD PTR $-2 ;THE ACTUAL VALUE OF THE IMMEDIATE IS PATCHED IN
192 ;PASS SEGID OF WHERE TABLE IS
193 MOV [BX].VECSEG
,PATCHED
; TO SECOND WORD OF RESPONSE AREA
194 PATCH_SEG EQU
WORD PTR $-2 ;THE ACTUAL VALUE OF THE IMMEDIATE IS PATCHED IN
197 MOV AL,INSTALLED
;SAY "INSTALLED"
200 IRET ;RETURN TO INTERRUPT INVOKER
203 ;SINCE THE MULTIPLEX NUMBER IS FOR SOMEBODY ELSE, PASS THE CALL ON TO PREVIOUS OWNER
204 JMPREV: ;REFERENCED WHEN PATCHING OUT "DUMMY"
205 JMP DUMMY
;CHAIN ON TO THE PREVIOUS OWNER
206 ; OF THE VECTOR AT 1FH*4.
207 ; USAGE OF "DUMMY" HERE IS JUST A PLACE-HLDER
208 ; WHICH WILL BE REPLACED DURING EXECUTION OF LOADER
209 PATHLABL GRTABHAN
;AN006;
210 ;=================================================================
211 HEADER
<POINTERS TO PREVIOUS OWNER
, INSTRUCTION MODIFICATION
>
212 ; $SALUT (4,14,20,41)
213 PREV_OWN EQU
DWORD PTR JMPREV
+1 ;REFERENCED DURING REPLACEMENT OF "HANDLER"
214 ; IN THE ABOVE JMP INSTRUCTION
216 IF ($-CSEG
) MOD 16 ;IF NOT ALREADY ON 16 BYTE BOUNDARY
217 ORG ($-CSEG
)+16-(($-CSEG
) MOD 16) ;ADD PADDING TO GET TO 16 BYTE BOUNDARY
219 HANDLER_SIZE EQU
($-CSEG
)-(END_PSP
-CSEG
) ;MARK THE END OF RESIDENT EXECUTABLE ;AN000;
220 PUBLIC HANDLER_SIZE
; PORTION, NOT INCLUDING THE PSP ;AN000;