Microsoft (R) Macro Assembler Version 5.10                  2/14/25 23:45:30
GRTABHAN - INTERRUPT HANDLER FOR INT 2FH, GRAFTABL LOADED   Page     1-1


					PAGE	90,132			;A2
					TITLE	GRTABHAN - INTERRUPT HANDLER FOR INT 2FH, GRAFTABL LOADED
				;****************** START OF SPECIFICATIONS *****************************
				; MODULE NAME: GRTABHAN.SAL
				
				; DESCRIPTIVE NAME: For GRAFTABL, this is the Multiplexor Interrupt Handler
				
				;FUNCTION: This module contains the Interrupt Handler that will be hooked
				;	    into the INT 2FH vector.  When invoked with AL=0, it responds
				;	    that GRAFTABL is loaded by changing AL to contain hex FF.  If
				;	    option AL=1 specified, it puts into the vector at DS:[BX] the
				;	    pointer to the previously loaded table.
				
				; NOTES:
				;	 This module should be processed with the SALUT preprocessor:
				
				;		SALUT GRTABHAN
				
				;	 To assemble these modules, the alphabetical or sequential
				;	 ordering of segments may be used.
				
				;	 For LINK instructions, refer to the PROLOG of the main module,
				;	 GRTAB.SAL.  This module, containing a resident interrupt handler,
				;	 should be first in the list of .OBJ to be linked.
				
				;	 At the time this handler code is made resident, the loader, GRTAB,
				;	 made certain instruction modifications.  PATCH_OFF and PATCH_SEG
				;	 are the immediate word fields of two move word immediate to
				;	 storage type of instructions.	The loaded Revised these to
				;	 contain the offset and the segid respectively of where the
				;	 resident font table would be that is to stay resident.
				
				;	 Also at load time, GRTAB made another instruction modification by
				;	 changing the JUMP DUMMY instruction's DWORD immediate field to
				;	 contain the vector pointing to the previous owner of the
				;	 Multiplexor Interrupt Vector.
				
				; ENTRY POINT: There are two entry points: one, from DOS at 100H, is
				;	    END_PSP.  The jump instruction there has nothing to do with
				;	    the interrupt handler, but merely jumps to the GRTAB module to
				;	    what is effectively the real DOS entry point, ENTRY_POINT.
				
				;	    The other is where the interrupt vector will be set to point,
				;	    the entry point to the interrupt handler code:  HANDLER.
				
				;	    For the rest of this module description, the HANDLER entry
				;	    point conditions are being described.
				
				; INPUT: AH = Multiplexor Number.  I do nothing if this is not my own.
				;	      The value of the Multiplexor Number is defined in the EQU:
				;	      MY_MULTIPLEXOR_NUMBER as being the value, B0H.
				;	 AL = Function Request.  There are two functions recognized:
				;		    0 = "GET INSTALLED STATE"
				;		    1 = "WHERE ARE YOU?"
				;			 and DS:BX points to vector to receive pointer
				;			 to the previously installed GRAFTABL table.
				;		    If Function request is not '1', it is assumed to be '0'.
				
				; EXIT-NORMAL: If the proper multiplexor number is presented, respond with
				;	       AH = 0FFH, otherwise, pass control to previous owner
				;	       of this interrupt.
				
				; EXIT-ERROR: None
				
				; INTERNAL REFERENCES:
				;    ROUTINES: none
				
				;    DATA AREAS:
				;	   PUBLIC symbols:
				;	 PREV_OWN      Far jump direct to previous owner of interrupt 2FH.
				;	 PATCH_OFF     Offset portion of vector pointing to loaded char cable.
				;	 PATCH_SEG     Segment portion of vector pointing to loaded char table.
				;	 HANDLER       Entry point pointed to by the vector at interrupt 2FH.
				;	 HANDLER_SIZE  Location of the end of the resident code portion of the
				;		   interrupt 2FH handler, including the 60H bytes left of
				;		   the PSP, so this offset is relative to the start of the PSP
				;		   after the code has been relocated downward into the PSP.
				;	 MPEXNUM       The byte containing the value defined
				;		   as being the id checked for when INT 2FH is called used
				;		   to identify this GRAFTABL member of the multiplexor chain.
				;
				
				; EXTERNAL REFERENCES:
				;    ROUTINES: none
				
				;    DATA AREAS: none
Microsoft (R) Macro Assembler Version 5.10                  2/14/25 23:45:30
GRTABHAN - INTERRUPT HANDLER FOR INT 2FH, GRAFTABL LOADED   Page     1-2


				
				;****************** END OF SPECIFICATIONS *****************************
				;		    $SALUT (4,21,25,41)
						    HEADER <MACRO DEFINITIONS, STRUC DEFINITIONS, EQUATES>
Microsoft (R) Macro Assembler Version 5.10                  2/14/25 23:45:30
GRTABHAN - INTERRUPT HANDLER FOR INT 2FH, GRAFTABL LOADED   Page     1-3
MACRO DEFINITIONS, STRUC DEFINITIONS, EQUATES               

						    INCLUDE PATHMAC.INC ;AN006;
			     C	;;***********************************************************************
			     C	;; NAME: pathlabl
			     C	;; DESC: creates a public label at the spot it is placed, using the name
			     C	;;       given.
			     C	;; INPUT: either module name or procedure name
			     C	;; OUTPUT: public label
			     C	;; LOGIC: LBL-parameter-name will have four values -
			     C	;;            - one for each pass (2)
			     C	;;            - one for start and one for stop
			     C	;;        if LBL is not defined, it is first pass, at beginning label
			     C	;;              - set it to 1 and create the start label
			     C	;;        if LBL = 1, it is first pass, at end label
			     C	;;              - set it to 2 and create stop label
			     C	;;        if LBL = 2, it is second pass, at beginning label
			     C	;;              - set it to 3 and create the start label
			     C	;;        if LBL = 3, it is second pass, at end label
			     C	;;              - set it to 4 and create stop label
			     C	;;        if LBL = 4, it is second pass,
			     C	;;              - this macro has been invoked more than twice with same parm
			     C	;;              - issue error message
			     C	;;***********************************************************************
			     C	
			     C	pathlabl MACRO pnam
			     C	IFNDEF LBL_&pnam                        ;;IF THIS IS THE FIRST TIME,
			     C	    LBL_&pnam = 0                       ;;DEFINE IT, INITIALLY ZERO
			     C	ELSE                                    ;;SINCE IT IS DEFINED
			     C	    IF (LBL_&pnam GT 3)                 ;;IF USED TOO MANY TIMES,
			     C	        .ERR NON-UNIQUE OPERAND ON PATHLABL
			     C	        EXITM                           ;;ABORT THIS GENERATION
			     C	    ENDIF
			     C	ENDIF
			     C	
			     C	IF (LBL_&pnam EQ 0) OR (LBL_&pnam EQ 2) ;;ready for START?
			     C	    $$A_START_&pnam:                    ;;create START label
			     C	    PUBLIC $$A_START_&pnam              ;;make it public
			     C	ELSE                                    ;;SINCE SWITCH MAY BE 1 OR 3,
			     C	    $$A_STOP_&pnam:                     ;;create STOP label
			     C	    PUBLIC $$A_STOP_&pnam               ;;make it public
			     C	ENDIF
			     C	LBL_&pnam = LBL_&pnam + 1               ;;INCREMENT SWITCH
			     C	ENDM
				HEADER		    MACRO TEXT
				.XLIST
						    SUBTTL TEXT
				.LIST
						    PAGE
						    ENDM
				; = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = =
				VECTOR		    STRUC
 0000  0000			VECOFF		    DW	?		;OFFSET PORTION OF VECTOR POINTER
 0002  0000			VECSEG		    DW	?		;SEGMENT PORTION OF VECTOR POINTER
 0004				VECTOR		    ENDS
				; = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = =
				;		DEFINITION OF FUNCTIONS TO BE REQUESTED OF INT 2FH
 = 0000				GET_INST_STATE	    EQU 0		;FUNCTION = "GET INSTALLED STATE"
 = 0001				WHERE_R_U	    EQU 1		;FUNCTION = "WHERE ARE YOU?"
									; REQUESTS VECTOR OF LOADED TABLE BE
									; PUT IN VECTOR POINTED TO BY DS:[BX]
 = 00F8				RES_FUNC	    EQU 0F8H		;RESERVED FUNCTIONS IN RANGE OF F8 TO FF, IGNORE
				
				;		OTHER EQUATES
 = 0000				PATCHED 	    EQU 0		;DUMMY VALUE, TO BE REPLACED AT EXECUTION TIME
 = 00FF				INSTALLED	    EQU 0FFH		;RESPONSE, INDICATES THIS HANDLER IS INSTALLED
 = 00B0				MY_MULTIPLEX_NUMBER EQU 0B0H		;THE UNIQUE IDENTIFICATION NUMBER ASSIGNED
									; TO "GRAFTABL" FOR INT 2FH
				; = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = =
 0000				DUMMY_SEG	    SEGMENT AT 0
 0000				DUMMY		    LABEL FAR		;NOTHING HERE REALLY, ONLY
									; USED TO MAKE MASM GENERATE A FAR CALL DIRECT
									; THE ABSOLUTE VECTOR IN THAT INS WILL BE PATCHED
				
 0000				DUMMY_SEG	    ENDS
				; = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = =
						    HEADER <DOS ENTRY POINT>
Microsoft (R) Macro Assembler Version 5.10                  2/14/25 23:45:30
GRTABHAN - INTERRUPT HANDLER FOR INT 2FH, GRAFTABL LOADED   Page     1-4
DOS ENTRY POINT                                             

 0000				CSEG		    SEGMENT PARA PUBLIC
				;THIS SEGMENT IS ALIGNED ON PARA SINCE IT IS THE START OF THE LOAD MODULE,
				; WHICH IS ON A PARA BOUNDARY ANYWAY.  THIS MODULE IS PADDED AT THE END
				; TO A MULTIPLE OF 16 BYTES, SO THE NEXT SEGMENT WILL ALSO START
				; ON A PARA BOUNDARY, WHICH WILL BE THE US CHARACTER SET TABLE.
				
						    ASSUME CS:CSEG
				
						    EXTRN ENTRY_POINT:NEAR
				
 0060						    ORG 60H
						    PUBLIC MOV_DEST
 0060				MOV_DEST	    LABEL BYTE		;WHERE THIS INTERRUPT HANDLER
									; WILL BE MOVED TO, FOLLOWED BY THE 1K TABLE.
 0100						    ORG 100H
						    PUBLIC END_PSP	;BEGINNING HERE, THIS WILL BE MOVED TO "MOV_DEST"
 = 0100				END_PSP 	    EQU $		;ENTRY POINT FROM DOS
 0100  E9 0000 E				    JMP ENTRY_POINT	;INIT THE INT HANDLER, SET UP CHAR TABLES
									; THIS JUMP TARGET IS DEFINED
									;  IN THE GRTAB.SAL MODULE
				;		AREAS TO BE PATCHED WITHIN THIS MODULE
				
						    PUBLIC PREV_OWN	;PATCH IS IN JMP INSTR TO PREVIOUS OWNER
				;THE ABOVE PATCH IS FIXED BY THE GRTAB.SAL MODULE, JUST BEFORE ALTERING THE 2FH VECTOR
				
						    PUBLIC PATCH_OFF	;OFFSET PORTION OF VECTOR POINTING TO LOADED CHAR TABLE
						    PUBLIC PATCH_SEG	;SEGMENT PORTION OF VECTOR POINTING TO LOADED CHAR TABLE
				;THE ABOVE TWO PATCHES ARE FIXED BY THE GRTAB.SAL MODULE, AT THE VERY BEGINNING.
				
				;THIS NEXT ONE BYTE FIELD SHOULD BE KEPT AS THE BYTE JUST PREVIOUS TO THE
				;INTERRUPT HANDLER ENTRY POINT AT "HANDLER".
						    PUBLIC MPEXNUM
 0103  B0			MPEXNUM 	    DB	MY_MULTIPLEX_NUMBER ;PATCHING THIS ONE BYTE WILL CHANGE FOR ALL THE VALUE
						    HEADER <MULTIPLEXOR INTERRUPT HANDLER>
Microsoft (R) Macro Assembler Version 5.10                  2/14/25 23:45:30
GRTABHAN - INTERRUPT HANDLER FOR INT 2FH, GRAFTABL LOADED   Page     1-5
MULTIPLEXOR INTERRUPT HANDLER                               

				;CONDITIONS OF REGS AT ENTRY TO HANDLER:
				;INPUT: AH = MULTIPLEXOR NUMBER.  I DO NOTHING IF THIS IS NOT MY OWN.
				;	AL = FUNCTION REQUEST.	THERE ARE TWO FUNCTIONS RECOGNIZED:
				;		   0 = "GET INSTALLED STATE"
				;		   1 = "WHERE ARE YOU?"
				;			AND DS:BX POINTS TO VECTOR TO RECEIVE POINTER
				;			TO THE PREVIOUSLY INSTALLED GRAFTABL TABLE.
				;		   IF FUNCTION REQUEST IS NOT '1', IT IS ASSUMED TO BE '0'.
				
						    PUBLIC HANDLER
 0104				HANDLER 	    PROC FAR		;INTERRUPT HANDLER ENTRY POINT
				; $SALUT (4,3,9,41)
				  PATHLABL GRTABHAN			;AN006;
 0104                        1	    $$A_START_GRTABHAN:                    ; 
 0104  2E: 3A 26 0103 R		  CMP	AH,MPEXNUM			;IS THIS MULTIPLEXOR REQUEST IS FOR ME?
				; $IF	E				;IF MY MULTIPLEX NUMBER IS CALLED
 0109  75 14			  JNE $$IF1
 010B  3C F8			      CMP   AL,RES_FUNC 		;IF IN RANGE F8-FF, DO NOTHING, JUST RETURN
				;     $IF   B
 010D  73 0F			      JNB $$IF2
 010F  3C 01				  CMP	AL,WHERE_R_U		;IF REQUEST FOR "WHERE ARE YOU?"
				;	  $IF	E
 0111  75 09				  JNE $$IF3
									;FOR THIS REQUEST, DS:BX POINTS TO A VECTOR
									; WHICH IS TO RECEIVE THE POINTER TO
									; WHERE THE ORIGINAL TABLE WAS LOADED
				
									;PASS OFFSET OF WHERE TABLE IS
 0113  C7 07 0000			      MOV   [BX].VECOFF,PATCHED ; TO FIRST WORD OF RESPONSE AREA
 = 0115				PATCH_OFF     EQU   WORD PTR $-2	;THE ACTUAL VALUE OF THE IMMEDIATE IS PATCHED IN
				
									;PASS SEGID OF WHERE TABLE IS
 0117  C7 47 02 0000			      MOV   [BX].VECSEG,PATCHED ; TO SECOND WORD OF RESPONSE AREA
 = 011A				PATCH_SEG     EQU   WORD PTR $-2	;THE ACTUAL VALUE OF THE IMMEDIATE IS PATCHED IN
				;	  $ENDIF
 011C				$$IF3:
 011C  B0 FF				  MOV	AL,INSTALLED		;SAY "INSTALLED"
				;     $ENDIF
 011E				$$IF2:
 011E  CF			      IRET				;RETURN TO INTERRUPT INVOKER
				; $ENDIF
 011F				$$IF1:
				;SINCE THE MULTIPLEX NUMBER IS FOR SOMEBODY ELSE, PASS THE CALL ON TO PREVIOUS OWNER
 011F				JMPREV: 				;REFERENCED WHEN PATCHING OUT "DUMMY"
 011F  EA 0000 ---- R		  JMP	DUMMY				;CHAIN ON TO THE PREVIOUS OWNER
									; OF THE VECTOR AT 1FH*4.
									; USAGE OF "DUMMY" HERE IS JUST A PLACE-HLDER
									; WHICH WILL BE REPLACED DURING EXECUTION OF LOADER
				  PATHLABL GRTABHAN			;AN006;
 0124                        1	    $$A_STOP_GRTABHAN:                     ; 
				;=================================================================
				  HEADER <POINTERS TO PREVIOUS OWNER, INSTRUCTION MODIFICATION>
Microsoft (R) Macro Assembler Version 5.10                  2/14/25 23:45:30
GRTABHAN - INTERRUPT HANDLER FOR INT 2FH, GRAFTABL LOADED   Page     1-6
POINTERS TO PREVIOUS OWNER, INSTRUCTION MODIFICATION        

				;	     $SALUT (4,14,20,41)
 = 0120				PREV_OWN     EQU   DWORD PTR JMPREV+1	;REFERENCED DURING REPLACEMENT OF "HANDLER"
									; IN THE ABOVE JMP INSTRUCTION
 0124				HANDLER      ENDP
					     IF    ($-CSEG) MOD 16	;IF NOT ALREADY ON 16 BYTE BOUNDARY
 0130						 ORG   ($-CSEG)+16-(($-CSEG) MOD 16) ;ADD PADDING TO GET TO 16 BYTE BOUNDARY
					     ENDIF
 = 0030				HANDLER_SIZE EQU   ($-CSEG)-(END_PSP-CSEG) ;MARK THE END OF RESIDENT EXECUTABLE ;AN000;
					     PUBLIC HANDLER_SIZE	; PORTION, NOT INCLUDING THE PSP	;AN000;
 0130				CSEG	     ENDS
					     END   END_PSP

Microsoft (R) Macro Assembler Version 5.10                  2/14/25 23:45:30
GRTABHAN - INTERRUPT HANDLER FOR INT 2FH, GRAFTABL LOADED   Symbols-1


Macros:

		N a m e			Lines

HEADER . . . . . . . . . . . . .  	   4
PATHLABL . . . . . . . . . . . .  	  16

Structures and Records:

                N a m e                 Width   # fields
                                        Shift   Width   Mask    Initial

VECTOR . . . . . . . . . . . . .  	0004	0002
  VECOFF . . . . . . . . . . . .  	0000
  VECSEG . . . . . . . . . . . .  	0002

Segments and Groups:

                N a m e         	Length	 Align	Combine Class

CSEG . . . . . . . . . . . . . .  	0130	PARA	PUBLIC	
DUMMY_SEG  . . . . . . . . . . .  	0000	AT	0000	

Symbols:            

                N a m e         	Type	 Value	 Attr

DUMMY  . . . . . . . . . . . . .  	L FAR 	0000	DUMMY_SEG

END_PSP  . . . . . . . . . . . .  	NEAR	0100	CSEG	Global
ENTRY_POINT  . . . . . . . . . .  	L NEAR	0000	CSEG	External

GET_INST_STATE . . . . . . . . .  	NUMBER	0000	

HANDLER  . . . . . . . . . . . .  	F PROC	0104	CSEG	Global	Length = 0020
HANDLER_SIZE . . . . . . . . . .  	NUMBER	0030		Global

INSTALLED  . . . . . . . . . . .  	NUMBER	00FF	

JMPREV . . . . . . . . . . . . .  	L NEAR	011F	CSEG

LBL_GRTABHAN . . . . . . . . . .  	NUMBER	0004	

MOV_DEST . . . . . . . . . . . .  	L BYTE	0060	CSEG	Global
MPEXNUM  . . . . . . . . . . . .  	L BYTE	0103	CSEG	Global
MY_MULTIPLEX_NUMBER  . . . . . .  	NUMBER	00B0	

PATCHED  . . . . . . . . . . . .  	NUMBER	0000	
PATCH_OFF  . . . . . . . . . . .  	WORD	0115	CSEG	Global
PATCH_SEG  . . . . . . . . . . .  	WORD	011A	CSEG	Global
PREV_OWN . . . . . . . . . . . .  	DWORD	0120	CSEG	Global

RES_FUNC . . . . . . . . . . . .  	NUMBER	00F8	

WHERE_R_U  . . . . . . . . . . .  	NUMBER	0001	

$$A_START_GRTABHAN . . . . . . .  	L NEAR	0104	CSEG	Global
$$A_STOP_GRTABHAN  . . . . . . .  	L NEAR	0124	CSEG	Global
$$IF1  . . . . . . . . . . . . .  	L NEAR	011F	CSEG
$$IF2  . . . . . . . . . . . . .  	L NEAR	011E	CSEG
$$IF3  . . . . . . . . . . . . .  	L NEAR	011C	CSEG
@CPU . . . . . . . . . . . . . .  	TEXT  0101h		
@FILENAME  . . . . . . . . . . .  	TEXT  grtabhan		
@VERSION . . . . . . . . . . . .  	TEXT  510		


    266 Source  Lines
    314 Total   Lines
     35 Symbols

  47132 + 217294 Bytes symbol space free

      0 Warning Errors
      0 Severe  Errors
