program segment7; uses wincrt;
const
   PPIadres = $0300;
   PPIportA = PPIadres;
   PPIportB = PPIadres+1;
   PPIportC = PPIadres+2;
   PPIcontrol = PPIadres+3;
var
   segmentscode: array [0..9] of byte;
   teller: integer;
begin
   segmentscode[0]:=$3f;
   segmentscode[1]:=$06;
   segmentscode[2]:=$5b;
   segmentscode[3]:=$4f;
   segmentscode[4]:=$66;
   segmentscode[5]:=$6d;
   segmentscode[6]:=$7d;
   segmentscode[7]:=$07;
   segmentscode[8]:=$7f;
   segmentscode[9]:=$6f;
   {schakel PA7 t/m PA0 en PB7 t/m PB0 als outputs
    en schakel PC7 t/m PC0 als inputs}
   port[PPIcontrol]:=$89;
   teller:=0;
   repeat
      port[PPIportA]:=segmentscode[teller mod 10];
      port[PPIportB]:=segmentscode[teller div 10];
      teller:=teller+1;
      if teller=100
      then
         teller:=0;
      readln
   until port[PPIportC] and $01 = $00
end.