; Command File Processing -- Basics -- 0 - Overview 1 - Restrictions 2 - Extended Cmd Procs -- Disk-Based Command Files -- -- Memory-Based Command Files -- S - The SUB Utility Z - The ZEX Utility E - SUB Error Messages D - ZEX Directives G - GOTO Command :0 Overview of Command Files Á  Commanä  Filå ió á filå  containinç  commands¬  witè optionaì  parameteò substitution¬  whicè caî bå executeä  bù ZCPR3®  Theså  commandó  arå  exactlù  thå  samå  kindó  oæ commandó aó yoõ woulä issuå aô thå console¬  anä anù commanä whicè caî bå issueä froí thå consolå caî alsï bå issueä froí withiî á Commanä Filå (witè jusô á couplå oæ restrictions). Thå   Commanä  Filå  Facilitieó  oæ  SU  anä  ZEØ  arå availablå  undeò ZCPR3®  Similaò iî concepô tï  thå  SUBMIÔ facilitù oæ CP/M¬  botè SU anä ZEØ arå upward-compatablå tï SUBMIÔ   (anù   SU  filå  caî  ruî  undeò  theí  witè   fe÷ restrictions). Botè  SU 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®  SU buildó thå  commanä streaí tï bå executeä oî disë drivå Á undeò thå currenô useò number¬ anä ZEØ buildó thå commanä streaí iî memory. ZEØ  ió generallù preferreä tï  SUB®  Undeò  ZEX¬  thå commanä  streaí ió executeä mucè morå quicklù thaî undeò SU sincå ZEØ accesseó memorù foò thå nexô characteò whilå ZCPR³ haó tï gï tï disk® ZEX¬ however¬ takeó 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ò SUB®  Thió ió thå basiã trade-ofæ betweeî thå twï Commanä Filå Processors. Anotheò  differencå  betweeî SU anä ZEØ  ió  thaô  SU commanä  streamó  arå  line-orienteä anä extracteä  onlù  bù ZCPR3®  Thaô  is¬  SU 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æ ZCPR³ findó á pendinç  command¬ thå commanä ió executed®  Iæ not¬ ZCPR³ checkó thå Aº drivå (currenô  user©  foò á $$$.SU file®  Iæ á $$$.SU filå  ió found¬  ZCPR³ 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å ió  noô found¬ ZCPR³ promptó thå useò foò input. Thaô  ió  ho÷  commanä streaí processinç undeò  SU  ió performed®  ZEX¬  however¬ actó aó á combinatioî oæ SU 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ä returnó iô tï thå callinç prograí iæ iô ió noô á ZEØ command. Iî á sense¬  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å exceptionó tï thió case¬ buô theù wilì bå discusseä later. Botè SU anä ZEØ fiô intï thå ZCPR³ Systeí nicely¬  anä theù  caî  bå useä tï acô aó Extendeä Commanä Processoró  iæ desired® Thió ió discusseä later. :G Command: GOTO 1.0 Syntax: GOTO label ;=label any_text Function: GOTÏ ió á ZCPR³ utility¬ designeä tï bå ruî froí withiî á  ZEØ commanä file¬  whicè permitó branching®  Iô  acceptó onlù onå argument¬  á label¬ whicè ió defineä withiî thå ZEØ filå aó á speciaì commenô oæ thå form: ;=label Anù  texô whicè followó thå "label¢ phraså ió considereä  tï be comment and is not processed. Options: None Comments: GOTÏ wilì ONLÙ worë correctlù iæ executeä withiî á  ZEØ command file. GOTO will issue an error message otherwise. Withouô thå ZCPR³ Flo÷ Controì facility¬  GOTÏ woulä bå oæ littlå value® Witè IF¬ however¬ GOTÏ ió extremelù usefuì in setting up loops and other flow-control constructs. Selected Error Messages: "ZEØ  Noô  Running¢ meanó thaô GOTÏ waó  executeä  froí outside a ZEX command file. "Labeì  xxø  Noô Founä -- Abortinç ZEX¢ meanó thaô  thå referenceä labeì waó noô founä withiî thå commanä  file¬  sï ZEX execution is terminated. Examples of Use: ZEX Command File 1: REG S1 0;note Register 1 = 0 ;=start XIF;note Exit all pending IFs ECHO Hello, World IF ~1 3;note IF Register 1 <> 3 GOTO START FI ZEX Command File 2: M80 =$1;note Assemble File ; Strike ^C if Errors Exist - ^? if ~nul $3;note IF there are 2 libs ... L80 $1/N,$1,$2/S,$3/S,SYSLIB/S,/U/E;note link all goto done fi if ~nul $2;note IF there is a 2nd arg ... L8° $1/N,$1,$2/S,SYSLIB/S,/U/E;notå linë liâ $2 else;note IF there is no 2nd arg ... L80 $1/N,$1,SYSLIB/S,/U/E;note link ;=done fi ZEX Command File 3: if NEC=$2 echo Terminal is NEC goto done fi if TTY=$2 echo Terminal is TTY goto done fi if DIABLO=$2 echo Terminal is Diablo else echo Terminal is Undefined fi ;=done xif;note Exit all pending IFs ws $1;note Edit file :S Command: SUB 3.0 Syntax: 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 /I <-- Enter Interactive Input Mode SUB filename params <-- As in Standard SUBMIT Function: SU buildó á commanä filå oî disë (nameä $$$.SUB© whicè ZCPR³  lookó  foò eacè timå iô ió readù foò á commanä  line® Iæ  ZCPR³ findó sucè á file¬  iô extractó thå  nexô  commanä from this file. SUB can also be used to sound alarms to the user. Options: As indicated above: A - Permit abort AB - Permit Abort and Ring Bell I - Interactive Input Comments: 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 /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¬ SU  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å SU commanä maù bå nesteä intï á $$$.SU file®  Iæ á "SU filenamå params¢ commanä ió encountereä iî á  $$$.SU file¬ SU 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ò  ZCPR3¬  iæ  SU  ió executeä witè  thå  Multiplå Commanä  Linå Facilitù invokeä anä morå commandó follo÷  thå SU command¬  theî thå resô oæ thå Multiplå Commanä Linå  ió inserteä aô thå enä oæ thå generateä $$$.SU file. Finally¬  SU 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å Commanä Linå Buffeò featureó oæ ZCPR3. Selected Error Messages: "Param¢ erroò meanó thaô á parameteò waó referenceä anä nonå waó giveî oî thå commanä line. "Linå Toï Long¢ meanó thaô thå inpuô line¬  afteò beinç expandeä  witè  thå  inpuô parameters¬  waó  morå  thaî  12¶ characters long. Á  morå completå lisô oæ erroò messageó ió giveî  undeò the indicated section of the main menu. Examples of Use: SUB cmdfile p1 p2 p3 -- thå    filå   'cmdfile.SUB§    ió    processed¬ substituting 'p1' for $1, 'p2' for $2, and 'p3' for $3 SUB /AB -- durinç  thå executioî oæ á commanä  file¬  thió commanä  causeó thå belì tï rinç aô thå consolå anä thå useò is given a chance to abort execution :E SU 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å erroò occuró at. Thå  followinç summarizeó thå erroò messageó  presenteä bù SUB: 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 SUB Error Messages, Con't SUBMIT File Not Found The .SUB file specified in the command line could not be found along the ZCPR3 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 SUB Error Messages, Con't Control Character The ^c form was not followed by a letter A-Z :Z Command: ZEX 3.0 Syntax: ZEX // <-- Print Help ZEX <-- Enter Interactive Mode ZEX filename params <-- Process .ZEX or .SUB file as with SUBMIT Function: ZEØ  ió  á  memory-baseä commanä  filå  processor®  Iô performó functionó likå SU anä XSU combined¬ anä itó inpuô sourcå ió locateä iî memory¬  sï thaô itó executioî speeä ió significantly greater. Options: Aó indicateä above¬ therå arå nï optionó tï ZEX. Comments: Thå   Interactivå   Modå  oæ  ZEØ  executeó  likå   thå Interactivå  Modå  oæ SUB®  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ó modå oæ operation. Thå   "ZEØ   filenamå   params¢  forí   ió   likå   thå correspondinç  SU 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æ typå ZEØ wilì bå 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è SUB¬ á ^à froí thå consolå wilì aborô executioî oæ á ZEØ commanä stream®  Also¬  aó witè SUB¬  iæ á commanä followó  ZEØ  iî á Multiplå Commanä Line¬  ZEØ appendó  thió commanä tï thå commanä stream. Unlikå  SUB¬  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å  SUB¬  ZEØ supportó manù morå embeddeä commands® Combininç thå facilitieó oæ SU 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î anotheò informatioî section. Selected Error Messages: None discussed Examples of Use: ZEX -- the user now enters a group of commands ZEX mycmds p1 p2 -- processinç oæ thå filå 'mycmds.ZEX'¬ or¬ iæ noô found¬ 'mycmds.SUB§ ió performed» 'p1§ ió substituteä foò $± and 'p2' for $2 :D ZEX Directives - 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 Thió  summarù  ió alsï displayeä viá thå  built-iî  ZEØ help. Thå  followinç commandó simplù inserô  characteró  intï thå  ZEØ  commanä  streaí anä wilì noô bå discusseä  iî  anù greateò 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î thå  prompô comeó uð oî mù system. Thå   followinç   exampleó   illustratå    applicationó employinç them®  Commentó appeaò ouô tï thå side¬  prefixeä bù <--. B1>zex ZEX, Version 1.3 1: ^$ this is fun <-- Define 3 params 2: echo $1 $2 $3 3: ^$ hello from happy acres <-- 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: ^" <-- Allow user to input text 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 user input begins 2º É aí no÷ typinç thió linå oæ mù owî volitioî <-- User 3: ZEX will allow me to continue doing this until 4: it sees the ZCPR3 prompt 5: <-- User types Ctrl-Z 5: *e <-- User types "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 ZCPR3 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 <-- User types 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 <-- 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 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 - <-- User can abort now <-- if he wishes 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 <-- Run pgm now Hello, World ... It's Another Day B1> :1 Thå followinç restrictionó arå applieä tï commanä fileó processeä bù SU anä ZEX. SUB 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õ  reenteò thå originaì useò area¬  aô  whicè  timå executioî resumes. 2®  Uð  tï  2°  parameteró arå permitteä  oî  thå  SU commanä line. 3® Yoõ maù nesô SU commanä fileó tï anù depth. ZEX Restrictions 1®  Yoõ maù movå intï anù directorù yoõ desirå whilå á ZEØ commanä streaí ió beinç executed. 2® Uð tï ¹ parameteró arå permitteä oî thå ZEØ commanä line. 3® Yoõ maù NOÔ nesô ZEØ commanä files. :2 Botè  SU anä ZEØ makå nicå Extendeä Commanä Processoró undeò  ZCPR3®  Botè  uså  thå Externaì  Patè  anä  Multiplå Commanä Linå Buffeò Facilitieó oæ ZCPR3¬  anä ZEØ ió furtheò prompteä foò inpuô bù thå ZCPR³ prompô iæ desired. Tï refresè thå reader¬  anä Extendeä Commanä  Processoò ió  á  prograí  invokeä bù ZCPR³ wheî iô failó tï  finä  thå commanä alonç itó path® ZCPR3¬ 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, consider the following example: MASM.ZEØ performó thå samå seô oæ commandó thaô M80.ZEØ filå diä 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 Thå  commanä  "MASÍ DEMO¢ ió issued®  Witè ZEØ aó  thå 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ä filå ió  theî executeä witè DEMÏ aó itó passeä parameter. ZEX¬  oò  anù  otheò program¬  caî bå installeä  aó  aî Extendeä Commanä Processoò bù renaminç iô tï CMDRUN.COM.