home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
ftp.barnyard.co.uk
/
2015.02.ftp.barnyard.co.uk.tar
/
ftp.barnyard.co.uk
/
cpm
/
walnut-creek-CDROM
/
MBUG
/
MBUG094.ARC
/
USERMENU.PAS
< prev
Wrap
Pascal/Delphi Source File
|
1979-12-31
|
3KB
|
100 lines
{This program gives a user menu }
{To tailor this program for your own needs you only need to
1. Pick the correct value for ComBuffAddr
2. Type in your heading (line )
3. Change the contents of the constant DISPLAY
A) Type in the key for highlighting as the selection
B) Type in the comment to be displayed beside this letter
C) Type in the the command to be performed in response to
the key pressed
4. Compile to disk.
This will now give you a menu that will run the appropriate commands
}
{$U+}
var
ComBuffAddr:integer absolute $E860 { Hard Disk 128K use $E65C,
workstations use $D682
Floppy 5.25 128K use $E860 };
x:integer;
Command: string[100];
charval,maxcount,count :integer;
Ch:Char;
Procedure Wellcome;
vAR x:integer;
Name:string[20];
begin
ClrScr;
Write('Please type in your name then press the RETURN key ');
Readln(Name);
for x:=1 to 5 do
begin
ClrScr;
Delay(200);
Writeln(^G^G^G' W E L L C O M E '#10#10);
LowVideo;
Writeln(name:20,#10#10);
NormVideo;
Writeln('T o D O N V A L E C H R I S T I A N S C H O O L');
Delay(500)
END
END;
Procedure CompSciMenu;
Var
Ch:Char;
GoodResponses:string[10];
Posn:integer;
Type
Selection=record
Key:string[1];
Comment:string[40];
CommandS:string[50];
end;
Menu=array[1..10] of selection;
Const
Display:Menu=
((Key:'S';Comment:'Student Database';CommandS:'SDATA'),
(Key:'M';Comment:'Matchmaker';CommandS:'MATCH'),
(Key:'L';Comment:'Low Level Programming';CommandS:'LOWLEV'),
(Key:#0;Comment:'Animal';CommandS:'E:;ANIMAL'),
(Key:#0;Comment:'End of Menu';CommandS:'None'),
(Key:'';Comment:'';CommandS:''),
(Key:'';Comment:'';CommandS:''),
(Key:'';Comment:'';CommandS:''),
(Key:'';Comment:'';CommandS:''),
(Key:'';Comment:'';CommandS:''));
Begin {Menu}
ClrScr;
WriteLn('Computer Science Menu'#10#10#10); {Heading}
Count:=1;
GoodResponses:='';
repeat
LowVideo;Write(Display[count].Key);HighVideo;
Writeln(' - ',Display[count].Comment,#10,#13);
GoodResponses:=GoodResponses+Display[count].Key;
Count:=Count+1
until Display[Count].Key=#0;
Writeln(#10#10#13'Press the letter of your Choice');
Repeat
Read(Kbd,Ch);
Posn:=Pos(UpCase(Ch),GoodResponses);
until Posn<>0;
Command:=Display[Posn].CommandS;
LowVideo;writeln('PLEASE WAIT');HighVideo;
end; {Menu}
Begin
Wellcome;
CompSciMenu;
If Command<>'' then begin
Command:=';'+Command+chr(0);
for x:=1 to length(command) do mem[ComBuffAddr+x-1]:=ord(Command[x]);
end;
end.