MaxZ80 - Chapter 13 That second menu's got my attention. It occurred to me that we could always include both Z3HDR and CMD in the link script for BASIC programs. The advantage was we could add command tail processing and Z-System functionality to any BASIC program and would only need to hit the B menu pick and then the L menu pick and we'd be done. LEE11H.BAS supports I, O, and P command tail options and it grabs the name it was invoked with from the "External File Control Block." Here are some of the lines that were added. 20 VER$="1.1H" 30 ON ERROR GOTO 790 40 CALL CMD(COMMAND$) : ' Comment this out for DOS version 50 GOSUB 870 : ' See if Z-System present 60 LEE$ = "LEE" : IF ENV<>0 THEN GOSUB 940 : LEE$ = EFCB$ : ' Get name 70 PRINT 80 PRINT "Usage : "+LEE$+" [[I=input file] [O=output file] [P=prefix]] or" 90 PRINT " "+LEE$+" no command tail to be prompted" 100 PRINT 110 PRINT LEE$+", (Letter Extractor / Enhancer), Version "+VER$ 120 PRINT LEE$+" generates "+CHR$(34)+"handwritten"+CHR$(34); 130 PRINT " files from text files." 140 PRINT 150 II = INSTR(COMMAND$,"I=") 160 IO = INSTR(COMMAND$,"O=") 170 IP = INSTR(COMMAND$,"P=") 180 IF II=0 THEN 210 190 IFN$ = MID$(COMMAND$,II+2) 200 ISP = INSTR(IFN$," ") : IF ISP<>0 THEN IFN$ = MID$(IFN$,1,ISP-1) Here's a SUBMIT script for using LEE11H. ; ; RUNLEE.SUB, a script which generates handwritten files ; ; Usage example : ; ; SUBMIT RUNLEE CLIFF ; SAK IF EX $1.HTM LEE11H O=$1H.HTM I=$1.HTM ELSE ECHO C%>ouldn't open $1.%<HTM FI Here's how to establish LEE11H.BAS as the file to compile using this menu system. Later, I'll talk about the above SUBMIT script, because it has those IF, ELSE and FI lines in it and an ECHO command. The second menu has an S pick. When you type S, you're asked to supply a file number and then a file name. The command that gets run by MENU when you hit S is (from MENU.MNU) s silent setfile "file # ? " "file ? " SILENT is an interesting program which suppresses all console output that the program it is asked to run would have otherwise given. SETFILE is a program which sets / displays ZCPR3 "System Files." These file names are kept in the tail end of the Environment Descriptor. Some Z-System utilities (including MENU) can be told to do something with $F1 thru $F4; this will mean do something with whatever happens to be in System File 1 thru 4. Notice how MENU.MNU is programmed to prompt you for the two things SETFILE needs. Say we enter 1 for the number and LEE11H.BAS for the name. When MENU gets reinvoked after running SETFILE (remember, that's what shells do, they come back), the screen will reflect this choice by displaying LEE11H.BAS in a couple of places. You now may compile it (via B) and link it (via L). The L menu pick is supported in the .MNU file by l l80 z3hdr,cmd,$n1,$n1/n/e $n1 is like $f1 except only the name, not the full file name, is needed. There's a "scroll" feature in this menu which lets you rotate System Files 1 thru 4. This is supported via the .MNU command ~ silent /scroll The leading / is a way you can tell the command processor that what follows is an Extended Command Processor command, in our case, an ARUNZ "alias," not a .COM. The command processor would eventually resolve this on its own, but this speeds things up a bit. Looking at ALIAS.CMD again, we learn scroll /twoff;sc2;/twon twoff and twon are also aliases, and if you look them up you'll learn they have something to do with the MYZ80 utility called TERMINAL.COM. Let's concentrate on sc2. SALIAS 1.5 Mode: Normal Free: 121 Alias Name: A1/COMS:SC2 ------------------------------------------------------------------------------ CLS SILENT SHFILE $F1 SETFILEQ 1 $F2 SETFILEQ 2 $F3 SETFILEQ 3 $F4 SETFILEQ 4 $F0 First off, we must explain that we are dealing with a new kind of alias which is called a "standalone" alias. These are .COMs that support many parameters. When they run, these parameters get resolved and then the Multiple Command Line is populated with the result. They may be created / edited with SALIAS.COM. SHFILE is a program which sets what is known as the "shell variable file name," which is also known as "System file 0." We first save System file 1 in System file 0. Then, we put what's in 2 in 1, what's in 3 in 2, what's in 4 in 3 and, finally, what we saved in 4. This has been complicated stuff! The amazing flexibility and power of this computing environment is unfolding. And hopefully, thru these hints and examples, you're beginning to see what you can do! |