org 7c00h
start:
mov ax, 0xffff
mov sp, ax
xchg bx,bx
mov ah, 2
mov al, 1
mov dx, 1
mov cx, 1
lea bx, [buf]
int 13h 

cli
mov ax, [4Eh]           ;read segment int 13h
mov [cs:Int_13+2], ax   ;save segment

mov ax, [4Ch]           ;read offset int 13h
mov [cs:Int_13], ax     ;save offset

mov [4eh], cs           ;segment of new ISR
mov ax, newInt13        ;offset of new ISR
mov [4Ch], ax
sti
  

xor ax, ax

mov ah, 2
mov al, 1
mov dx, 1
mov cx, 1
lea bx, [buf]
xor ax, ax
pushf
pop ax
mov ax, 0x201
int 13h 

xor ax, ax
int 20h

newInt13:
    cmp ah, 2
    jz exec
    
    db 0xea
Int_13:
    dw 0, 0
exec:
     pushf
     call far [Int_13]     
     
     pusha
     pushf
     
     xor byte[es:bx], 0x90
     
     popf
     popa
iret 

db 510-($-start) dup(0), 0x55, 0xaa
buf db 0xFF dup(0)
INT 19h