;[]-------------------------------------------------------------------------[]
;|	Program name: 2_2_5.ASM                                              |
;|	Image   file: 2_2_5.COM                                              |
;|	Note        : The basic TSR program.                                 |
;|                    It is chained with INT 05H interrupt service routine.  |
;[]-------------------------------------------------------------------------[]


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

;---------------------------------------

old_int05	dd	?

;---------------------------------------

new_int05	proc	far

	pushf				; Execute the old INT 05H routine
	call	cs:old_int05

	sti

	push	ax			; Save the register value
	push	bx
	push	cx
	push	dx

	mov	ah,7			; Scroll screen down one line
	mov	al,1
	mov	bh,7
	mov	ch,0
	mov	cl,0
	mov	dh,24
	mov	dl,79
	int	10H

	pop	dx			; Restore the register value
	pop	cx
	pop	bx
	pop	ax

	iret

new_int05	endp

;---------------------------------------

initialize:

	mov	al,05H			; Get the INT 05H interrupt vector
	mov	ah,35H
	int	21H

	mov	word ptr old_int05,bx	; Save the vector in old_int05
	mov	word ptr old_int05[2],es

	mov	dx,offset new_int05	; Set the INT 05H interrupt vector
	mov	al,05H
	mov	ah,25H
	int	21H

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

cseg	ends
	end	start