All pastes #274279 Raw Edit

Someone

public text v1 · immutable
·published 2006-12-10 16:21 UTC
rendered paste body
TITLE inthandler
DOSSEG

.MODEL SMALL
.STACK 100h
.DATA
	hoffset dw ?
	hsegment dw ?
.CODE
	start:	mov ax, @DATA
		mov ds, ax
		sub ax, ax

		;Saving Current Hander
		mov al, 09h
		mov ah, 35h
		int 21h
		mov hoffset, bx
		mov hsegment, es

		;Replacing Handler
		push ds
		mov ax, cs
		mov ds, ax
		mov dx, OFFSET KBHANDLER
		mov al, 09h
		mov ah, 25h
		int 21h
		pop ds

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
		mov ah, 09h
		int 21h
		
		;Restoring original handler
		push ds
		mov dx,hoffset
		mov ds,hsegment
		mov al, 09h
		mov ah, 25h
		int 21h
		pop ds
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
		;terminating
		mov ax, 4C00h
		int 21h

	KBHANDLER proc far
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;		sti
;		mov ah, 02h
;		mov dl, 50h
;		int 21h
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
		iret
	KBHANDLER endp

	end start