const
          pb   = $91;
          pa   = $93;
          cb   = $90;
          ca   = $92;

var       cbm  : char;
procedure portini;

begin

   port [ ca ] := $4f;
   port [ cb ] := $cf;
   port [ cb ] := $2; { pb0 > busy / pb1 > strobe }
   port [ pb ] := 1;
   writeln ( port [pa] , '  ' , port [pb] );
end;


function parein : char;

begin

   port [ pb ] := 0;
   repeat {writeln (port[pb])}
             until ( port [ pb ] = 2 ) or  keypressed ;
   port [ pb ] := 1;
   parein := chr ( port [ pa ] );

end;


begin

   portini;
   repeat
   begin
      cbm := parein;
      write ( cbm );
      if cbm = chr ( 13 ) then writeln;
   end
   until keypressed;

end.