DataMuseum.dk

Presents historical artifacts from the history of:

CP/M

This is an automatic "excavation" of a thematic subset of
artifacts from Datamuseum.dk's BitArchive.

See our Wiki for more about CP/M

Excavated with: AutoArchaeologist - Free & Open Source Software.


top - download

⟦ad3f1ca87⟧ TextFile

    Length: 3328 (0xd00)
    Types: TextFile
    Names: »MENU.PAS«

Derivation

└─⟦1d9c0f429⟧ Bits:30005384 COMAL-80 med små spil (opstartsdiskette)
    └─ ⟦this⟧ »MENU.PAS« 

TextFile

PROGRAM menuvalg;


CONST
ESC     = 27;
return  =  $0D;
op      =  $0B;
ned     =  $0A;
pil_on  = '=->';
pil_off = '   ';
nul     = 0;


VAR
quit : boolean;
valg,tast :byte;
tabulering,pegepind,slet,antal,liniestart, linie_slut, linie : integer;
(*----------------------------------------------------*)

PROCEDURE a;
BEGIN
  GOTOXY(tabulering,liniestart -4);
  WRITELN('***** rutine A *****')
END;
(*----------------------------------------------------*)

PROCEDURE b;
BEGIN
  GOTOXY(tabulering,liniestart -4);
  WRITELN('***** rutine B *****')
END;
(*----------------------------------------------------*)

PROCEDURE c;
BEGIN
  GOTOXY(tabulering,liniestart -4);
  WRITELN('***** rutine C *****')
END;
(*----------------------------------------------------*)

PROCEDURE d;
BEGIN
  GOTOXY(tabulering,liniestart -4);
  WRITELN('***** rutine D *****');
  quit := true;
END;
(*----------------------------------------------------*)

PROCEDURE ny_pegepind;
BEGIN
  gotoxy(tabulering-4,slet);
  WRITE(pil_off);
  gotoxy(tabulering-4,pegepind);
  WRITE(pil_on);
  gotoxy(tabulering-2,pegepind);
END;
(*----------------------------------------------------*)

PROCEDURE menutekst;
BEGIN
  gotoxy (tabulering,liniestart);
  WRITELN ('tekst 1 ');
  gotoxy (tabulering,liniestart + 1);
  WRITELN ('tekst 2 ');
  gotoxy (tabulering,liniestart + 2);
  WRITELN ('tekst 3 ');
  gotoxy (tabulering,liniestart + 3);
  WRITELN ('tekst 4 QUIT af program ');
END;
(*----------------------------------------------------*)

PROCEDURE initiering;
BEGIN
  tabulering := 12;
  liniestart := 12;
  pegepind := liniestart;
  antal := 4;
  antal:=antal-1;
  tast:=nul;
  linie_slut:=liniestart + antal;
END;
(*----------------------------------------------------*)

PROCEDURE get(VAR tast:byte);
BEGIN
  PORT(.$F6.):=0;
  tast := 0;
  REPEAT
    tast := PORT(.$F6.) AND $7F;
  UNTIL tast <> 0;
END;
(*----------------------------------------------------*)

BEGIN
  GOTOXY (0,0);
  CLREOS;
  quit := false;

  REPEAT

    initiering;
    menutekst;
    ny_pegepind;

    WHILE NOT(tast = return)  DO
    BEGIN
      GET(tast);

      IF tast = op 
      THEN BEGIN
             slet := pegepind;

             IF pegepind = liniestart 
             THEN BEGIN 
                     pegepind := linie_slut;
                  END
             ELSE BEGIN
                    pegepind := pegepind - 1;
                  END;
           END
      ELSE BEGIN
             IF tast = ned 
             THEN BEGIN
                    slet:=pegepind;

                    IF pegepind = linie_slut 
                    THEN BEGIN
                           pegepind:=liniestart;
                         END
                    ELSE BEGIN
                           pegepind:=pegepind + 1;
                         END;
                  END;
           END;

           ny_pegepind;
     END;(*while*)

     gotoxy(tabulering-4,pegepind);
     WRITE(pil_off);
     valg := pegepind - liniestart+1;

     CASE valg OF
       1: a;
       2: b;
       3: c;
       4: d;
     OTHERWISE;
     END;

   UNTIL quit;
  
   GOTOXY (0,0);
   CLREOS;
   WRITELN ('program afsluttet');
END.
«eof»