;CTRL-B2.8 - TSR which hooks interrupt 1Bh (CTRL-Break response) ; Like CTRL-B1, but stores address of old handler and calls ; it in the new handler. MAIN: MOV AX,351Bh ;Function 35h: Get interrupt vector 1Bh INT 21h ;Int 21h: Function 35h MOV DI,O_OLDI MOV [DI+2],ES ;Save segment of old handler MOV [DI],BX ;Save offset of old handler MOV AX,251Bh ;Function 25h: Set interrupt vector 1Bh MOV DX,NEWINT ;Offset of handler INT 21h ;Int 21h: Function 25h MOV DX,16h ;Set 16h paragraphs to stay resident MOV AH,31h ;Function 31h: Terminate and stay resident INT 21h ;Int 21h: Function 31h NEWINT: PUSH DX ;Save DX register MOV DS,CS ;Set Data Segment to Code Segment MOV DX,MSG ;Address of string CALL OUTSTR ;Output string POP DX ;Restore DX register JMP D[O_OLDI] ;Jump to old handler OUTSTR: PROC ;Output string procedure PUSHA ;Save registers MOV AH,0Fh ;Function 0Fh: Get video mode (active page in BH) INT 10h ;Int 10h: Function 25h MOV DI,DX ;Address of start of string MOV AH,0Eh ;Function 0Eh: Teletype Output MOV BL,0Fh ;Text color for graphics modes NCHAR: MOV AL,[DI] ;Get character INC DI ;Move string pointer to next character CMP AL,'$' ;Check for end of string JE ESTR ;Return if found INT 10h ;Int 10h: Function 0Eh JMP NCHAR ;Do next character ESTR: POPA ;Restore registers RET ;Return ENDP ;End of procedure MSG: DB 'Hello World$' ;String to output, '$' terminated O_OLDI: DW ?,? ;Offset and segment of old handler