Command File Processing Disk-Based Command Files -- SUB2 SUB2 Error Messages SUB2 Command Summary Memory-Based Command Files -- ZEX ZEX Control Commands Restrictions on Command Files SUB2 and ZEX as Extended Command Processors Under ZCPR2 :Command File Processing Á Commanä Filå ió á filå containinç commands¬  witè optionaì parameteò  substitution¬  whicè caî bå executeä bù ZCPR2®  Theså commandó  arå  exactlù thå samå kindó oæ commandó  aó  yoõ  woulä issuå  aô  thå console¬  anä anù commanä yoõ caî issuå  froí  thå consolå  caî  bå issueä froí withiî á Commanä Filå (witè  jusô  á couple of restrictions). Thå  Commanä Filå Facilitieó oæ SUB² anä ZEØ  arå  availablå undeò ZCPR2®  Similaò iî concepô tï thå SUBMIÔ facilitù oæ CP/M¬ botè  SUB² anä ZEØ arå upward-compatablå tï SUBMIÔ (anù SU  filå caî ruî undeò theí witè fe÷ restrictions). Botè  SUB²  anä  ZEØ  begiî processinç  bù  translatinç  thå commanä fileó theù arå giveî intï slightlù differenô forms® Botè dï parameteò substitution¬ extractinç parameteró froí thå commanä lineó  anä placinç theí intï thå texô oæ thå commanä streaí  theù arå building®  SUB² buildó thå commanä streaí tï bå executeä  oî disë  drivå Á undeò thå currenô useò number¬  anä ZEØ buildó  thå commanä streaí iî memory. Aó  thå useò caî guess¬  ZEØ ió generallù preferreä tï SUB2® Undeò ZEX¬  thå commanä streaí ió executeä mucè morå quicklù thaî undeò SUB² sincå ZEØ jusô goeó intï memorù foò thå nexô characteò whilå ZCPR² haó tï gï tï disk® ZEX¬ however¬ doeó takå uð memorù space¬ anä thaô ió itó maiî drawback® Thå TPÁ (Transienô Prograí Area©  undeò  ZEØ ió smalleò thaî whaô ió  availablå  tï  commanä fileó  runninç undeò SUB2®  Thió ió youò basiã trade-ofæ betweeî thå twï Commanä Filå Processors. Anotheò differencå betweeî SUB² anä ZEØ ió thaô SUB² commanä streamó arå line-orienteä anä extracteä onlù bù ZCPR2®  Thaô is¬ SUB²  buildó á commanä filå nameä $$$.SU likå SUBMIÔ  does¬  anä ZCPR²  extractó  á  linå froí thå $$$.SU filå eacè  timå  iô  ió entered® Wheî ZCPR² ió entereä bù eitheò á Colä Boot¬ Warí Boot¬ oò  simplå RETurî froí á loadeä program¬  iô checkó thå  Multiplå Commanä Linå Buffeò foò á pendinç command®  Iæ iô findó  it¬  iô executeó it® Iæ not¬ iô checkó thå Aº drivå (currenô user© foò á $$$.SU  file®  Iæ iô findó one¬  iô extractó thå nexô linå froí thå $$$.SU file¬  processeó it¬  anä beginó executioî oæ iô froí thå Multiplå Commanä Linå Buffer®  Finally¬  iæ thå $$$.SU filå is not found, ZCPR2 prompts the user for input. Thaô  ió  ho÷  commanä  streaí  processinç  undeò  SUB²   ió performed® ZEX¬ however¬ actó aó á combinatioî oæ SUB² anä XSUB® Oncå commanä streaí processinç beginó undeò ZEX¬ thå ZEØ monitor¬ locateä undeò ZCPR² witè thå associateä commanä stream¬  supplieó á  characteò eacè timå thå BIOÓ Consolå Inpuô Routinå ió  called® ZEØ extractó thå nexô characteò froí thå commanä stream¬ examineó iô  tï  seå  iæ iô ió á ZEØ commanä anä executeó iô  iæ  so¬  anä returns it to the calling program if it is not a ZEX command. Hence¬  ZCPR²  itselæ doeó noô realizå thaô ZEØ ió  running® Neitheò  dï  thå  transienô  programó  iî  general®  ZEØ  simplù interceptó alì calló tï thå BIOÓ Consolå Inpuô (anä Inpuô Status© routinå anä provideó aî inpuô characteò iî itó place®  Therå arå exceptions to this case, but they will be discussed later. Botè SUB² anä ZEØ fiô intï thå ZCPR² Systeí nicely¬ anä theù caî  bå  useä tï acô aó Extendeä Commanä Processoró  iæ  desired® This is discussed later. :Disk-Based Command Files -- SUB2 SUB2¬  commonlù  calleä  SUB¬  ió  invokeä  bù  onå  oæ  thå following command lines: SUB or SUB // <-- Print Help Message SUB /A Text <-- Abort $$$.SUB File Processing at User's Discretion SUB /AB Text <-- Same as /A but Ring Bell to Alert User SUB /D commands <-- Perform Commands following the /D SUB /I <-- Enter Interactive Input Mode SUB filename params <-- As in Standard SUBMIT Thå  "SU  /A¢  anä  "SU  /AB¢  formó  allo÷  thå  useò  tï gracefullù  aborô á $$$.SU file®  ^à aô thå consolå caî bå useä tï  aborô sucè processinç aó undeò CP/M¬  buô thå /Á forí  allowó thå  luxurù  oæ  startinç  á commanä streaí  anä  stoppinç  aô  á criticaì poinô tï allo÷ thå useò tï takå hió time¬  inspecô  whaô haó happened¬ anä theî decidå whetheò tï proceeä oò not. Thå  "SU  /D¢  forí  haó  littlå  utilitù  undeò  á  fully- implementeä  ZCPR²  System®  Yoõ caî obtaiî á betteò  effecô  bù simplù  issuinç  á  conventionaì ZCPR² commanä  stream®  Thå  /Ä optioî  ió  gooä onlù iî environó whicè dï noô  supporô  multiplå commands. Thå "SU /I¢ forí eliminateó thå neeä foò thå useò tï uså aî editoò tï creatå á .SU file®  Iæ thå useò haó á commanä  streaí hå  wantó tï executå immediatelù anä doesn'ô carå tï dï iô again¬ hå caî uså thió option®  Iî response¬  SUB² allowó hií tï  enteò hió  commanä  streaí (sorry¬  nï parameteò passing© á linå  aô  á time®  Wheî  iô ió alì entereä (useò enteró aî emptù line)¬  thå $$$.SU filå ió builô anä executed. Thå finaì form¬  "SU filenamå params"¬ ió identicaì iî forí tï  thå  SUBMIÔ  commanä  supplieä  witè  CP/M®  Thå  "filename¢ specifieó  thå  namå  oæ thå .SU filå tï bå  executed¬  anä  thå parameteró arå associateä witè thå substitutioî variableó oæ  $1¬ $2¬  etc®  Uð  tï 2° parameteró maù bå specified®  Thå sequencå "$$¢  placeó  á  "$¢ intï thå commanä  line¬  anä  thå  characteò sequencå  "^c¢  placeó thå indicateä controì characteò  intï  thå commanä linå (uparro÷ à placeó Control-C). Thå  SUB² commanä maù bå nesteä intï á $$$.SU file®  Iæ  á "SU  filenamå params¢ commanä ió encountereä iî á $$$.SU  file¬ SUB²  runs¬  realizeó  thaô thió haó happened¬  anä  insertó  thå indicateä  commanä file¬  witè parameteò substitution¬  intï  thå runninç  commanä  streaí aô thå appropriatå place®  Thió maù  bå nesteä aó manù leveló deeð aó desired. Undeò ZCPR2¬  iæ SUB² ió executeä witè thå Multiplå  Commanä Linå  Facilitù invokeä anä morå commandó follo÷ thå SUB² command¬ theî thå resô oæ thå Multiplå Commanä Linå ió inserteä aô thå enä of the generated $$$.SUB file. Finally¬  SUB² followó thå ZCPR² patè wheî searchinç foò thå indicateä  commanä file®  Iô ió fullù integrateä intï thå  ZCPR² Systeí  anä  ió  ablå tï emploù thå Externaì  Patè  anä  Multiplå Command Line Buffer features of ZCPR2. :SUB2 Error Messages SUB²  provideó  á numbeò oæ informativå diagnosticó  tï  thå user®  Iî particular¬  wheî processinç á Commanä File¬  wheî  aî erroò ió encountered¬ thå useò ió informeä oæ thå linå numbeò thå error occurs at. Thå  followinç  summarizeó thå erroò messageó  presenteä  bù SUB2: Disk Full There is no room to write the $$$.SUB file Directory Full There is no directory space for the $$$.SUB file Memory Full There is not enough memory in which to build the command stream to be placed into the $$$.SUB file SUB2 Error Messages, Con't SUBMIT File Not Found The .SUB file specified in the command line could not be found along the ZCPR2 path Parameter Invalid Parameter Specified Too Many Parameters More than 20 parameters were on the command line Line too Long The current line in the command stream exceeds 128 bytes SUBMIT File Empty The .SUB file specified in the command line was found to be empty SUB2 Error Messages, Con't Control Character The ^c form was not followed by a letter A-Z :SUB2 Command Summary The following are valid SUB2 command line forms: SUB or SUB // <-- Print Help Message SUB /A Text <-- Abort $$$.SUB File Processing at User's Discretion SUB /AB Text <-- Same as /A but Ring Bell to Alert User SUB /D commands <-- Perform Commands following the /D SUB /I <-- Enter Interactive Input Mode SUB filename params <-- As in Standard SUBMIT :Memory-Based Command Files -- ZEX Thå  Memory-Baseä Commanä Filå Processoò oæ ZCPR2¬  ZEX¬  ió invoked by the following forms: ZEX // <-- Print Help ZEX <-- Enter Interactive Mode ZEX filename params <-- Process .ZEX or .SUB file as with SUBMIT Thå  Interactivå Modå oæ ZEØ executeó likå  thå  Interactivå Modå  oæ  SUB2®  Thå  useò  enteró commanä  lineó  untiì  hå  ió satisfieä  anä  theî terminateó thå procesó bù enterinç aî  emptù linå (simplù hittinç RETURN)®  ZEØ theî executeó thå commandó iî thå sequencå entered®  Nï parameteò passinç ió permitteä iî thió mode of operation. Thå  "ZEØ  filenamå params¢ forí ió likå  thå  correspondinç SUB² form®  ZEØ wilì searcè alonç thå ZCPR² Externaì Patè foò  á commanä  filå  oæ thå forí filename.ZEØ oò  filename.SUB®  Iæ  á directorù ió entereä whicè containó botè sucè files¬  thå filå oæ type ZEX will be executed. Oncå  ZEØ haó beguî execution¬  iô placeó á ZEØ Monitoò jusô undeò  ZCPR²  anä buildó thå commanä streaí  undeò  thå  monitor® Oncå  complete¬  thå addresó oæ thå BDOÓ ió adjusteä sï thaô  thå ZEØ  monitoò  anä itó commanä streaí wilì noô bå  overwritteî  bù transienô  programs¬  anä executioî begins®  Eacè timå thå  BIOÓ Consolå   Inpuô  routinå  ió  called¬   ZEØ  supplieó  thå  inpuô character. Aó witè SUB2¬  á ^à froí thå consolå wilì aborô executioî oæ á ZEØ commanä stream®  Also¬  aó witè SUB2¬ iæ á commanä followó ZEØ  iî á Multiplå Commanä Line¬  ZEØ appendó thió commanä tï thå command stream. Unlikå SUB2¬  ZEØ doeó noô permiô nestinç oæ commanä  files® ZEØ  wilì  simplù  aborô iæ á ZEØ commanä ió encountereä  iî  thå commanä streaí iô ió processing. Unlikå  SUB2¬  ZEØ  supportó manù  morå  embeddeä  commands® Combininç  thå  facilitieó  oæ SUB² anä XSU iî  thió  case¬  thå embeddeä  commandó oæ ZEØ reflecô thå XSUB-likå  capabilitieó  oæ ZEØ aó welì aó somå ne÷ ideas. Theså  extendeä  controì commandó arå discusseä iî thå  nexô information section. :ZEX Control Commands The following summarizes the ZEX Control Commands: Cmd Meaning Cmd Meaning | insert ^| insert ^º reruî commanä streaí ^® togglå prinô suppress ^# toggle ZEX messages ^$ define default params ^? wait for user input ^/ ring bell and ^? ^* ring bell ^" accept user input ^< display chars only ^> stop display ;; ZEX comment $n 1<=n<=9 for param $$ $ $^ ^ $| | ^c control char This summary is also displayed via the built-in ZEX help. Thå followinç commandó simplù inserô characteró intï thå ZEØ command stream and will not be discussed in any greater detail. | inserts a ^| inserts a pair $$ inserts a single $ $^ inserts a single ^ $| inserts a single | ^c inserts a control character Thå ^ª commanä simplù causeó ZEØ tï rinç thå bell®  Iô doeó noô  inserô  á  BELÌ characteò intï thå commanä filå  likå  á  ^Ç sequencå   would®   Iô  simplù  ringó  thå  belì  anä  continueó processing. Thå  ;»  commanä  ió á ZEØ comment®  Iô anä alì  characteró followinç  iô  uð  tï anä includinç thå followinç  ¢ characteò witè thå mosô significanô biô set®  Thió ió uniquå anä appearó onlù  wheî the prompt comes up on my system. No÷  thaô  É  havå  beateî thå subjecô oæ  thå  ZEØ  Controì Commandó tï death¬ thå followinç exampleó illustratå applicationó employinç them®  Mù commentó appeaò ouô tï thå side¬ prefixeä bù <--. B1>zex ZEX, Version 1.3 1: ^$ this is fun <-- I Define 3 params 2: echo $1 $2 $3 3: ^$ hello from happy acres <-- I Define 4 params 4: echo $1 $2 $3 $4 5: (ZEX Active) <-- ZEX is running now B1>echo this is fun THIS IS FUN B1>echo hello from happy acres HELLO FROM HAPPY ACRES B1> (ZEX Completed) By Your Command > B1>ed demo.zex <-- Demo Command File NEW FILE : *i 1: ed demo.txt <-- Edit DEMO.TXT 2: i <-- Insert text while in ED 3: This is a test 4: This is only a test 5: This is a demo of ZEX Control 6: ^Z <-- ^Z is 2 chars, xlated into 7: b0lt <-- Ctrl-Z by ZEX 8: 1l 9: 0lt 10: i <-- Input More Text 11: ^" <-- I now input text myself 12: type demo.txt <-- When ZEX continues, this 13: era demo.txt <-- is what it does next 14: : *e B1>zex demo <-- Run the command file ZEX, Version 1.3 (ZEX Active) B1>ed demo.txt NEW FILE : *i <-- ZEX is typing this in 1: This is a test 2: This is only a test 3: This is a demo of ZEX Control 4: : *b0lt 1: This is a test 1: *1l 2: *0lt 2: This is only a test 2: *i <-- Now my input begins 2: I am now typing this line of my own volition <-- I type 3: ZEX will allow me to continue doing this until 4: it sees the ZCPR2 prompt 5: <-- I type Ctrl-Z 5: *e <-- I type "e" (ZEX Active) B1>type demo.txt <-- ZEX resumes This is a test I am now typing this line of my own volition ZEX will allow me to continue doing this until it sees the ZCPR2 prompt This is only a test This is a demo of ZEX Control B1>era demo.txt DEMO .TXT B1> (ZEX Completed) By Your Command > B1>ed demo.mac <-- Now to use ZEX for <-- program assembly NEW FILE : *i <-- I type program 1: ext print 2: 3: call print 4: db 'Hello, World ... It''s Another Day',0 5: ret 6: 7: end 8: : *e B1>type a:m80.zex <-- My M80.ZEX command file ; M80.SUB -- MACRO-80 Assembler and Linker M80 =$1 ; Please Type $^C if Error(s) Exist - ^? ERA $1.BAK ERA $1.COM L80 /P:100,$1,A:SYSLIB/S,$1/N,/U,/E ERA $1.REL ; Assembly Complete B1>zex m80 demo <-- Run command file on my pgm ZEX, Version 1.3 (ZEX Active) B1>; M80.SUB -- MACRO-80 Assembler and Linker B1>M80 =DEMO No Fatal errr(s) (ZEX Active) B1>; Please Type ^C if Error(s) Exist - <-- I can abort now <-- if I wish B1>ERA DEMO.BAK DEMO .BAK B1>ERA DEMO.COM No File B1>L80 /P:100,DEMO,A:SYSLIB/S,DEMO/N,/U,/E Link-80 3.44 09-Dec-81 Copyright (c) 1981 Microsoft Data 0100 01C5 < 197> 35936 Bytes Free Data 0100 01C5 < 197> 35936 Bytes Free [0000 01C5 1] (ZEX Active) B1>ERA DEMO.REL DEMO .REL B1>; Assembly Complete B1> (ZEX Completed) By Your Command>demo <-- I run pgm now Hello, World ... It's Another Day B1> :Restrictions on Command Files Thå  followinç  restrictionó  arå applieä tï  commanä  fileó processed by SUB2 and ZEX. SUB2 Restrictions 1®  Yoõ maù noô loç intï useò areaó otheò thaî thå onå  yoõ begaî  processinç thå commanä filå in®  Iæ yoõ do¬  ZCPR² looseó tracë  oæ  thå $$$.SU filå anä executioî ió  aborteä  untiì  yoõ reenter the original user area, at which time execution resumes. 2®  Uð  tï 2° parameteró arå permitteä oî thå SUB²  commanä line. 3. You may nest SUB2 command files to any depth. ZEX Restrictions 1®  Yoõ  maù movå intï anù directorù yoõ desirå whilå á ZEØ command stream is being executed. 2®  Uð  tï  ¹ parameteró arå permitteä oî thå  ZEØ  commanä line. 3. You may NOT nest ZEX command files. :SUB2 and ZEX as Extended Command Processors Under ZCPR2 Botè  SUB²  anä  ZEØ makå nicå Extendeä  Commanä  Processoró undeò  ZCPR2®  Wå  havå  alreadù  seeî  ho÷  SUB²  anä  ZEØ  arå intimatelù  linkeä witè ZCPR2®  Botè uså thå Externaì  Patè  anä Multiplå  Commanä  Linå Buffeò Facilitieó oæ ZCPR2¬  anä  ZEØ  ió further prompted for input by the ZCPR2 prompt if desired. Tï  refresè thå reader¬  anä Extendeä Commanä Processoò ió á prograí invokeä bù ZCPR² wheî iô failó tï finä thå commanä  alonç itó  path®  ZCPR2¬  upoî  failinç  tï finä thå  COÍ  filå  whicè correspondó  tï  thå commanä namå giveî tï it¬  caî bå seô uð  tï eitheò searcè thå patè oò gï directlù tï thå rooô oæ thå patè anä looë  foò  aî  Extendeä  Commanä  Processor®   Iæ  found¬  ZCPR² simulateó   á  commanä  tï  thaô  Extendeä   Commanä   Processor¬ substitutinç thå user'ó commanä linå aó thå argumentó tï it. To illustrate my point, consider the following example: É  havå á ZEØ filå nameä MASM.ZEX¬  anä iô performó thå samå set of commands that my M80.ZEX file did above, namely: ; MASM.ZEX -- MACRO-80 Assembler and Linker M80 =$1 ; Please Type $^C if Error(s) Exist - ^? ERA $1.BAK ERA $1.COM L80 /P:100,$1,A:SYSLIB/S,$1/N,/U,/E ERA $1.REL ; Assembly Complete É typå iî mù program¬  nameä DEMO.MAC¬ anä issuå thå commanä "MASÍ DEMO"®  Witè ZEØ aó mù Extendeä Commanä  Processor¬  ZCPR² lookó alonç thå patè foò thå commanä MASM¬  failó tï finä it¬ anä theî  simulateó thå commanä "ZEØ MASÍ DEMO"®  Thå abovå  commanä file is then executed with DEMO as its passed parameter! É  thinë  thaô thå abovå examplå illustrateó thå utilitù  oæ employinç ZEØ (oò SUB2© aó aî Extendeä Commanä  Processor®  Thió ió donå verù simplù iî thå ZCPR² environment® Tï dï this¬ simplù makå á copù oæ ZEX.COÍ anä namå iô CMDRUN.COM® Sincå thió ió thå namå  iî thå ZCPRHDR.LI filå anä thå facilitù ió turneä on¬  yoõ now have ZEX as the Extended Command Processor.