PAGE 66,132 TITLE PR_FILE.ASM ; ; ; ********** ; * PR_FILE.ASM - PRINTER-TO-FILE REDIRECTION UTILITY - VERSION 1.0 ; * LAST MODIFIED: 05/09/85 ; * COPYRIGHT (C) BY T.A. DANELIUK ; ********** ; ; ; ********** ; * SYSTEM EQUATES ; ********** ; ; DOS EQU 21H ; DOS INTERRUPT TERMINATE EQU 31H ; TERMINATE/STAY RESIDENT PRINTER_IR EQU 5CH ; PRINTER IR VECTOR ALLOC_MEM EQU 48H ; ALLOCATE MEMORY DOS FN SET_BLOCK EQU 4AH ; GROW OR SHRINK ALLOC. BLOCK EXIT EQU 4CH ; NORMAL EXIT TO DOS EOL EQU 0A0DH ; END-OF-LINE STRING STD_CON_OUT EQU 02H ; OUTPUT BYTE TO STDOUT ; ; ; ********** ; * CODE SEGMENT ; ********** ; ; PR_FILE SEGMENT WORD 'CODE' ASSUME CS:PR_FILE,DS:PR_FILE,ES:PR_FILE ; ; ORG 100H ; THIS WILL BE A .COM FILE ; ; START_RUN EQU THIS BYTE ; ; START: JMP INIT ; GO TO INITIALIZATION CODE RUNTIME: AND AL,AL ; CHECK IF 0 - PRINT REQ. JZ RUN_RET ; NO, JUST RETURN GOOD STATUS MOV DL,AL ; PRINT CHAR ON STDOUT MOV AH,STD_CON_OUT INT DOS RUN_RET: MOV AH,90H ; SET PRINTER STATUS, OK IRET ; AND RETURN ; ; END_RUN EQU THIS BYTE ; ; PAGE ; ********** ; * LOADER/INSTALL CODE ; ********** ; ; INIT: PUSHF ; SAVE IR STATUS CLI ; TURN 'EM OFF FOR NOW ; ; ; NOW POINT PRINTER VECTOR TO RUNTIME CODE ; ; XOR DX,DX ; POINT DS TO VECTOR TBL. MOV DS,DX MOV BP,PRINTER_IR ; LOCATION OF IR VECTOR MOV DS:[BP+2],CS ; SEGMENT OF CODE MOV WORD PTR DS:[BP],OFFSET RUNTIME ; OFFSET OF CODE ; ; ; NOW TERMINATE, BUT STAY RESIDENT ; ; XOR AL,AL ; SET RETURN ERROR CODE TO 0 MOV AH,TERMINATE ; TERMINATE & STAY RESIDENT FN MOV DX,END_RUN-START_RUN+100H ; SIZE OF RUN CODE IN BYTES MOV CL,4 ; CONVERT TO PARAGRAPHS SHR DX,CL ; BY DIVIDING BY 16 INC DX ; ADD 1 FOR NOT BEING ON BOUNDRY POPF ; RESET ORIGINAL IR STATUS INT DOS ; DO THE DOS CALL ; ; PR_FILE ENDS END START