PROGRAM Stepper;
uses Crt,dos;
const lpt1=$378; lpt2=$278;     {portkonstansok}
      lpt=lpt1;                 {a megfelel‹ port kiv laszt sa}

var x,y,z,e,lepes,irany   : integer;

begin

z := 1;

repeat
Writeln('kilepes => lepesek = 0');
Writeln('lepesek(1-30000)');
Readln(lepes);
if lepes = 0 then exit;
Writeln('irany(1-2)');
Readln(irany);
Writeln('sebesseg(1-100)');
Readln(e);


repeat


if lepes >= 1 then
if irany = 1 then x := x + 1;
if x >= 5 then x := 1;

if lepes >= 1 then
if irany = 2 then x := x - 1;
if x <= 0 then x := 4;

lepes := lepes - 1;
delay(e);

if x = 1 then y:=1;
if x = 2 then y:=2;
if x = 3 then y:=4;
if x = 4 then y:=8;

port[lpt]:=y;

until lepes = 1;
until z = 0;
end.