Program Memoriarezidens_kepernyovedo;

{A program indítása után használd a Num 5-ös billentyût!}
{$M 1024,0,0}
Uses
DOS;
{$F+}
VAR
KbdIntVec : Procedure;

Procedure GoSave; Interrupt;
Begin
If Port[$60] = 76 then
Begin
Asm
cli
mov ah, 0fh
int 10h
mov ah, 03h
int 10h
push dx
push bx
push ax
End;
Repeat
Port[$3c2] := 0;
Port[$3c2] := 9;
Port[$3c2] := 247
Until Port[$60] in [0..75, 77..128];

Port[$60] := 1;
Asm
pop ax
or al,80h
mov ah,00h
int 10h
pop bx
mov ah,05h
mov al,bh
int 10h
pop dx
mov ah,02h
int 10h
sti
End;
End;
Inline($9c);
KbdIntVec;
End;
{$F-}

Begin
GetIntVec($9, @KbdIntVec);
SetIntVec($9, @GoSave);
Keep(0)
End.