MaxZ80 - Chapter 3

Our topic for this Chapter is automation. I noticed a file named CMD.SUB in
the MOTYL directory (A7:). I was looking for an example of how to automate a
series of steps you find yourself frequently taking, like the compile and
link steps discussed in the previous Chapter.

CMD.SUB contains

L80 CMD,CMD/N/E

Files that have a filetype of .SUB are SUBMIT files. They are "jobs" that get
carried out by the SUBMIT facility of CP/M. They usually have more than 1
line in them and in fact they often have parameters as well.

It's easier to type SUBMIT CMD than it is to type that line above.

Easier yet, you may type just CMD.SUB. We'll explain why this works in
Chapter 5. (The idea here is filetypes are associated with programs;
examples: .SUB with SUBMIT, .BAS with MBASIC, .MNU with MENU.)

In the case of our job that turned LEE11H.BAS into LEE11H.COM, we could build
a file named JOBLEE.SUB containing the following two lines:

BASCOM =LEE11H/Z/E/O
L80 Z3HDR,CMD,LEE11H,LEE11H/N/E

Then, we could issue the command SUBMIT JOBLEE.

Or, we could build a file named JOB.SUB containing

BASCOM =$1/Z/E/O
L80 Z3HDR,CMD,$1,$1/N/E

and then issue the command SUBMIT JOB LEE11H.

$1 is a parameter.

CMD.SUB, when run, converts CMD.REL into CMD.COM.

Most .REL files are not converted directly into .COM files. They contain
routines that are used by main programs that call them. For example,
MOTYL.BAS has a CALL to CMD in line 11.

7 ' MOTYL - 5/15/2007 - LRB
11 CALL CMD(FOOBAR$)
13 IF LEN(FOOBAR$)<>0 THEN 29
17 PRINT "Usage : MOTYL YOUR VERY OWN COMMAND TAIL";
19 GOTO 37
29 FBL=LEN(FOOBAR$) : FBL$=STR$(FBL) : FBL$=MID$(FBL$,1,LEN(FBL$))
31 PRINT FOOBAR$ : PRINT "The length of the command tail was" FBL$ "."
37 END

CMD.MAC, the source code for CMD.REL, performs a service that MOTYL uses.
This service is linked into MOTYL as follows: