image of READY prompt

Wang2200.org

Listing of file='@MENU' on disk='vmedia/mvp-boot-2.5.3.wvd.zip'

# Sector sector 806, program filename = '@MENU   '
0010 REM % Prog = @MENU       By PLS     Date = 05/13/81    Time = 00.00.00 PM
         Rel 2.4
0020 REM @MENU provides a menu structure for program selection.
   : REM Multiple levels of menu can be set up with each successive screen
   : REM displaying the next menu node.  Node information is overlayed in at
0030 REM lines 9000-9999; each node is saved as a separate program file ('24).
   : REM Access to the root node is always available with RESET & LOADRUN if
   : REM the progam START is this program or loads in this program.
   : REM
0040 REM @MENU is loaded from a program (eg START) that sets $PSTAT=" ".
   : REM $PSTAT indicates which node is to be loaded (if " ", the root node).
   : REM @MENU sets $PSTAT=node-name when a program is selected, so that the
0050 REM program can return to this menu node by overlaying in @MENU.
0060 REM %VARIABLES........
   : DIM U$8,U1$68,U8$68,U2$30,U6$1,W$(95,3)1,U(5),R$10,W$1,U4$8,U9$1
0070 REM Display
   : REM  W$=cursor
   : REM  W1=column#
   : REM  W0=CRT column
   : REM  W5=# CRT columns
   : REM  U3=tab
   : REM  R1=row#
   : REM  R0=CRT row
   : REM  R5=# CRT rows
   : REM  R9=# rows
   : REM  W$(=item coordinates
   : REM  U(i)=length column(i)
0080 REM Node Items
   : REM  U1=# fields/item
   : REM  U$=filename
   : REM  U1$,U8$=description
   : REM  U2$=type
   : REM  W,R=item#
   : REM  R2=data record#
   : REM  U=# extra fields in node descriptor
   : REM  W9=# items (including blank lines)
   : REM  W8=# items (excluding blank lines)
   : REM  U4$=password
0090 REM Other
   : REM  U6$=keystroke
   : REM  U4,R$=scratch
0100 REM %GET NEXT NODE .............
   : REM Entry- $PSTAT=node name (if " ", node name loaded from .STARTD)
0110 REM %ROOT NODE
   : U$=$PSTAT(#PART)
   : $PSTAT=" "
   : IF U$<>" "THEN 120
0115 DATA LOAD DC OPEN T#U2,".STARTD"
   : DATA LOAD DC #U2,U$
0120 REM %GET NEXT NODE
   : LOAD T#U2,U$ 9000,9999 BEG  140
   : ERRORREM
0130 SELECT P9
   : PRINT HEX(07020404000E);"File not found";HEX(0D0D)
0140 REM NODE DESCRIPTORS
   : RESTORE LINE 8100
   : READ U$,U1$,U1,U
0160 REM %CRT SIZE
   : REM Exit-- R5=#rows, W5=#columns, W$=cursor character
   : R5=24
   : W5=80
   : W$=HEX(8B)
   : $GIO/005(7601,R$)
   : R$=AND HEX(10)
   : IF STR(R$,,1)=HEX(10) THEN 170
   : R5=16
   : W5=64
   : W$="*"
0165 REM %DETERMINE DISPLAY COORDINATES OF NODE ITEMS........
0170 REM %# NODE ITEMS
   : R=-1
   : RESTORE LINE 8100,5+U
0180 GOSUB 560
   : IF U$<>"no more" THEN 180
   : W9=R
   : W1=INT((W9+R5-6)/(R5-5))
   : R9=-INT(-W9/W1)
0190 REM %MAX ITEM LENGTH FOR EACH COL
   : R=-1
   : W1=0
   : MAT U=ZER
   : RESTORE LINE 8100,5+U
0200 FOR W=1 TO W9
   : GOSUB 560
   : IF MOD(R,R9)=0 THEN W1=W1+1
   : U(W1)=MAX(U(W1),LEN(U1$)+2)
   : NEXT W
0210 REM %CALC. DISPLAY COORDS
   : R0=INT((R5-5-R9)/2)+5
   : W0,U3=INT((W5-U(1)-U(2)-U(3)-U(4)-U(5))/(W1+1))
   : IF U3<5 THEN STOP "Screen too small -- reduce length or no. of items. "
   : W8=0
   : RESTORE LINE 8100,5+U
   : R2=-1
0220 FOR W=1 TO W9
   : R1=MOD(W-1,R9)
   : W1=INT((W-1)/R9)
   : IF R1=0 AND W1>0 THEN W0=W0+U(W1)+U3
   : GOSUB 560
   : IF STR(U2$,,1)="B" THEN 230
   : W8=W8+1
   : W$(W8,1)=BIN(R1+R0)
   : W$(W8,2)=BIN(W0)
   : W$(W8,3)=BIN(R2)
0230 NEXT W
0240 REM %DISPLAY NODE.........
0280 REM %DISPLAY NODE TITLE
   : RESTORE LINE 8100
   : READ U$,U1$,U1,U
   : SELECT PRINT 005(W5),P
   : PRINT HEX(020D0C030F06);AT(0,(W5-LEN(U1$))/2);HEX(0E);U1$;HEX(0F)
   : PRINT
0290 REM %DISPLAY INSTRUCTIONS
   : PRINT AT(2,0);"Select item with SPACE & BACKSPACE."
0292 IF W5 = 80 THEN 295
   : PRINT AT(3,0);"Key RUN to execute, CLEAR for previous screen."
   : GOTO 298
0295 PRINT AT(3,0);"Key RUN to execute, CLEAR or PREV SCRN for previous screen
     ."
0298 PRINT AT(2,W5-22);"Partition";#PART;HEX(08);",";SPACEK;"K"
   : PRINT AT(3,W5-15);"Terminal";#TERM
0300 REM %DISPLAY NODE
   : RESTORE LINE 8100,5+U
   : FOR W=1 TO W8
   : GOSUB 530
   : U8$=U1$
   : GOSUB 650
   : NEXT W
   : W=1
0310 REM %PROCESS USER REQUESTS........
0320 REM %DISPLAY CURRENT ENTRY HIGHLIT
   : RESTORE LINE 8100,5+U+U1*VAL(W$(W,3))
   : GOSUB 530
   : U8$=U1$
   : PRINT HEX(0E);AT(VAL(W$(W,1)),VAL(W$(W,2)));W$;" ";U8$;HEX(0F);
0330 REM %USER REQUEST
   : KEYIN U6$,,465
   : ON POS(HEX(20088281)=U6$) GOTO 400,410,420,470
0340 REM %Starting character?
   : RESTORE LINE 8100,5+U
   : R=0
0350 GOSUB 530
   : IF W<>R THEN 350
0360 GOSUB 530
   : IF U$="no more" THEN 370
   : U9$ = HEX(20) OR STR(U1$,,1)
   : IF STR(U1$,,1)<>U6$ AND U9$ <> U6$ THEN 360
   : GOTO 390
0370 RESTORE LINE 8100,5+U
   : R=0
0380 GOSUB 530
   : IF W=R THEN 330
   : U9$ = HEX(20) OR STR(U1$,,1)
   : IF STR(U1$,,1)<>U6$ AND U9$ <> U6$ THEN 380
0390 GOSUB 650
   : W=R
   : GOTO 320
0400 REM %SPACE key
   : GOSUB 650
   : W=MOD(W,W8)+1
   : GOTO 320
0410 REM %BACKSPACE key
   : GOSUB 650
   : W=MOD(W-2,W8)+1
   : GOTO 320
0420 REM %RUN key
   : RESTORE LINE 8100,5+U
   : R=0
0430 GOSUB 530
   : IF W<>R THEN 430
0440 REM Device selection
   : U7$,U3$,U5$,U4$=" "
   : $UNPACK(D=HEX(012C)) U2$ TO R$,U7$,U4$,U3$,U5$
   : GOSUB 610
0450 REM Check for password
   : GOSUB 580
   : IF U4$<>" " THEN 240
0452 REM Check SPACEK
   : IF U7$=" " THEN 460
   : CONVERT U7$ TO U4
   : ERRORPRINT "Error in spacek."
   : END
0454 IF U4<=SPACEK THEN 460
   : SELECT P9
   : PRINT HEX(0E);AT(2,0,40);"Insufficient memory.";AT(3,0,48);U4;"K partitio
     n required.";HEX(0D0D)
   : GOTO 240
0460 PRINT AT(3,0,59);AT(2,0,40);HEX(0E05);"Loading ";BOX(1,LEN(U$)+1);" ";U$;
     "    ";HEX(0F);
   : IF STR(U2$,,1)<>"P" THEN 120
   : RESTORE LINE 8100
   : READ R$
   : $PSTAT=R$
   : LOAD T#U2,U$
   : ERRORGOTO 130
0465 REM %'31 (CLEAR)
   : IF U6$=HEX(42)OR U6$=HEX(52) THEN 700
   : IF U6$=HEX(43)OR U6$=HEX(53) THEN 710
   : IF U6$<>HEX(1F) THEN 330
0470 REM %CLEAR key
   : IF U=0 THEN 330
   : RESTORE LINE 8100,5
   : READ U$
   : U2$="M"
   : R$=" "
   : IF U>=2 THEN READ R$
   : $UNPACK(D=HEX(012C)) R$ TO U3$,U5$
   : GOSUB 610
   : GOTO 460
0480 REM %SUBROUTINES.........
0490 DEFFN'29"LISTSD 9000,";HEX(0D)
0500 DEFFN'24
   : PRINT "Saving node data"
   : RESTORE LINE 8100
   : READ U$
   : SAVE T$(5)U$9000,
   : ERRORSCRATCH T U$
   : SAVE T$()U$ 9000,
0510 RETURN
0520 REM %GET NEXT NODE ITEM (excluding blank lines)
0530 READ U$,U1$,U2$
   : IF U1=3THEN 540
   : FOR U4=4 TO U1
   : READ R$
   : NEXT U4
0540 IF POS("MP "=STR(U2$,,1))=0THEN 530
   : R=R+1
   : RETURN
0550 REM %GET NEXT NODE ITEM (including blank lines)
0560 READ U$,U1$,U2$
   : IF U1=3THEN 570
   : FOR U4=4 TO U1
   : READ R$
   : NEXT U4
0570 R2=R2+1
   : IF POS("MPB "=STR(U2$,,1))=0THEN 560
   : R=R+1
   : RETURN
0580 REM %CHECK FOR PASSWORD
   : REM RETURN -- U4$=" " iff password ok or none
   : REM
   : IF U4$=" " THEN RETURN
0590 PRINT AT(3,0,48);AT(2,0,40);HEX(0E05);"Enter password ";
   : FOR U4=1 TO LEN(U4$)
   : KEYIN U6$
   : STR(U4$,U4,1)=XOR U6$
   : PRINT W$;
   : NEXT U4
   : $TRAN(U4$,HEX(2000))R
   : RETURN
0600 REM %DISK SELECT
   : REM Entry-- N$=file# (" " ==> #0), A$=device-addr (" " ==> no selection)
   : REM Return-- N=file# (selected)
0610 U2=0
   : IF U3$<>" " THEN CONVERT U3$ TO U2
   : ERRORGOTO 640
0620 IF U2<0 OR U2>15 THEN 640
   : IF U5$<>" " THEN SELECT #U2<U5$>
   : ERRORGOTO 640
0630 RETURN
0640 PRINT "Error in selecting";U2;" ";U5$
   : END
0650 REM %DISPLAY CURRENT ENTRY (W) WITHOUT HIGHLIGHT
   : PRINT AT(VAL(W$(W,1)),VAL(W$(W,2)));". ";U8$;
   : RETURN
0700 DEFFN'42
0705 DEFFN'52
   : U6$=HEX(81)
   : GOTO 470
   : RETURN
0710 DEFFN'43
0715 DEFFN'53
   : U6$=HEX(82)
   : GOTO 420
   : RETURN
8000 REM %NODE DATA (lines 9000-)
8010 REM 1st line of data is the NODE DESCRIPTION --
   : REM
   : REM   DATA "node filename" (required)
   : REM     "node title" (required)
   : REM     "# items in each ITEM DESCRIPTION" (required)
8020 REM     "# other items in NODE DESCRIPTION" (required)
   : REM     "previous node name" (optional)
   : REM     "[file#][,device-address]" (optional,see below)
8030 REM     other alpha items (optional)
   : REM
8040 REM Each other line of data is an ITEM DESCRIPTION --
   : REM
   : REM   DATA "item name (ie, filename)" (required)
   : REM      "item description (displayed information)" (required)
8050 REM      "type" (required)
   : REM        P=program
   : REM        M=menu node
   : REM        B=blank display line
   : REM        O=overlay or related file (not used by @MENU)
   : REM         (must follow an item of type P or O)
8060 REM        other alpha items   (optional)
   : REM
8070 REM     Types P & M can optionally be followed by, separated by commas,
   : REM
   : REM       required partition size (SPACEK)
   : REM       execution password (8 bytes)
8080 REM       file# to load from (default #0)
   : REM       device-addr (file# selected to this, default no selection)
   : REM
   : REM       Eg,   "P,14,password,1,B10"
   : REM             "M,,,,D32"
   : REM
8090 REM Last line of data defines the end of items --
   : REM
   : REM    DATA "no more","end of node"," "
8100 REM