program terminal;
uses crt;
Const
{ (1=$03F8 2=$02F8 3=$03E8 4=$02E8 }
Com = $2f8; {Alapértelmezés: com 2}
Procedure Write(w : char);
begin
asm
mov al, w;
int $29
end;
end;
var
c : char;
done : boolean;
begin
done := false;
repeat
if keypressed then
begin
c := readkey;
if c = #27 then done := true;
port[com] :=
ord(c);
end;
if 97 = port[com+5] then write(char(port[com]));
until done = true;
end.