program STALK;
var L,M:integer;
    STR:absolute [$FCF3] String [11];
    GIST,GER:external integer;
    FIELD:array [1..16,1..16] of integer;
    ZS,GR,GR1:byte;
    GRP,GRM,TSM,FZ,BRK,LB:external byte;
    FL,MPR,MOCH:external array [0..19] of byte;
external procedure RTL;
external procedure INRN;
external procedure DWL;
external procedure UPL;
external procedure LFL;
external procedure TKRM;
external procedure INIT;
external procedure TAKT;
external procedure OALL;
external procedure OUTR;
external procedure OBGA;
external procedure BELL(A:integer);
external procedure ZDF(A:integer);
begin
 INRN;
 INIT;
 ZS:=1;
 GR:=10;
 GR1:=0;
 ZDF(0);
 TKRM;
 OALL;
 STR:='Сектор :001';
 STR[0]:=chr(0);
 BRK:=0;
 FZ:=0;
 OUTR;
 OBGA;
 repeat
  TAKT;
  if FL[8]<>0 then BRK:=1;
  if FL[1]<>0 then
   begin
    case TSM of
     0:UPL;
     1:RTL;
     2:DWL;
     3:LFL;
    end;
    STR:='Сектор :   ';
    STR[11]:=chr(LB mod 10+48);
    STR[10]:=chr((LB div 10) mod 10+48);
    STR[ 9]:=chr((LB div 100) mod 10+48);
    STR[0]:=chr(0);
    OUTR;
    OBGA;
   end;
  If (GRM<>0) or (GRP<>0) then
   begin
    GR1:=GR1+GRP;
    while GR1>9 do begin
                    BELL(0);
                    GR1:=GR1-10;if GR<10 then GR:=GR+1
                   end;
    If GRM<>0 then BELL(1);
    if GR>GRM then GR:=GR-GRM
              else GR:=0;
    OUTR;
   end;
 until (GR=0) or (BRK=1);
end.
jp      z,TA20
        push    bc
        call    LIFE
        pop     bc
 