dos_compilers/Digital Research MT+86 Pascal v311/PROG.SRC

34 lines
896 B
Plaintext
Raw Normal View History

2024-06-30 20:44:12 +02:00
PROGRAM DEMO_PROG;
VAR
I : INTEGER; (* TO BE ACCESSED BY THE OVERLAYS *)
CH: CHAR;
EXTERNAL [1] PROCEDURE OVL1; (* COULD HAVE HAD PARAMETERS *)
EXTERNAL [2] PROCEDURE OVL2; (* ALSO COULD HAVE HAD PARAMETERS *)
(* EITHER COULD ALSO HAVE BEEN A FUNCTION IF DESIRED *)
BEGIN
REPEAT
WRITE('Enter character, A/B/Q: ');
READ(CH);
CASE CH OF
'A','a' : BEGIN
I := 1; (* TO DEMONSTRATE ACCESS OF GLOBALS *)
OVL1 (* FROM AN OVERLAY *)
END;
'B','b' : BEGIN
I := 2;
OVL2
END
ELSE
IF NOT(CH IN ['Q','q'])THEN
WRITELN('Enter only A or B')
END (* CASE *)
UNTIL CH IN ['Q','q'];
WRITELN('End of program')
END.