;[]-------------------------------------------------------------------------[]
;|	Program name: 2_6_1.ASM                                              |
;|	Image   file: 2_6_1.COM                                              |
;|	Note        : The basic frame of TSR program.                        |
;[]-------------------------------------------------------------------------[]


cseg	segment
	assume	cs:cseg,ds:cseg
	org	100H
start:
	jmp	initialize

;------- Data area ---------------------

old_int05	dd	?
old_int60	dd	?

;------- Include area ------------------

include	register.inc
include	interrup.inc

;------- INT 05H -----------------------

new_int05	proc	far

	sti

;
; Your program can be inserted here
;

	iret

new_int05	endp

;------- INT 60H -----------------------

new_int60	proc	far

	assume	cs:cseg,ds:nothing	; Override segment

	sti
	pushr	<ax,dx,ds>

	set_int	05H,<word ptr old_int05>,<word ptr old_int05[2]>
	set_int	60H,<word ptr old_int60>,<word ptr old_int60[2]>

	popr	<ds,dx,ax>
	iret

new_int60	endp

;------- Main program ------------------

initialize:

	assume	cs:cseg,ds:cseg

	get_int	05H,old_int05
	set_int	05H,<offset new_int05>
	get_int	60H,old_int60
	set_int	60H,<offset new_int60>

	mov	dx,offset initialize	; Terminate and stay resident
	int	27H

cseg	ends
	end	start
