8-Bit Software Online Conversion

Program presentation example4 - Listing

10REM >DirctC4 20REM by Steven Flintham 30REM 40REM Sunday 10th January 1992 50: 60MODE 7 70VDU 23;8202;0;0;0; 80PROCdisable 90PROCinit 100REPEAT 110choice%=FNmain`menu 120UNTIL choice%=6 130MODE 7 140PROCenable 150END 160: 170DEF PROCdisable 180*FX229,1 190*FX4,2 200ENDPROC 210: 220DEF PROCenable 230*FX229,0 240*FX4,0 250ENDPROC 260: 270DEF PROCinit 280ON ERROR MODE 7:REPORT:PRINT " at l ine ";ERL:PROCenable:END 290ENDPROC 300: 310DEF FNmain`menu 320REM Display the main menu and accep t the user's input 330LOCAL choice`x%,choice`y% 340PROCtitle 350PRINTTAB(15,4);"Main Menu" 360PRINTTAB(1,6);CHR$131;"A";CHR$135;" Menu option 1" 370PRINTTAB(1,7);CHR$131;"B";CHR$135;" Menu option 2" 380PRINTTAB(1,8);CHR$131;"C";CHR$135;" Menu option 3" 390PRINTTAB(1,9);CHR$131;"D";CHR$135;" Menu option 4" 400PRINTTAB(1,10);CHR$131;"E";CHR$135; "Menu option 5" 410PRINTTAB(1,11);CHR$131;"F";CHR$135; "Quit this program" 420PRINT'"Your choice?";CHR$131; 430choice`x%=POS:choice`y%=VPOS 440PRINT'"(Press RETURN to confirm you r choice)" 450=FNmenu`select(3,choice`x%,choice`y %,6,6) 460: 470DEF FNmenu`select(default%,choice`x %,choice`y%,options%,offset%) 480REM Standard menu selection routine 490LOCAL choice%,choice`made%,key$ 500offset%=offset%-1 510IF default%<>-1 THEN choice%=defaul t%:choice`made%=TRUE:PRINTTAB(choice`x%, choice`y%);CHR$(64+choice%);TAB(0,offset %+choice%);CHR$136; ELSE choice%=1:choic e`made%=FALSE 520REPEAT 530REPEAT 540*FX21 550key$=CHR$(GET AND &DF) 560UNTIL (key$>="A" AND key$<=CHR$(64+ options%)) OR (key$=CHR$(13) AND choice` made%) 570IF key$<>CHR$(13) THEN choice`made% =TRUE:PRINTTAB(choice`x%,choice`y%);key$ ;TAB(0,offset%+choice%);CHR$137;:choice% =ASC(key$)-64:PRINTTAB(0,offset%+choice% );CHR$136; 580UNTIL key$=CHR$(13) 590=choice% 600: 610DEF PROCtitle 620REM Display the program title at th e top of the screen 630VDU 26,12 640PRINTTAB(7,0);CHR$141;CHR$132;CHR$1 57;CHR$131;"Menu Demonstration ";CHR$15 6 650PRINTTAB(7,1);CHR$141;CHR$132;CHR$1 57;CHR$131;"Menu Demonstration ";CHR$15 6 660PRINTTAB(7,2);CHR$131;"(C) Steven F lintham 1993" 670ENDPROC