ZZZZZZZZZZZ MMMM MMMM ZZ MM MM MM MM ZZ MM MM MM MM ZZ MM MM MM MM ZZ MM MM MM MM ZZ MM MMMM MM ZZ MM MM MM ZZ MM MM ZZ MM MM ZZZZZZZZZZZ MM MM Copyright (c) 1983 Roger E. Donais C O N T E N T S INTRODUCTION..................................... 1 STATEMENT SYNTAX................................. 3 OPCODES.......................................... 3 OPERANDS......................................... 4 OPERATORS........................................ 5 DIRECTIVES....................................... 7 PREDEFINED USER SYMBOLS.......................... 11 TERMINAL ERRORS.................................. 12 FATAL ERRORS..................................... 13 WARNING MESSAGES................................. 14 RUNTIME REQUIREMENTS............................. 16 RESERVED SYMBOLS................................. 17 Z80 SYNTAX SUMMARY............................... 18 ALTERATION....................................... 20 INDEX............................................ 24 I N T R O D U C T I O N ZÍ  translateó  symboliã languagå sourcå fileó intï  machinå executablå  codå iî eitheò (.COM© oò Inteì loadeò (.HEX©  format® Iô haó beeî designeä tï bå easilù useä bù thå novice¬ yeô providå á varietù oæ capabilitieó powerfuì enougè foò thå expert® ZÍ caî bå useä tï assemblå largå fileó oî relativelù smalì systems. TO USE: Enter ZM drive:filename.type options Wherå  'drive§  ió  thå CP/Í drivå whicè  wilì  receivå  thå      assembleä  objecô file¬  'filename.type§ ió anù valiä  CP/Í      file¬ anä 'options§ arå anù oæ thå following: L to get an assembled Listing H to get a .HEX type object file C to get a .COM type object file 1 for listing option 1 (see alteration notes) 2 for listing option 2 (see alteration notes) = to enter subject text (see listing) Alì options¬  excepô '='¬ maù bå entereä iî anù order® Wheî used¬  thå  '=§  optioî musô alwayó  bå  entereä  last®  Defaulô settingó arå NÏ listing¬ NÏ objecô filå anä á blanë subjecô line® ZÍ useó thå samå resourceó tï producå botè á .HEØ anä .COÍ Objecô file¬ thereforå onlù onå oò thå otheò maù bå requested. NOTE: ^C may be used to abort assembly from the keyboard. ^S may be used to pause and restart assembly. EXAMPLE:            C>ZM B:JUNK.PDQ C                Wilì   causå  ZÍ  tï  creatå  thå  objecô  filå                B:JUNK.COÍ  usinç thå firsô JUNK.PDÑ  founä  oî                thå   designateä  drive¬   defaulô  drive¬   aî                internallù  defineä  drivå  oò  drivå  A:®  Iæ                JUNK.PDÑ  cannoô  bå  founä  oî  anù  oæ  theså                drives¬ ZÍ wilì prompô witè thå messageº                --Insert disk with JUNK.PDQ and press                Thå  disë  maù theî bå inserteä iî anù  oæ  thå                previouslù mentioneä drives¬  EXCEPÔ thå  drivå                destineä  tï  receivå thå objecô filå (iî  thió                examplå  B:)®  Thå procesó wilì  repeaô  untiì                JUNK.PDÑ  ió  found¬  oò  á ^à ió  entereä  iî                responså tï thå prompt. ŠLISTINGº A two line heading is printed on each page: SUBJECT: __________________________________________ SOURCE FILE: _______ PAGE - nn DATE: yy/mm/dd Thå  sourcå  filå  ió thå namå oæ thå filå  currentlù  beinç assembleä  (seå INCÌ directive)®  Thå subjecô wilì  contaiî  thå texô  immediatelù followinç aî equaì sign®  Controì  characteró maù bå entereä initializå specifiã printeò options® Maximuí texô lengtè ió 6³ characters. Aî  assemblù listinç ió printeä onlù wheî thå 'L' optioî haó beeî selected®  Thå actuaì listinç maù theî bå  disabled/enableä bù LISÔ directive®  Á partiaì listing¬  consistinç oæ alì sourcå statementó  containinç warninç anä fataì assemblù erroò messages¬ wilì bå printeä wheneveò thå 'L' optioî haó noô beeî selected. END OF ASSEMBLY: The following will be displayed: NEXT ADDRESS nnnn NEXT DATA nnnn FREE MEMORY nnnn STACK SPACE nnnn ERROR COUNT nnnn/nnnn NEXT ADDRESÓ  ió thå firsô hexadecimaì addresó followinç thå lasô      iteí oæ assembleä code.       NEXT DATÁ  ió  thå hexadecimaì valuå currentlù  assigneä  tï  thå      predefineä  symboì  DATA®  (seå  directiveó  anä  predefineä      symbols)®  Dependinç upoî ho÷ thå DATÁ directive/symboì waó      used¬  NEXÔ ADDRESÓ oò NEXÔ DATÁ coulä bå useä aó thå origiî      foò á co-residenô program.       FREE MEMORÙ ió á hexadecimaì counô oæ memorù availablå foò symboì      definitionó  oò  expandeä  objecô filå buffeò  (seå  RUNTIMÅ      requirements).       STACK SPACÅ ió á decimaì counô oæ memorù availablå foò expressioî      evaluatioî   anä   sourcå  filå   inclusioî   (seå   RUNTIMÅ      requirements).       ERROR COUNÔ  ió  á twï parô decimaì numbeò correspondinç  tï  thå      numbeò  oæ  statementó taggeä witè  fatal/warninç  messages®      Thå  suí  oæ  theså  numberó reflecô  thå  totaì  numbeò  oæ      statements¬ noô thå totaì numbeò oæ erroò messages. Š_ _ _ _ _ _ _ _ S T A T E M E N T S Y N T A X _ _ _ _ _ _ _ _ The general format of an assembly statement is: LABEL OPCODE OPERAND(s) COMMENT       UNDERSCORÅ  anä  COLOÎ characteró arå ignored¬  excepô wheî  useä      betweeî quotes®  Aî exaggerateä examplå ió _L_D_º  anä  LÄ      beinç equivalent.       SPACEÓ arå useä onlù tï identifù aî iteí boundary¬ otherwiså theù      maù   bå  useä  withouô  restrictioî  betweeî  anù  element¬      includinç partó oæ aî expression.       TABS (ascié 0Aè oò ^I© arå treateä aó spaceó durinç assemblù  anä      expandeä  tï  everù  eighô prinô positioî  onlù  withiî  thå      listing.       LINE FEEÄ  (ascié 0Aè oò ^J© ió alwayó recognizeä aó thå enä oæ á      sourcå statemenô anä maù NOÔ appeaò anywherå iî á statement       CONTROÌ CHARACTERÓ (ascié 00è througè 1Fh© arå treateä similaò tï      spaceó  iî  thaô  theù wilì marë thå boundarù  oæ  aî  item¬      otherwiså  theù maù appeaò aô anù poinô withiî á  statement®      Theù  arå  noô processeä durinç assembly¬  buô senô  tï  thå      printeò  `aó  is'®  Notå thaô thió applieó tï  alì  controì      characteró  excepô  tabó  (ascié 09è oò ^I©  anä  linå  feeä      (ascié 0Aè oò ^J© whicè arå explaineä above®       BIT-7 ió  removeä froí alì characteró iî thå sourcå  filå  beforå      processing®  Thió  eliminateó thå neeä tï preprocesó  fileó      thaô havå beeî editeä aó á WordStaò document.       DECIMAÌ  POINTS¬  entereä aó thå firsô characteò iî á  statement¬      arå  recognizeä aó WordStaò DOÔ COMMANDS®  Thå entirå  linå      wilì bå discardeä anä wilì noô appeaò oî thå listing®       LABELÓ oò SYMBOLÓ arå items¬  ± tï 3± characteò long¬ whoså firsô      characteò  ió  alwayó  á letteò (Á thrõ Z© anä arå  useä  tï      represenô  aî addresó oò value®  Embeddeä  underscoreó  anä      colonó  arå ignoreä anä dï NOÔ counô towarä thå 3± characteò      limit®   Botè   uppeò   anä   loweò  caså   maù   bå   useä      interchangeably®  S_y_m_b_o_lº  anä  SYMBOÌ arå  thå  same®      Labeló arå optionaì foò alì statementó excepô MARË anä DATA®      Wheî  omiteä froí aî EQÕ statement¬  thå resolveä expressioî      ió  displayeä  oî thå listing¬  buô thå valuå  wilì  noô  bå      retained®  Labeló  oî á linå bù themselveó arå assigneä thå      valuå  oæ thå currenô assemblù address®  NÏ  reserveä  worä      (opcode¬  directivå  oò  operand©  maù bå useä aó  á  label®      Labeló dï noô havå tï begiî iî thå firsô characteò position¬      buô dï havå tï bå thå firsô iteí iî thå statement.       OPCODEÓ  arå Z8° instructioî mnemonicó oò  assembleò  directives®      (Seå Z8° instructioî syntaø foò additionaì details) ŠOPERANDÓ  arå numeriã constants¬  reserveä symbols¬  useò defineä      labeló oò expressions® Theiò uså ió strictlù dependenô upoî      thå OPCODÅ useä iî thå sourcå statement®  ZÍ recognizeó twï      speciaì symboló iî thå operanä field. ¤  Thå dollaò sigî ió useä iî aî expressioî tï  represenô      thå  assemblù addresó foò thå currenô statement®  Iô maù bå      useä alonå oò aó parô oæ aî arithmetiã expression. Ü  Thå  backslasè  ió useä iî placå oæ anù  ¸  oò  16-biô      immediatå operanä tï 'cut' thå instruction®  Thió allowó  á      formaì  meanó  oæ representinç anä documentinç  aî  advanceä      assemblù  languagå techniquå wherå thå immediatå operanä foò      onå instructioî ió itselæ aî instruction®  Thå practicå  ió      ofteî  useä  tï  creatå á onå oò twï bytå relativå  jumð  bù      usinç aî ¸ oò 1¶ biô registeò tï loaä thå in-linå  code¬  oò      tï  flaç  thå  entrù foò á singlå routinå  thaô  musô  lateò      continuå witè separatå procedures. EXAMPLE: ENTRY_1 OR \ ;OR 0AFh makes NZ ENTRY_2 XOR A ;Makes Z True PUSH AF ;Save entry flag (procedure common to both) POP AF ;Retrieve entry flag JP Z,PROC_2 ; (procedure unique to Entry_1) RET PROC_2 (procedure unique to Entry_2) RET EXAMPLE: ERROR_1 LD A,0 LD BC,\ ;Skip-2 ERROR_2 LD A,2 LD BC,\ ;Skip-2 ERROR_3 LD A,4 (Continue with common routine)       NUMERIà CONSTANTÓ  arå  literaì valueó ± tï 3±  characteró  lonç      whoså  firsô  characteò  ió  alwayó á  numbeò  (°  thrõ  9)®      Embeddeä underscoreó anä colonó arå ignoreä anä dï NOÔ counô      towarä  thå 3± characteò limit®  Botè uppeò anä loweò  caså      maù bå useä interchangeably®  Á suffiø ió useä tï  indicatå      thå desireä base® Anù overflo÷ whilå evaluatinç á numbeò ió      IGNORED¬ witè onlù thå loweò ² byteó beinç retained.      BINARÙ  CONSTANTÓ arå á sequencå oæ 0'ó anä 1'ó followeä  bù      thå letteò B.      OCTAÌ  CONSTANTÓ  arå á sequencå oæ thå digitó °  througè  ·      followeä bù thå letteò Ï oò thå letteò Q. Š     DECIMAÌ  CONSTANTÓ arå á sequencå oæ thå digitó ° througè  ¹      witè  nï baså designatioî suffix®  ¨ 0ä ió NOÔ decimaì zero¬      buô aî illegaì number¡ ©      HEXADECIMAÌ CONSTANTÓ arå á sequencå oæ thå digitó ° througè      ¹ anä thå letteró Á througè Æ followeä bù thå letteò H.         STRINÇ CONSTANTÓ arå á sequencå oæ ANÙ ascié characters¬ excepô á      linå  feeä (ascié 0Ah)¬  encloseä betweeî  apostropheó  (')®      Loweò  caså letteró arå noô converteä tï uppercase¬  noò arå      taâ  characteró  (ascié 09h© expandeä withiî  thå  assembleä      code®  Tabó are¬  however¬ expandeä oî thå printeä listing®      Aî apostrophå maù bå includeä withiî á strinç bù immediatelù      followinç iô witè á seconä one® Tï includå aî apostrophå aô      thå enä oæ á strinç requireó threå iî á ro÷ (onå tï indicatå      enä  oæ  string)®  Á quoteä strinç containinç á  linå  feeä      characteò  (ascié  0Ah© wilì causå á fataì  erroò  foò  thaô      statement®   Strinç   constantó  maù  NOÔ  bå  useä  iî  aî      arithmetiã expression.       CHARACTEÒ CONSTANTÓ arå á SINGLÅ ascié character¬  excepô á  linå      feeä (ascié 0Ah)¬  encloseä betweeî apostropheó (')®  Loweò      caså letteró arå noô converteä tï uppeò case® Aî apostrophå      maù  alsï bå quoteä (''')®  Characteò constantó maù bå useä      iî  aî arithmetiã expressioî (thå assembleò assignó  á  zerï      valuå tï thå mosô significanô byte).       EXPRESSIONÓ  arå á sequencå oæ constantó anä useò defineä  labeló      separateä  bù  arithmetiã  oò  logicaì  operators®   Durinç      assemblù  eacè  expressioî ió evaluateä iî á stricô lefô  tï      righô  sequencå  anä  reduceä tï á singlå  worä  (twï  byte©      value® Anù overflo÷ durinç evaluatioî ió ignored. OPERATORS: Û  Ý  Bracketó  arå useä iî aî expressioî  tï  controì  thå      stricô  lefô  tï righô evaluatioî process¬  oò tï  makå  thå      expressioî  easieò tï read®  Remembeò thaô Z8° syntaø  useó      parentheseó  `¨  )§  tï denotå  memorù  addressinç  anä  arå      thereforå  noô  aî  integraì  parô  oæ  aî  expression®  Aî      expressioî  containeä  bù  bracketó ió treateä aó  á  singlå      item. «  ADDÓ thå nexô iteí tï thå currenô valuå (maù  alsï  bå      useä aó á unarù operator). - SUBTRACTÓ  thå  nexô iteí froí thå currenô  valuå  (maù      alsï bå useä aó á unarù operator)® * MULTIPLIES the current value by the next item. & Logically ANDs the current value with the next item. # Logically XORs the current value with the next item. Š ¼  SHIFTÓ  thå currenô valuå lefô thå amounô oæ thå  nexô      item®  Higè ordeò bitó arå discardeä anä lo÷ ordeò bitó arå      replaceä witè zeros. ¾  SHIFTÓ thå currenô valuå righô thå amounô oæ thå  nexô      item®  Lo÷ ordeò bitó arå discardeä anä higè ordeò bitó arå      replaceä witè zeros. ¡ Compareó thå currenô valuå witè thå nexô iteí anä keepó      thå LARGEÒ oæ thå two. ½ Setó thå currenô valuå TRUÅ (-1¬  alì bitó set© iæ  thå      currenô  iteí  anä nexô iteí arå equal¬  otherwiså setó  thå      currenô valuå equaì tï zero. Þ  Ió  á unarù operatoò useä tï creatå aî  ascié  controì      character® Iô musô exactlù precedå (nï spaces© thå unquoteä      character® (e.g® ^Ú oò ^ú givå á controì Z) À  Ió á unarù operatoò designeä tï returî  thå  interferå      valuå  froí  á memorù locatioî aô assemblù  time®  Itó  uså      shoulä  bå  restricteä tï verù speciaì occasionó  sincå  thå      resultinç  codå  wilì  functioî properlù onlù  iæ  thå  samå      valueó  exisô  aô  runtime®  Itó primarù uså ió  tï  creatå      systeí specifiã extensions¬ oò overlays. EXAMPLE: LD HL,(06) ; Runtime BDOS entry LD DE,@6 ; Assembly Time BDOS entry OR A SBàHL,DÅ    » tesô runtimå compatibility JP NZ,IMPROPER ¿  Ió  á  kludgeä  operatoò  foò uså  witè  MARË  anä  IÆ      directiveó  tï providå á primitivå librarù  capabilitù  thaô      assembleó onlù requireä functions. MARK symbol = ? wilì   creatå   symboì  iæ  iô  doeó  noô   exist¬       otherwise it does nothing. IF? symbol ió  TRUÅ  onlù  iæ  symboì  haó  beeî   previouslù       defined. EXAMPLE: (main program) MARK CON_INP = ?, PRINT = ?, ...etc INCLUDE B:LIBRARY.C13 (library source) IF? PRINT PRINT MARK CON_OUT = ? (code for print subroutine) ENDIF ; PRINT subroutine IF? CON_OUT CON_OUT (code for con_out subroutine) ENDIF ; CON_OUT subroutine Š ADDRESSINÇ  involveó  thå Z8° registers¬  memorù  referenceó  oò      expressionó  useä iî thå operanä fielä oæ á sourcå statemenô      anä  arå covereä iî greateò detaiì iî thå manù bookó oî  Z8°      assemblù  languagå  programming®   Thå  maiî  inconsistencù      amongsô  theså textó ió thå forí useä tï addresó  8-biô  Z8°      arithmetiã  anä  logiã  instructions®  Somå  uså  onlù  onå      operand¬  omittinç  thå A-registeò froí thå sourcå statemenô      entirely®   Anotheò  useó  twï  operandó  onlù  foò   thoså      instructionó havinç á 16-biô counterparô anä onå operanä foò      thå  remaininç instructions®  Á thirä requireó twï operandó      foò  alì  instructionó arithmetiã  anä  logiã  instructions®      Sincå choosinç onå oæ theså techniqueó ió reallù á matteò oæ      personaì preference¬  ZÍ wilì recognizå anä procesó botè thå      firsô  anä third®  Thió meanó yoõ maù choså tï uså á singlå      operand¬ oò twï operands¬ foò alì 8-biô arithmetiã anä logiã      instructions®  Á  recorä  wilì ió kepô  oî  thå  particulaò      methoä  used¬  anä  iæ noô consistent¬  wilì causå á  singlå      warninç messagå tï printed.       DIRECTIVEÓ  arå  commandó  tï direcô  thå  assembleò  durinç  thå      assemblù procesó anä havå nï meaninç tï thå Z8° processor® EQÕ assignó thå valuå oæ aî expressioî tï á label® Iæ therå      ió nï label¬ thå valuå wilì ió displayed¬ withouô error¬ buô      thå valuå ió noô bå retained. label EQU expression EQU expression      DEFÓ  anä  DÓ definå storagå bù reservinç thå thå numbeò  oæ      byteó foò storagå representeä bù thå expression. DS expression DEFS expression      DEF  anä D assemblå aî expressioî á bytå aô á  time®  Thå      expressioî  maù  bå arithmetiã  oò  string®  Alsï  supportó      multiplå expressionó seperateä bù comas. DB expression, expression DEFB expression, expression      DEF×  anä  D× assemblå aî expressioî á worä aô á  timå  (Z8°      fashioî  witè  LS first)®  Supportó  multiplå  expressionó      separateä bù comas. DW expression, expression DEFW expression, expression      DEFÍ  anä DÍ assemblå aî expressioî á bytå aô á  time®  Thå      expressioî  maù bå arithmetic¬  á strinç oò á combinatioî oæ      both¬  seperateä  bù  comas®  Thå lengtè oæ  thå  evaluateä      strinç ió placeä aô thå currenô assemblù addresó followeä bù      thå evaluateä string. DM expression,expression DEFM expression,expression Š      ORÇ  initializeó  thå assemblù addresó tï thå valuå  oæ  thå      expression®  Anù  labeì oî thió linå wilì alsï bå  assigneä      thió value. ORG expression      RUΠ acceptó  thå  valuå oæ aî  expressioî  aó  thå  logicaì      executioî  address®  Aî  offseô ió theî useä tï definå  alì      subsequenô labeló anä thå assemblù operanä '$'® Thió allowó      assemblinç codå thaô wilì bå moveä froí thå currenô physicaì      addresó tï bå executeä aô á differenô address® Useó includå      ROÍ  residenô  codå anä banë  switchinç  requirements®  Anù      labeì oî thió linå wilì bå assigneä thå valuå beforå thå RUÎ      evaluation. RUΠ expressioî  »executå aô expressioî RUN $ ;execute at physical      INCÌ mergeó anotheò sourcå filå witè thå currenô  one®  Thå      filå  namå caî contaiî onlù thå letteró Á tï Ú anä numberó °      tï  9®  Aî optionaì drivå identifieò maù bå given®  Iæ  nï      filå typå ió specified¬  á nulì typå ió  assumed®  Assemblù      resumeó witè thå statemenô followinç thå INCL¬  oncå thå enä      oæ filå oò ENÄ directivå ió reached®  Thå includeä filå maù      alsï contaiî INCÌ directives® Yoõ wilì bå alloweä tï changå      diskó  iæ  thå filå cannoô bå found®  Thå disë maù theî  bå      placeä oî thå specifieä drive¬  defaulô drive¬  oò drivå A:®      Dï  NOÔ changå thå disë thaô ió tï receivå thå .COÍ oò  .HEØ      filå  aó  iô  wilì causå á CP/Í disë  writå  erroò  wheî  ZÍ      attemptó  tï  writå thå filå tï disk®  Promptinç  continueó      untiì thå filå ió found¬ oò á ^à ió entered. INCL ,<.type>      ENÄ markó thå logicaì enä oæ á sourcå file®  Assemblù  wilì      NOÔ  proceeä  beyonä  thaô  point®  Thå  ENÄ  statemenô  ió      optional® Iæ noô used¬ assemblù wilì continuå tï thå enä oæ      thå file. END      LISÔ  turnó thå listinç OÎ oò OFÆ onlù iæ thå 'L§ optioî waó      requested®  Iæ  thå  expressioî ió resolveä tï  á  non-zerï      value¬  thå listinç ió enabled®  Iæ thå expressioî ió zero¬      thå listinç ió disabled®  Statementó witè erroró arå alwayó      listeä witè theiò associateä messageó regardlesó oæ thå LISÔ      settinç oò 'L§ option. LIST expression Š     IF¬  ELSE¬  anä  ENDIÆ arå useä tï  providå  controlled¬  oò      conditionaì assembly®  Wheî thå evaluateä expressioî ió NOÔ      zero¬   alì   statementó   wilì  bå  assembleä   untiì   thå      correspondinç ELSÅ oò ENDIÆ ió reached®  Thå ELSÅ directivå      ió optional®  Wheî used¬  thoså statementó betweeî thå ELSÅ      anä   ENDIÆ  wilì  bå  assembleä  onlù  wheî  thå   previouó      expressioî resolveä tï zero® IF'ó maù bå nesteä seveî deep®      THå  followinç  examplå besô showó thå relationshið  betweeî      nesteä IÆ directives. IF expression1 (following statements will assemble only if the expression is NOT zero) IF expression2 (following statements assemble only if expression1 is NOT zero AND expression2 is NOT zero) ENDIF (following statements assemble only if expression1 is NOT zero) ELSE (following statements assemble only if expression1 is ZERO) IF expression3 (following statements assemble only if expression1 is ZERO AND expression3 is NOT zero) ELSE (following statements assemble only if expression1 is ZERO AND expression3 is ZERO) ENDIF (following statements assemble only if expression1 is ZERO) ENDIF (assembly resumes in a normal manner)      MARË setó á labeì tï thå currenô assemblù addresó oò tï  thå      valuå oæ aî expressioî followinç thå equaì sigî '='® Iæ thå      labeì  haó beeî previouslù defineä anä noô marked¬  aî erroò      wilì  occur®  MARË  supportó multiplå labeló  seperateä  bù      comas®  MARKeä  labeló maù bå useä iî anù  desireä  manner®      Theù  diffeò froí normaì labeló iî thaô theù maù bå  reused®      Thå  mosô recentlù defineä valuå ió useä wheî á markeä labeì      appearó iî aî expressioî (seå ¿ operator). MARK label1,label2 = expression, ...etc Š     DATÁ  existó botè aó á directivå anä aó á predefineä  label®      Thå directivå assignó thå currenô valuå oæ DATÁ tï á  label¬      theî  reassignó  DATÁ  ½ DATÁ  «  expression®  Thió  allowó      defininç  internaì datá overlayó oò á datá areá outsidå  thå      physicaì  program®  Usinç DATÁ withouô á labeì wilì causå á      fataì erroò (missinç data). label DATA expression      MSÇ  evaluateó aî expressioî similaò tï á DEF anä  displayó      iô  oî thå monitor®  Thå expressioî useä musô  contaiî  alì      controì  characteró required¬  includinç carriagå returî anä      linå feed® Á dollaò sigî '$§ ió thå onlù characteò thaô maù      noô  appeaò  iî thå evaluateä text®  Nï  texô  wilì  appeaò      afterward¬ anä nï erroò wilì bå generated.      GEÔ wilì accepô froí ± tï 4± characteró froí thå consolå anä      appenä  theí tï thå currenô statement®  GEÔ ió theî ignoreä      anä thå statemenô assembleó iî thå usuaì  manner®  Remembeò      tï  leavå  anù necessarù spacå aô thå enä oæ thå  statement®      Uså MSÇ tï providå thå necessarù prompting. MSG 'ENTER PRINTER SELECTION:', cr, lf, lf MSG '1. Epson mx-80/100', cr, lf MSG '2. Okidata 82a', cr, lf MSG '3. Anderson Jacobson', tab GET MARK PRINTER = IF Printer =1 (epson code assembles here) ENDIF IÆ Printeò =2 (okidata code assembles here) ENDIF IF Printer =3 (anderson code assembles here) ENDIF (normal program code continues here) ŠÐÒÅÄÅÆÉÎÅÄ ÕÓÅÒ ÓÙÍÂÏÌÓ      DATÁ  ió  useä witè thå DATÁ  directive®  Tï  initializå  oò      reinitializå itó valuå iô musô uså thå marë directive. EXAMPLE: ORG 100H MARK DATA, LOOP CALL INITIALIZE DB 'Initial Program signon message$' DB 'Additional text for "TYPE .COM"', 1AH FÃB2 DATA 33 COUNT DATA 2 ORG DATA ! $                Iî thå abovå examplå FCB² overlayó thå beginninç                oæ thå prograí aô 100è anä COUNÔ ió assigneä 121h®                Thå assemblù addresó ió theî adjusteä tï thå                largeò oæ thå two.      IØ  anä IÙ arå useä tï evaluatå memorù referenceó  involvinç      theiò  respectivå  indeø  registers®  Theù musô  alwayó  bå      defineä witè á negativå value. EXAMPLE: FLAGS DATA 1 ;One byte flag variable IX EQU -DATA ;<--<< IX BASE ADDRESS <--<< TEMP DATA 2                Symboì IØ haó beeî defineä aó thå negativå valuå                oæ DATA® Thå instructioî SEÔ 0,(IX+FLAGS© wilì                assemblå witè thå correcô displacemenô offset®                Thå followinç ió equivalent¬ buô requireó                additionaì typingº SET 0,(IX+FLAGS-BASEX) EXAMPLE: FLAGS DATA 1 ;One byte flag variable BASEX EQU DATA ;<--<< IX BASE ADDRESS <--<< TEMP DATA 2                Loadinç thå indeø registeò witè thió addresó                durinç prograí executioî musô uså thå negativå                valuå also. LD IX,-IX ;Initialize IX base position NOTE:   Sincå botè predefineä symboló IØ anä IÙ arå                 initiallù zero¬ NOÔ usinç theí wilì causå                 assemblù tï takå placå iî thå usuaì manner® Iæ                 yoõ dï uså them¬ remembeò theù arå redefinablå                 anä wilì affecô onlù thoså expressionó FORWARÄ oæ                 themselves® Alsï realizå thå beginninç oæ á                 sourcå filå ió AFTEÒ thå ENÄ durinç thå seconä                 pass® Thereforå iæ yoõ plaî oî usinç ANÙ                 redefinablå symbol¬ buô expecô iô tï bå zerï aô                 thå beginning¬ MARË IÔ BEFORÅ YOÕ SEÔ THÅ ORIGIÎ                 or EQUATE IT TO ZERO ! Š_ _ _ _ _ _ _ _ _ _ _ _ _ E R R O R S _ _ _ _ _ _ _ _ _ _ _ _ _ Therå  arå  threå  typeó oæ  errors®  Terminal¬  fataì  anä warning®  Alì  Terminaì erroró arå displayeä oî thå monitoò  anä prograí  executioî stops®  Fataì erroró resulô iî thå  offendinç sourcå  statemenô  noô beinç  processed®  Warninç  messageó  arå provideä   wheî   thå   integritù  oæ  thå  assembleä   codå   ió questionable®  Warninç  anä erroò messageó wilì alwayó prinô  tï thå  assigneä  CP/Í LSTº  devicå eveî iæ thå `L§ optioî  waó  noô selected. _______________________________________________________________ TERMINAL ERRORSº Assemblù stopó anä controì ió returneä tï thå           CP/M system. ILLEGAL OPTION. L = Listing H = Hex object file C = Com object file 1 = 10 lpi x 10 cpi 2 = 8 lpi x 17 cpi Cause: Thå filå typå containeä aî unrecognizeä character. Solution: Examinå anä reenteò thå commanä line® Remembeò tï placå           aî `=§ aô thå beginninç oæ á subjecô. ** CANNOT HAVE BOTH '.HEX' & '.COM' OUTPUTS ** Causeº Botè thå È anä à optionó werå requested® Solution: Reenteò thå commoî linå witè aî È option¬ theî uså thå           CP/Í 'LOAD' utilitù tï providå thå .COÍ file. ** CANNOT CREATE/OPEN OBJECT FILE ** Causeº Thió wilì mosô likelù resulô froí á FULÌ Directory. Solution: Erase a few files to make room. ** DISK or DIRECTORY FULL ** Cause: The system reported it could NOT write the object file. Solution: Erase a few file to make room, and try again. ** SYMBOL TABLE OVERFLOW ** Cause: Symbol and GET storage have collided! Solution: Shorteî  Symboì  names¬  uså morå  MARK'ä  symbols¬  oò           separatå thå sourcå filå intï twï oò morå smalleò  oneó           anä assemblå thå separately. NOTE: See RUNTIME requirements for additional information. ** STACK OVERFLOW ** Cause: The hardware stack and source statements have collided. Solution: Reducå   thå   INCÌ  nesô   level¬   simplifù   compleø           expressions¬ uså shorteò sourcå statements. NOTE: See RUNTIME requirements for additional information. Š ** CANNOT CLOSE OBJECT FILE ** Cause: Something prevented CP/M from closing the output file. Solution: Read the CP/M manual for causes and solutions. ** INVALID OBJECT (.COM) FILE ABANDONED ** Cause:  Thå initiaì ORÇ waó noô 100h¬  oò lesó thaî thå currenô           assemblù address®  Solutionº  Reorganizå oò Rewritå thå           assemblù sourcå file NOTE:  Thió  erroò  ió noô terminal®  Assemblù wilì  continue¬           providinç á listinç and/oò additionaì erroò messages. ________________________________________________________________ FATAL ERRORSº Nï codå ió generateä foò thå statemenô containinç      thå error® Assemblù continueó witè thå nexô statement® 1: MISSING INFORMATION Cause:  Thå expressioî waó missinç aî operand¬ á comma¬ oò á           parenthesis» oò á statement ended with a comma. 2: ILLEGAL ADDRESSING Cause: Thå operand(s© violatå Z8° addressinç optionó foò thå           opcodå used. 3: NOT IMPLEMENTED Cause:  Á symboì waó useä thaô haó beeî assigneä á futurå  use¬           buô haó noô beeî implemented. 4: ILLEGAL OPCODE Cause: Thå iteí beinç processeä waó noô á recognizeä opcodå oò           assembleò directive®  (Thió relateó tï thå seconä item¬           thå  firsô  waó noô recognizeä anä waó processeä  aó  á           symbol) 5: EXPRESSION TOO LONG Cause: Á statemenô generateä morå thaî 8² byteó oæ codå. 6: ITEM TOO LONG Causeº Á singlå iteí (symboì oò number© exceedeä 3± characters. 7: EXPRESSION ERROR Cause: Aî   expressioî  haä  twï  successivå  operators¬   twï           successivå items¬ á missinç operator¬ á missinç item¬ á           missinç   righô   parentheses¬    includeä   extraneouó           characters¬ oò containeä unbalanceä braces. NOTE: Thå  sourcå  statemenô  numbeò  ió  printeä  afteò  anù           warninç  oò  fataì erroò messages®  Thió  numbeò  wilì           matcè tï thå WordStaò non-Documenô FÌ number.           - Line No 0000 - Š_______________________________________________________________ WARNINGS: Thå  codå generateä foò thå statemenô maù NOÔ  bå  whaô           waó intended. 8: MIXED 8-Bit ADDRESSING MODES Cause: Thå  sourcå filå containó á mixturå oæ onå operanä  anä           twï  operanä  addresó  foò 8-biô arithmetiã  anä  logiã           instructions. Result: Sincå  ZÍ handleó botè methods¬  thå codå waó  properlù           assembled®   However¬   haä  thå  intentioî  beeî   tï           consistentlù  uså  onlù onå oæ thå  twï  methods¬  theî           onå oò morå statementó arå noô whaô waó intended. 9: UNBALANCED IF/ENDIF Cause:  Aî  ENÄ  directive,oò  thå enä oæ á  filå  waó  reacheä           withouô enougè ENDIF'ó tï completå alì IÆ directives. Result: The IF/ENDIF balanced was ignored. 10: ORIGIN NOT IN SEQUENCE Cause: Thå  expressioî  foò  aî  ORÇ resolveä  tï  aî  addresó           smalleò thaî thå currenô assemblù address. Result: Any .COM file is abandoned, but assembly resumes. 11: BRANCH (origin - target) OUT OF RANGE Cause: Thå targeô foò á relativå jumð (JÒ oò DJNZ© waó outsidå           thå rangå -12¸ tï +127 Result: The target for the jump becomes the instruction itself. 12: ILLEGAL LABEL Cause: The symbol being defined is a reserved operand. Result: The symbol is ignored. 13: LABEL NOT MARKED Causeº Thå symboì being defined haó beeî defineä morå thaî once. Resultº Thå firsô assigneä valuå ió used. Hint: Uså  thå MARË directivå tï definå symboló yoõ  wisè  tï           uså morå thaî once® 14: UNPROCESSED CHARACTERS Cause: Afteò  thå statemenô waó assembleä thå enä oæ thå  linå           haä noô beeî reached. Result: The assembled instruction may/may not be appropriate. 15: UNDEFINED LABEL Cause: Aî  expressioî  containó  á symboì thaô  haó  noô  beeî           defined. Result: The symbol defaults to a value of zero. 16: MULTIPLY DEFINED Cause: Aî  expressioî containó á symboì thaô waó defineä  morå           thaî once. Result: The original symbol's value is used. 17: BAD NUMBER Cause: Á  numbeò  (iteí beginninç witè ° thrõ 9©  containeä  á           characteò noô appropriatå foò thå assigneä base. Result: The number defaults to a value of zero. Š22: NO ASSOCIATED `IF' STATEMENT Cause:    Aî  ENDIÆ statemenô waó processeä withouô firsô  havinç           processeä aî `IF§ statement. Result: The statement was ignored. 23º STATEMENÔ TRUNCATED Cause: Á sourcå statemenô waó longeò thaî 21° characters. Result: Thå  remaindeò  oæ thå linå waó  discarded®  Maù  alsï           causå  additionaì  erroró iæ thå discardeä portioî  waó           noô á comment. 24: INVERTED ORIGIN Causeº Aî ORÇ statemenô has aî expressioî lesó thaî 100H Result: Á .COÍ filå wilì bå abandoned¬ buô assemblù continues. 25: LABEL ADDRESS CHANGES Cause: Thå Labeì addresó waó differenô oî thå seconä pasó froí           whaô iô waó oî thå firsô pass. Result: Very dubious code! Hint: Looë foò á previouó statemenô thaô adjustó thå assemblù           addresó  usinç á forwarä reference®  Iî thå  followinç           example¬ LENGTÈ woulä noô yeô bå known¬ sï '² « LENGTH'           ió 2® However¬ oî thå seconä pass¬ LENGTÈ ió knowî anä           '² « LENGTH' becomeó 18® LABEÌ haó thereforå changed. DEFS 2 + LENGTH LABEL DEFB 'ABCDEFGHIJKLMNOP' LENGTH EQU $ - LABEL 26: FIELD OVERFLOW Cause: Thå  evaluateä expressioî exceedeä thå sizå limitó  foò           thå opcode® (Example® IÍ î wherå 'n' ió noô 0¬ ± oò 2). Result: Á `mask§ ió useä tï geô thå maximuí legaì valuå foò thå           instruction. 27: BYTE VALUE OVERFLOW Cause: Alì  expressionó  arå  reduceä tï  aî  unsigneä  16-biô           integer®  Thå  leasô  significanô  bytå  ió  useä  foò           instructionó  requirinç aî 8-biô  value¬  however¬  thå           originaì valuå waó neitheò ° tï 25µ noò -12¸ tï +12· Result: The least significant byte was used, 'as is'. Š------------------------------------------------------------ R U N T I M E R E Q U I R E M E N T S PROGRAM MEMORY MAP 100h ______________________________________________________ BDOS | | | | < ? > | | fixed | src stk | program | get wrk obj symbol | Pass1 => | 227 200 | | >>--> 31 xxx <---<< | Pass2 => | 227 200 | | ????? 31 128 ?????? | Á   substantiaì  portioî  oæ  thå  prograí   (initializatioî section©  ió reclaimeä anä useä foò runtimå  datá  storage®  Alì memorù  beyonä ZM'ó originaì size¬  ió useä tï storå  definitionó anä outpuô filå buffer. 22·  bytå  areá allocateä foò sourcå statemenô  anä  listinç format®  Thió  buffeò  ió fixeä anä nï statemenô maù exceeä  itó boundarù (21° characteò length). 20°  bytå (10° level© stack®  Eacè INCÌ consumeó 2°  bytes® Eacè evaluatioî recursioî (brackets© consumeó ¶ bytes® Thå stacë ió  noô  rigidlù fixeä anä ió alloweä tï wandeò intï  thå  unuseä portioî  oæ thå sourcå statemenô buffer¬  buô ió NOÔ  alloweä  tï overwritå á statement®  Shoulä prograí executioî causå thå stacë tï overwritå á statement¬ *ª STACË OVERFLO× *ª occuró anä prograí executioî ceases® STACË SPACÅ reporteä aô thå enä oæ assemblù ió thå  minimuí  distancå  reacheä  aô anytimå  betweeî  anù  sourcå statemenô  anä  thå  stack®   Iî  otheò  words¬  á  stacë  crasè barometer! GEÔ  responseó  begiî aô thå enä oæ thå prograí  anä  expanä towarä higè memorù anä arå storeä aó entered¬  witè á bytå  counô precedinç eacè entry. Symboló  arå  storeä jusô belo÷ BDOÓ anä expandó towarä  lo÷ memory®  Eacè  symboì  requireó threå byteó iî additioî  tï  thå actuaì symboì length® Macrï definitionó havå thå samå threå bytå pluó  symboì lengtè requirement®  Eacè GEÔ responså requireó  aî additionaì fouò bytå bitå oæ thió table. Á 3± bytå worë spacå continuallù relocateó aô thå enä oæ thå GEÔ  storagå areá durinç pass1®  Durinç pass2¬  alì  tableó  arå fixeä anä thió worë spacå becomeó stationary. Alì  remaininç spacå betweeî thå 2± bytå worë spacå anä  thå symboì  tablå  ió useä tï buffeò thå objecô  filå  output®  Morå spacå meanó lesó disë access¬  providinç fasteò assembly®  Iæ aô anù  timå thió spacå shoulä becomå lesó thaî 12¸ byteó (onå  filå sector©  *ª TABLÅ OVERFLO× *ª occuró anä assemblù  ceases®  FREÅ MEMORÙ  displayeä aô thå enä oæ assemblù ió thå amounô oæ  memorù availablå tï expanä thå objecô filå buffer®  Wheî lesó thaî 128¬ thå objecô filå bufferinç ió limiteä tï onå sector® Assemblù maù bå slow¬ buô stilì running® Lesó thaî zero¬ anä it'ó dead. Š____________________________________________________________ R E S E R V E D S Y M B O L S ________________________Z80 Opcodes_________________________ EXX LDI LDIR LDD LDDR CPI CPIR CPD CPDR DAA CPL NEG CCF SCF NOP HALT DI EI IM RLCA RLA RRCA RRA RETI RETN INI INIR IND INDR OUTI OTIR OUTD OTDR LD RLC RL RRC RR SLA SRA SRL RLD RRD PUSH POP EX ADD ADC SBC SUB AND OR XOR CP INC DEC BIT SET RES JP CALL JR DJNZ RET RST IN OUT __________________Assembler Directives______________________ DS DEFS DB DEFB DW DEFW DM DEFM ORG RUN END INCL MARK EQU DATA LIST IF ELSE ENDIF MSG GET _________________________Operands________________________ Z NZ C NC PO PE P M A B C D E H L BC DE HL IX IY SP AF I R $ \ ? _______________Predefined User Symbols_______________________ DATA IX IY _____________________Operators___________________________________ + - * & # < > ! ? @ = [ ] ^ Š_________________________________________________________________ _______________________ Z8° SYNTAØ SUMMARY ______________________ _ _ _ _ _ _ _ _ _ _ D A T A T R A N S F E R _ _ _ _ _ _ _ _ _ ¸ Biô Transferó 1¶ biô transferó Blocë Transfers LD r,r' LD ss,nnnn LDI LD r,nn LD ss,(nnnn) LDIR LD (nnnn),ss LD r,(m) LDD LD (m),r LD SP,HL LDDR LD (m),nn LD SP,IX LD SP,IY LD A,(BC) LD A,(DE) PUSH qq LD A,(nnnn) POP qq LD (nnnn),A LD (DE),A EX DE,HL LD (BC),A EX (SP),HL EX (SP),IX LD A,I EX (SP),IY LD I,A EX AF,AF' LD A,R EXX LD R,A ß ß ß ß ß ß ß ß ß ß ß ß Á Ò É Ô È Í E Ô É Ã ß ß ß ß ß ß ß ß ß ß ß 8 Bit Arithmetic 16 Bit Arithmetic Misc ADÄ r ADD A,r ADD HL,ss DAA ADÄ (m) ADD A,(m) ADD IX,xx CPL ADD nn ADD A,nn ADD IY,yy NEG SCF ADC r ADC A,r ADC HL,ss CCF ADC (m) ADC A,(m) ADC nn ADC A,nn SUB r SUB A,r SUB (m) SUB A,(m) SUB nn SUB A,nn SBC r SBC A,r SBC HL,ss SBC (m) SBC A,(m) SBC nn SBC A,nn INC r INC pp INC (m) DEC r DEC pp DEC (m) r = A, B, C, D, E, H, L nn = any expression (reduced to 8 bits) nnnn = any expression (reduced to 16 bits) (m) = (HL), (IX+d) or (IY+d) d = 8-bit displacement -128 to +127 ss = BC, DE, HL, IX, IY or SP qq = AF, BC, DE, HL, IX or IY xx = BC, DE, SP, IX yy = BC, DE, SP, IY Š_________________________________________________________________ _ ß ß ß ß ß ß ß ß ß ß ß Ì Ï Ç É Ã ß ß ß ß ß ß ß ß ß ß ß ß ß ß ß ß 8-Bit Logic Block Operations ANÄ ò AND A,r CPI AND (m) AND A,(m) CPIR AND nn AND nn OR r OR A,r CPD OR (m) OR A,(m) CPDR OR nn OR A,nn XOR r XOR A,r XOR (m) XOR A,(m) XOR nn XOR A,nn CP r CP A,r CP (m) CP A,(m) CP nn CP A,nn _ ß ß _ _ _ _ SHIFT, ROTATE and BIT INSTRUCTIONS _ _ _ _ _ _ _ _ RLCA RLC r RLC (m) BIT n,r RLA RL r RL (m) BIT n,(m) RRCA RRC r RRC (m) RRA RR r RR (m) SET n,r SLA r SLA (m) SET n,(m) SRA r SRA (m) RLD SRL r SRL (m) RES n,r RRD RES n,(m) _ _ _ _ _ _ _ _ I/O I N S T R U C T I O N S _ _ _ _ _ _ _ _ IN A,(nn) IN r,(C) OUT (nn),A OUT (C),r INI IND OUTI OUTD INIR INDR OUTR OTDR _ _ _ _ _ _ _ _ _ G E N E R A L P U R P O S E _ _ _ _ _ _ _ _ DAA CCF NOP DI CPL SCF HALT EI NEG IM 0 IM 1 IM 2 _ _ _ _ _ _ _ _ _ _ _ _ C O N T R O L _ _ _ _ _ _ _ _ _ _ _ _ _ _ JR e JP nnnn JP (HL) CALL nnnn JR c,e JP cc,nnnn JP (IX) CALL cc,nnnn DJNZ e JP (IY) r = A, B, C, D, E, H, L nn = any expression (reduced to 8 bits) nnnn = any expression (reduced to 16 bits) (m) = (HL), (IX+d) or (IY+d) d = 8-bit displacement within -128 to +127 c = NC, C, NZ, Z (condition operand) å ½ Anù expressioî withiî -12¸ tï +12· oæ instruction cc = NC, C, NZ, Z, M, P, PO, PE (condition operand) Š A L T E R A T I O N S ZÍ  doeó  noô requirå anù speciaì installatioî tï ruî  oî  á CP/Í system®  Iô may¬  however¬ bå modifieä tï takå advantagå oæ speciaì  systeí features®  Thå methoä ió tï creatå thå necessarù sourcå file¬  theî uså DDÔ tï overlaù ZÍ witè thå assembleä  .HEØ file®  Thió  maù seeí á littlå toï mucè tï instalì aî assembler¬ buô thå rewardó arå thaô ZÍ wilì noô onlù setuð anä restorå  youò printer¬  buô  automaticallù searcè foò fileó oî á drivå oæ  youò choice¬ anä datå prograí listings. Usinç thå followinç sourcå filå aó á guide¬  creatå á sourcå filå  containinç thå assemblù instructionó necessarù tï alteò  ZÍ tï  meeô youò printeò requirements®  Theî uså ZÍ tï assemblå thå filå intï aî Inteì heø format®  DDÔ ió theî useä tï overlaù  ZM® Thå  followinç  dialoç  assumeó  thaô thå  sourcå  filå  namå  ió B:ZM/SETUP.Z8° anä thaô á copù oæ ZÍ anä DDÔ residå oî drivå A:. A>B:                 B>A:ZM3M ZM/SETUP.Z80 H                 ZM v 1.3m - Z80 Assembler                NEXT ADDRESS xxxx                 NEXT DATA xxxx                 FREE MEMORY xxxx                 STACK SPACE xxxx                 ERROR COUNT None/None                B>A:DDT A:ZM3M.COM                 DDT VERS 2.2                 NEXT PC                  1D80 0100                 -IZM/SETUP.HEX                 -R                 NEXT PC                   1D80 0000                 -G0                B>SAVE 29 B:ZM.COM                 B>                 et viola, ZM has been configured for your printer. Š Thå  INCÌ  directivå ió programmeä tï searcè  thå  specifieä drivå (iæ given)¬ thå defaulô drive¬ aî internallù defineä drive¬ anä  finallù drivå A:®  Thió fouò steð searcè ió repeateä  untiì thå  filå  ió  founä  oò á ^à ió  entered®  Thå  internaì  drivå definitioî  maù  bå redefineä bù adjustinç thå  valuå  aô  061Ch® Usinç thå CP/Í conventioî thaô 0=default¬  1=A¬  2=B¬  etc.¬  anù valiä CP/Í drivå maù bå specified. ZÍ  containó  twï setó oæ variableó (L1=061Fè anä  L2=0631h© concerneä  witè  printeò setuð anä listinç format¬  anä  á  thirä (L3=0643h©  ió  useä  tï  restorå  thå  printeò  tï  itó   normaì configuration®  Thå  numbeò  oæ lineó peò pagå ió giveî  aó  thå firsô  bytå aô L± anä L2®  Thå seconä bytå oæ L± anä L² anä  thå firsô bytå oæ L³ ió thå numbeò oæ characteró iî thå printeò setuð strinç thaô follows®  Notå thaô thå 'DM§ directivå automaticallù placeó thå lengtè aó thå firsô character¬ followeä bù thå defineä string. Iî  addition¬  therå  arå  twï  3² characteò  lineó  iî  thå 'ILLEGAÌ OPTION§ message¬ OPT± anä OPT2¬ whicè shoulä reflecô thå respectivå performancå oæ L± anä L2. Thå  finaì  modificatioî foò printeò setuð ió tï  inforí  ZÍ whicè oæ thå twï setuð stringó tï uså aó á default® Thió ió donå bù havinç SETUÐ (061Dh© poinô tï thå desireä defaulô string. Durinç  initialization¬  ZÍ loadó thå 'DE§ registeò paiò  tï poinô  tï  thå datå fielä iî thå headeò  anä  calló  1D21h®  Thå calleä  routinå  ió expecteä tï filì thå fielä pointeä tï bù  thå 'DE§ registeò paiò witè thå currenô date¬ iî thå forí 'YY/MM/DD'® Thå routinå maù alteò alì registeró anä extenä tï thå BDOS® Oncå thå datå haó beeî obtained¬  thå spacå occupieä bù thå routinå ió reclaimeä foò runtimå storage® Iæ youò systeí cannoô providå thå currenô date¬  oò yoõ dï noô wisè tï havå dateä listings¬ placå á simplå REÔ instructioî aô 1D21h. The parameters thus far discussed are: OPT1 025Dh 32 character message about L1           OPT2 0281h 32 character message about L2           DRIVE 061Ch 1 character drive definition           SETUP 061Dh 2 byte default pointer (L1 or L2)           L1 061Fh Option 1 listing and printer setup           L2 0631h Option 2 listing and printer setup           L3 0643h String to restore printer to normal           ZMDATE 1D21h System date routine Š Thå  followinç listinç provideó aî examplå foò  creatinç  aî overlaù  tï configurå ZÍ foò youò particulaò  requirements®  Thå expressioî 'L1+1¸ ¡  ¤ £ [L1+18]§ ió useä witè aî IÆ directivå tï providå  á  warninç iî thå evenô thå predefineä sizå  constraintó arå exceeded® Thå expressioî evaluator¬ workinç iî á stricô lefô tï  righô sequence¬  computeó thå suí oæ L± pluó  18®  Dependinç upoî whicè ió largest¬ thå operatoò '!§ retainó thió valuå oò thå currenô  assemblù  addresó  '$'®  Beforå thå  '#§  operatoò  caî perforí itó operation¬  thå bracketó 'Û ]§ interrupô thå lefô  tï righô  procesó forcinç thå evaluatoò tï agaiî computå thå suí  oæ L±  anä  18®  Thå resulô ió theî treateä aó thå nexô  iteí  upoî whicè  '#§  wilì  perforí itó bitwiså exclusivå  OR®  Thå  finaì resulô  foò  thå expressioî ió zero¬  onlù iæ  thå  largesô  iteí retaineä bù thå '!§ operatoò ió thå samå aó thå suí oæ L± anä 18.      ;ZM Custom Setup for MX-100 printer       OPT1 equ 025Dh ;Option 1 message   OPT2 equ 0281h ;Option 2 Message   MISC equ 061Ch ;Drive & Print parameters ZM_DATE equ 1D21h ;ZM date routine           ORG OPT1   ; !12345678901234567890123456789012! <--32 byte ruler    DB '1 = 80 Lines (16.5 cpi at 8 lpi)'   ORG OPT2    ; !12345678901234567890123456789012! <--32 byte ruler    DB '2 = 57 Lines (10 cpi at 6 lpi) '   ORG MISC   db 2 ;Define drive B: for search path   dw L1 ;Define L1 as default printer setup       L1  db 80 ;80 lines per page   dm ^[, 'F', ^O, ^[, 0 ;Emphasized OFF, condensed ON, 8 lpi    If L1+18 ! $ # [L1+18] ;18 bytes max MSG 7,'String L1 is too long', ^m, ^j    endif    ds 18 - [$-L1] ;Adjustment for unused space        L2  db 57 ;57 lines per page    dm ^[, ^F, ^R, ^[, 2 ;Emphasized OFF, condensed OFF, 6 lpi    If L2+18 ! $ # [L2+18] ;18 bytes max MSG 7,'String L2 is too long', ^m, ^j    endif    ds 18 -[$-L2] ;Adjustment for unused space       L3  dm ^R, ^[, 'N', 6 ;Condensed OFF, Skip 6 at perf   If L3+18 ! $ # [L3+18] ;18 bytes max, ^m, ^j MSG 'String L3 is too long'        endif Š    ORG ZM_DATE    ;Osborne-1 date routine for ZM    ;    ;E: DE >> Date field in header    ;X: Date field filled in form `yy/mm/dd'    ;A: AF, BC, DE and HL    ;    SYSDATÅ eqõ 0EF63h ;Osborne-± datå iî `dd/mm/yy'    LD HL,SYSDATE +3 ;point to year    LD A,(HL)    OR A    RET Z ;Date not entered CALL B2DEC1 ;Convert year CALL B2DEC ;Convert month ;Convert day        B2DEC INC DE ;Next field DEC HL ; and next item LD A,(HL)        B2DEC1 LD B,'0' -1 ;Start short for 1st Inc Mark Loop    INC B    SUB 10 JR NC,Loop ;Count ten's digit ADD 10 +'0' ;Restore bad count, & make ascii EX DE,HL ;Point to field w/ HL LD (HL),B ; and store ten's digit INC HL ;Step to next spot LD (HL),A ; and store unit's digit EX DE,HL ;Restore Original HL,DE RET END ;ZM CUSTOM SETUP Š I N D E X !.............................................. 6 #.............................................. 5 $.............................................. 4 &.............................................. 5 ( )............................................ 5 *.............................................. 5 +.............................................. 5 -.............................................. 5 <.............................................. 6 =.............................................. 6 >.............................................. 6 ?.............................................. 6 @.............................................. 6 ABORT.......................................... 1 ADDRESSING..................................... 7 ALTERATION..................................... 20 BINARY CONSTANTS............................... 4 BIT-7.......................................... 3 CHARACTER CONSTANTS............................ 5 COLON.......................................... 3 CONTROL CHARACTERS............................. 2, 3, 6 DATA........................................... 3, 11 DB............................................. 7 DECIMAL CONSTANTS.............................. 5 DECIMAL POINTS................................. 3 DEFB........................................... 7 DEFM........................................... 7 DEFS........................................... 7 DEFW........................................... 7 DIRECTIVES..................................... 3¬ 7¬ 17 DM............................................. 7 DS............................................. 7 DW............................................. 7 ELSE........................................... 9 END............................................ 8 ENDIF.......................................... 9 EQU............................................ 7 ERROR COUNT.................................... 2 ERRORS......................................... 12 EXPRESSIONS.................................... 5 FATAL ERRORS................................... 12, 13 FREE MEMORY.................................... 2, 16 GET............................................ 10, 16 HEADING........................................ 2 HEXADECIMAL CONSTANTS.......................... 5 IF............................................. 6, 9 ILLEGAL OPTION................................. 1, 21 INCL........................................... 2¬ 8¬ 21 IX............................................. 11 IY............................................. 11 LABELS......................................... 3 LINE FEED...................................... 3 LIST........................................... 2, 8 LISTING........................................ 2 MARK........................................... 3, 6, 9 MSG............................................ 9 Š NEXT ADDRESS................................... 2 NEXT DATA...................................... 2 NUMERIC CONSTANTS.............................. 4 OCTAL CONTSTANTS............................... 4 OPCODES........................................ 3¬ 4¬ 17 OPERANDS....................................... 3, 4, 17 OPERATORS...................................... 5, 17 OPTIONS........................................ 1, 21 ORG............................................ 8 PREDEFINED USER SYMBOLS........................ 11, 17 PROGRAM MEMORY MAP............................. 16 RESERVED SYMBOLS............................... 17 RUNTIME REQUIREMENTS........................... 16 RUN............................................ 8 SPACES......................................... 3 STACK SPACE.................................... 2, 16 STRING CONSTANTS............................... 5 SYMBOLS........................................ 3, 16 SYNTAX......................................... 3¬ 5¬ 18 TABS........................................... 3 TERMINAL ERRORS................................ 12 UNDERSCORE..................................... 3 WARNING MESSAGES............................... 12, 14 WORDSTAR DOT COMMANDS.......................... 3 Z80 OPCODES.................................... 17 Z80 SYNTAX SUMMARY............................. 18 [ ]............................................ 5 \.............................................. 4 ^.............................................. 6