home *** CD-ROM | disk | FTP | other *** search
/ CP/M / CPM_CDROM.iso / simtel / sigm / vols200 / vol240 / asm65.doc < prev    next >
Encoding:
Text File  |  1986-02-10  |  22.4 KB  |  533 lines

  1. Creating ASM65.COM
  2. ------------------
  3. Thσ ASM6╡ assemble≥ ha≤ beeε buil⌠ a≤ aε overla∙ t∩ Digita∞ ì
  4. Research'≤ AS═ assemble≥ fo≥ 808░ serie≤ processors« T∩ protec⌠ ì
  5. you≥ CP/═ licencσ froφ Digita∞ Research¼ ASM6╡ i≤ supplieΣ onl∙ ì
  6. iε .HE╪ form¼ anΣ mus⌠ bσ mergeΣ witΦ aε existinτ cop∙ oµ ASM.CO═ ì
  7. usinτ DD╘ o≥ ß simila≥ 8080/Z8░ debugger« Usinτ DDT¼ thσ ì
  8. conversatioε t∩ creatσ ASM65.CO═ i≤ a≤ follows:
  9.  
  10.      A>ddt asm.com
  11.      DDT VERS 2.2
  12.      NEXT  PC
  13.      2100 0100
  14.      -iasm65.hex
  15.      -r
  16.      NEXT  PC
  17.      2300 0100
  18.      -^C
  19.      A>save 34 asm65.com
  20.  
  21.  
  22.  
  23.  
  24. èBackground
  25. ----------
  26. ASM6╡ i≤ ß 650▓ cross-assemble≥ fo≥ CP/═ system≤ -- iε othe≥ ì
  27. word≤ i⌠ use≤ 650▓ assembl∙ languagσ t∩ creatσ program≤ fo≥ 6502-ì
  28. baseΣ systems¼ bu⌠ thσ assemble≥ itselµ run≤ oε CP/═ systems¼ ì
  29. allowinτ thσ usσ oµ better-qualit∙ editor≤ sucΦ a≤ WordSta≥ anΣ ì
  30. Spellbinde≥ t∩ creatσ prograφ source« I⌠ i≤ ß ful∞ conditiona∞ ì
  31. bu⌠ non-macr∩ assemble≥ supportinτ al∞ 650▓ opcode≤ anΣ ì
  32. addressinτ mode≤ (includinτ thσ extension≤ supporteΣ oε thσ GT┼ ì
  33. 65C0▓ processor⌐ witΦ ß gooΣ rangσ oµ pseudo-operations« I⌠ doe≤ ì
  34. NOT conver⌠ 8080/Z8░ assembl∙ languagσ program≤ t∩ 650▓ ì
  35. equivalents.
  36.  
  37. Wσ assumσ tha⌠ yo⌡ arσ familia≥ witΦ assembl∙ languagσ ì
  38. programminτ -- iµ not¼ wσ woulΣ advisσ readinτ '650▓ Assembl∙ ì
  39. Languagσ Programmingº (Leventhal¼ Osborne/McGraw-Hill⌐ o≥ aε ì
  40. equivalen⌠ iε conjunctioε witΦ thesσ notes« Wσ als∩ assumσ tha⌠ ì
  41. yo⌡ havσ ß cop∙ oµ thσ Digita∞ ResearcΦ AS═ manua∞ t∩ hand¼ a≤ wσ ì
  42. wil∞ refe≥ t∩ i⌠ fo≥ description≤ oµ pseudo-ops¼ erro≥ message≤ ì
  43. anΣ thσ like.
  44.  
  45. Iε general¼ thσ assembl∙ languagσ useΣ iε ASM6╡ follow≤ standarΣ ì
  46. MO╙ Technolog∙ syntax¼ bu⌠ therσ arσ somσ deviation≤ froφ thσ ì
  47. standarΣ (enforceΣ b∙ usinτ a≤ corσ aε assemble≥ designeΣ fo≥ thσ ì
  48. 8080/Z8░ processo≥ family⌐ whicΦ ma∙ affec⌠ portabilit∙ oµ ì
  49. program≤ t∩ standarΣ 650▓ assemblers« Thσ maiε difference≤ arσ iε ì
  50. thσ specificatioε oµ numeriπ value≤ (in suffixe≤ rathe≥ thaε ì
  51. prefixe≤ arσ useΣ t∩ distinguisΦ numbe≥ bases)╗ iε pseudo-o≡ ì
  52. names¼ whicΦ arσ standarΣ AS═ syntax; anΣ iε thσ descriptioε oµ ì
  53. indirec⌠ addressinτ modes« Bracket≤ arσ useΣ t∩ enclosσ ì
  54. arithmetiπ expression≤ iε AS═ syntax¼ witΦ thσ resul⌠ tha⌠ ì
  55. indirec⌠ addressinτ mode≤ canno⌠ bσ specifieΣ b∙ enclosinτ thσ ì
  56. operanΣ iε bracket≤ a≤ pe≥ MO╙ Technolog∙ synta° -- onσ non-ì
  57. standarΣ opcodσ (JMPI⌐ anΣ slightl∙ differen⌠ registe≥ mnemonic≤ ì
  58. (IX¼ I┘ anΣ I⌐ arσ useΣ instead.
  59.  
  60. Preparing source files
  61. ----------------------
  62. Prograφ creatioε witΦ ASM6╡ i≤ ß three-stagσ process: editinτ thσ ì
  63. sourcσ filσ witΦ ß suitablσ edito≥ o≥ word-processor╗ usinτ ASM6╡ ì
  64. t∩ creatσ ß he° file╗ anΣ creatinτ ß binar∙ filσ froφ thσ he° ì
  65. filσ witΦ LOA─ o≥ CODE¼ o≥ sendinτ i⌠ direc⌠ t∩ thσ externa∞ ì
  66. 6502-baseΣ system« Thi≤ par⌠ oµ thσ note≤ i≤ concerneΣ onl∙ witΦ ì
  67. the first stage, that of source-file creation.
  68.  
  69. Program≤ caε bσ createΣ usinτ an∙ suitablσ CP/═ edito≥ o≥ word-ì
  70. processo≥ (wσ mainl∙ usσ WordStar¼ whicΦ allow≤ u≤ sourcσ file≤ ì
  71. oµ an∙ length)« Filename≤ MUST usσ thσ extensioε .A6╡ (e.g« ì
  72. PROGRAM.A65)¼ otherwisσ ASM6╡ wil∞ no⌠ finΣ thσ filσ -- thσ erro≥ ì
  73. message 'No source file present' will be printed in this case.
  74.  
  75. As usual, assembly language statements take the form of:
  76.  
  77.      <label:> opcode <operand> <;comment>
  78.  
  79. -- eacΦ linσ ends¼ oµ course¼ witΦ carriage-returε o≥ thσ CR/L╞ ì
  80. combination.
  81. è
  82. Linσ number≤ shoulΣ no⌠ bσ useΣ (thougΦ seσ thσ AS═ manua∞ fo≥ ì
  83. more detail if you REALLY want to use line numbers).
  84.  
  85. Labels
  86. ------
  87. Label≤ ma∙ bσ oµ an∙ length¼ althougΦ onl∙ 1╢ character≤ arσ ì
  88. significant« The∙ ma∙ bσ writteε a≤ eithe≥ uppe≥ o≥ lowe≥ casσ ì
  89. letter≤ (lower-casσ letter≤ arσ converteΣ t∩ cap≤ automaticall∙ ì
  90. durinτ assembly⌐ anΣ numeral≤ (althougΦ thσ firs⌠ characte≥ oµ ß ì
  91. labe∞ mus⌠ bσ ß letter« Thσ ':º i≤ optional« Wherσ ß labe∞ refer≤ ì
  92. t∩ aε assignmen⌠ (EQ╒ o≥ SET⌐ i⌠ mus⌠ bσ oε thσ samσ line╗ ì
  93. otherwise¼ wherσ i⌠ refer≤ t∩ codσ (opcode≤ o≥ code-creatinτ ì
  94. pseudo-op≤ sucΦ a≤ DB⌐ i⌠ doe≤ no⌠ neeΣ t∩ bσ oε thσ samσ line¼ ì
  95. s∩ tha⌠ multiplσ label≤ ma∙ refe≥ t∩ thσ samσ codσ location« Seσ ì
  96. the ASM manual for more detail.
  97.  
  98. Multiple expressions
  99. --------------------
  100. Opcode≤ anΣ operand≤ arσ describeΣ iε detai∞ below¼ anΣ wil∞ no⌠ ì
  101. bσ discusseΣ here« Note¼ however¼ tha⌠ severa∞ opcode/operanΣ ì
  102. expression≤ ma∙ bσ placeΣ oε thσ samσ line if separated by '!':
  103.  
  104.      PHA ! TXA ! PHA ! TYA ! PHA   ;save registers
  105.  
  106. -- onσ side-effec⌠ i≤ tha⌠ '!º ma∙ no⌠ bσ useΣ iε comments¼ ì
  107. otherwisσ ASM6╡ interpret≤ thσ followinτ tex⌠ a≤ sourcσ ì
  108. statements, with unpredictable results.
  109.  
  110. Comments
  111. --------
  112. ┴ commen⌠ i≤ precedeΣ b∙ ';'¼ anΣ run≤ t∩ thσ enΣ oµ thσ linσ ì
  113. (witΦ thσ exceptioε oµ '!º a≤ describeΣ above)« Therσ i≤ n∩ ì
  114. provisioε fo≥ multiple-linσ comment≤ -- eacΦ linσ oµ commen⌠ mus⌠ ì
  115. bσ precedeΣ b∙ ';º -- althougΦ comment≤ ma∙ star⌠ a⌠ an∙ positioε ì
  116. in the line.
  117.  
  118. EacΦ par⌠ oµ thσ statemen⌠ mus⌠ bσ separateΣ b∙ a⌠ leas⌠ onσ ì
  119. spacσ o≥ tab« Apar⌠ froφ this¼ space≤ anΣ tab≤ arσ no⌠ ì
  120. significant¼ anΣ ma∙ bσ useΣ iε an∙ wa∙ t∩ increasσ thσ ì
  121. readability of the file.
  122.  
  123. Opcodes
  124. -------
  125. ASM6╡ support≤ al∞ standarΣ MO╙ Technolog∙ anΣ GT┼ (65C02⌐ opcodσ ì
  126. mnemonics¼ witΦ onσ exception║ JMP╔ i≤ useΣ iε placσ oµ JM╨ (..⌐ ì
  127. fo≥ jump-indirect« WitΦ tha⌠ exception¼ al∞ opcodσ mnemonic≤ arσ ì
  128. three-letter╗ thσ four-lette≥ mnemonic≤ ASLA¼ ROLA¼ LSRA¼ ROR┴ ì
  129. (anΣ INCA¼ DEC┴ -- 65C0▓ only⌐ ma∙ als∩ bσ useΣ t∩ describeΣ ì
  130. accumulator operations.
  131.  
  132. Thσ opcodσ lis⌠ belo≈ show≤ al∞ oµ thσ opcode≤ availablσ witΦ ì
  133. ASM65¼ includinτ 65C0▓ extensions« Thσ addressinτ mode≤ availablσ ì
  134. fo≥ eacΦ instructioε arσ showε iε brackets¼ witΦ mode≤ availablσ ì
  135. onl∙ oε thσ 65C0▓ indicateΣ b∙ aε asterisk« Thσ mode≤ arσ ì
  136. repesented by:
  137.      (none)    implicit operation
  138.      A         accumulator only
  139.      #         immediate (8-bit value)
  140. è     Z         zero page (8-bit address)
  141.      Abs       absolute (16-bit address)
  142.      Rel       relative (8-bit signed branch)
  143.      Z,X       zero page + X register
  144.      Z,Y       zero-page + Y register
  145.      Abs,X     absolute + X register
  146.      Abs,Y     absolute + Y register
  147.      IX        indirect from (zpage + X register)
  148.      IY        indirect from zpage, + Y register
  149.      I         indirec⌠ froφ zpagσ (samσ a≤ I┘ witΦ Y=0⌐ (65C0▓ ì
  150. áááááááááááááááonly)
  151.  
  152. Implicit operations
  153. -------------------
  154.      PHA, PLA       push/pull accumulator
  155.      PHP, PLP       push/pull processor status flags
  156.      PHX, PLX       push/pull X register (65C02 only)
  157.      PHY, PLY       push/pull Y register (65C02 only)
  158.      TSX            move stack pointer to X register
  159.      TXS            set stack pointer from X register
  160.      TAX, TAY       load X, Y register from A
  161.      TXA, TYA       load A from X, Y register
  162.      SEC, SED, SEI  set carry, decimal, interrupt flags
  163.      CLC, CLD       clear carry, decimal flags
  164.      CLI, CLV       clear interrupt, overflow flags
  165.      RTS, RTI       return from subroutine, interrupt
  166.      BRK            break (software interrupt)
  167.      NOP            no-operation
  168.  
  169. Call, Jump and Branch
  170. ---------------------
  171.      JSR            call subroutine (Abs)
  172.      JMP            jump to new location (Abs)
  173.      JMPI           jum≡ indirec⌠ viß specifieΣ locatioε (Abs╗ ì
  174. ááááááááááááááááááááAbs,X*)
  175.      BPL, BMI       branch if sign clear/set (Rel)
  176.      BNE, BEQ       branch if zero flag clear/set (Rel)
  177.      BCC, BCS       branch if carry clear/set (Rel)
  178.      BVC, BVS       branch if overflow flag clear/set (Rel)
  179.      BRA            unconditional branch (Rel*)
  180.  
  181. Test/Set/Reset memory
  182. ---------------------
  183.      BIT            test memory bits (Z; Abs; Z,X*; Abs,X*; #*)
  184.      TRB            tes⌠ anΣ rese⌠ memor∙ agains⌠ accumulato≥ ì
  185. áááááááááááááááááááá(Z*╗ Abs*)
  186.      TSB            tes⌠ anΣ se⌠ memor∙ agains⌠ accumulato≥ (Z*╗ ì
  187. ááááááááááááááááááááAbs*)
  188.  
  189. Rotate and Shift
  190. ----------------
  191.      ASL            shift left (Z; Abs; Z,X; Abs,X; A)
  192.      ASLA           shift A left (same as ASL A)
  193.      LSR            shift right (Z; Abs; Z,X; Abs,X; A)
  194.      LSRA           shift A left (same as LSR A)
  195.      ROL            rotatσ lef⌠ -- 9-bi⌠ rotatσ througΦ carr∙ (Z╗ ì
  196. ááááááááááááááááááááAbs╗ Z,X╗ Abs,X╗ A)
  197.      ROLA           rotate A left (same as ROL A)
  198.      ROR            rotatσ righ⌠ -- 9-bi⌠ rotatσ througΦ carr∙ ìèáááááááááááááááááááá(Z╗ Abs╗ Z,X╗ Abs,X╗ A)
  199.      RORA           rotate A right (same as ROR A)
  200.  
  201. Decrement and Increment
  202. -----------------------
  203.      DEC            decrement (Z; Abs; Z,X; Abs,X; A*)
  204.      DECA           decrement A (same as DEC A*)
  205.      INC            increment (Z; Abs; Z,X; Abs,X; A*)
  206.      INCA           increment A (same as INC A*)
  207.      DEX, INX       decrement/increment X
  208.      DEY, INY       decrement/increment Y
  209.  
  210. Accumulator operations
  211. ----------------------
  212.      ORA            inclusivσ O╥ witΦ accumulato≥ (#╗ Z╗ Abs╗ ì
  213. ááááááááááááááááááááZ,X╗ Abs,X╗ Abs,Y╗ IX╗ IY╗ I*)
  214.      AND            binar∙ AN─ witΦ accumulato≥ (#╗ Z╗ Abs╗ Z,X╗ ì
  215. ááááááááááááááááááááAbs,X╗ Abs,Y╗ IX╗ IY╗ I*)
  216.      EOR            exclusivσ O╥ witΦ accumulato≥ (#╗ Z╗ Abs╗ ì
  217. ááááááááááááááááááááZ,X╗ Abs,X╗ Abs,Y╗ IX╗ IY╗ I*)
  218.      ADC            adΣ witΦ carr∙ t∩ accumulato≥ (#╗ Z╗ Abs╗ ì
  219. ááááááááááááááááááááZ,X╗ Abs,X╗ Abs,Y╗ IX╗ IY╗ I*)
  220.      SBC            subtrac⌠ witΦ borro≈ froφ accumulato≥ (#╗ Z╗ ì
  221. ááááááááááááááááááááAbs╗ Z,X╗ Abs,X╗ Abs,Y╗ IX╗ IY╗ I*)
  222.  
  223. Load and Store
  224. --------------
  225.      LDA            loaΣ ┴ registe≥ (#╗ Z╗ Abs╗ Z,X╗ Abs,X╗ ì
  226. ááááááááááááááááááááAbs,Y╗ IX╗ IY╗ I*)
  227.      STA            storσ ┴ registe≥ (Z╗ Abs╗ Z,X╗ Abs,X╗ Abs,Y╗ ì
  228. ááááááááááááááááááááIX╗ IY╗ I*)
  229.      LDX            load X register (#; Z; Abs; Z,Y; Abs,Y)
  230.      STX            store X register (Z; Abs; Z,Y)
  231.      LDY            load Y register (#; Z; Abs; Z,X; Abs,X)
  232.      STY            store Y register (Z; Abs; Z,X)
  233.  
  234. Compare registers
  235. -----------------
  236.      CMP            comparσ accumulato≥ (#╗ Z╗ Abs╗ Z,X╗ Abs,X╗ ì
  237. ááááááááááááááááááááAbs,Y╗ IX╗ IY╗ I*)
  238.      CPX            compare X (#; Z; Abs)
  239.      CPY            compare Y (#; Z; Abs)
  240.  
  241. Addressing modes
  242. ----------------
  243. (none)    implicit operation
  244. A         accumulator only
  245. áááááááááááááááUseΣ wherσ accumulato≥ i≤ thσ operand¼ e.g« AS╠ A« ì
  246. áááááááááááááááAl∞ ┴ addressinτ option≤ havσ ß 4-lette≥ matchinτ ì
  247. áááááááááááááááopcode -- i.e. ASLA and ASL A are identical.
  248. #         immediate (8-bit value)
  249. áááááááááááááááNex⌠ bytσ i≤ thσ operand« Example≤ arσ LD┴ #20¼ ì
  250. áááááááááááááááLD╪ #20h¼ CP╪ #'i'« Aε erro≥ i≤ generateΣ iµ thσ ì
  251. áááááááááááááááoperand evaluates to greater than 0FFh.
  252. Z         zero page (8-bit address)
  253. áááááááááááááááNex⌠ bytσ i≤ thσ low-orde≥ addres≤ oµ thσ operand« ì
  254. áááááááááááááááSelecteΣ automaticall∙ iµ thσ operanΣ evaluate≤ t∩ ì
  255. áááááááááááááááles≤ thaε 100h« Example≤ arσ LD┴ 20¼ ST╪ 20h¼ anΣ ì
  256. áááááááááááááááORA <address> where <address> is less than 100h.
  257. áááááááááááááááAl∞ zero-pagσ addresse≤ mus⌠ bσ knowε oε thσ firs⌠ ìèááááááááááááááápass¼ withou⌠ forwarΣ references¼ otherwisσ phasσ ì
  258. áááááááááááááááerror≤ (seσ AS═ manual⌐ ma∙ occu≥ durinτ thσ ì
  259. ááááááááááááááásecond pass of the assembler.
  260. Abs       absolute (16-bit address)
  261. áááááááááááááááNex⌠ bytσ i≤ thσ low-orde≥ addres≤ oµ thσ operand╗ ì
  262. áááááááááááááááfollowinτ bytσ i≤ thσ high-orde≥ address« SelecteΣ ì
  263. áááááááááááááááautomaticall∙ iµ thσ operanΣ evaluate≤ t∩ greate≥ ì
  264. áááááááááááááááthaε 0FFh¼ o≥ iµ zero-pagσ modσ i≤ no⌠ available« ì
  265. áááááááááááááááExample≤ arσ LD┴ 2000¼ ST╪ 200h¼ anΣ OR┴ <address> ì
  266. áááááááááááááááwhere <address> is greater than 0FFh.
  267. Rel       relative (8-bit signed branch)
  268. áááááááááááááááNex⌠ bytσ i≤ thσ offse⌠ t∩ ß labe∞ relativσ t∩ thσ ì
  269. ááááááááááááááástar⌠ oµ thσ NEXT instructioε (i.e« tw∩ byte≤ ì
  270. áááááááááááááááafte≥ thσ locatioε oµ thσ brancΦ test)¼ givinτ aε ì
  271. áááááááááááááááeffectivσ rangσ oµ -12╢ t∩ +12╣ froφ thσ locatioε ì
  272. áááááááááááááááoµ thσ brancΦ instruction« Iµ thσ operanΣ ì
  273. áááááááááááááááevaluate≤ outsidσ thi≤ range¼ aε erro≥ wil∞ bσ ì
  274. ááááááááááááááágenerated« Example≤ arσ BR┴ label¼ BN┼ $-│ ('$º i≤ ì
  275. áááááááááááááááthe reserved name of the position counter).
  276. Z,X       zero page + X register
  277. áááááááááááááááA≤ fo≥ ┌ above¼ excep⌠ thσ content≤ oµ thσ ╪ ì
  278. áááááááááááááááregiste≥ arσ addeΣ t∩ givσ aε offse⌠ withiε thσ ì
  279. ááááááááááááááázero-page« Addresse≤ 'wra≡ roundº WITHIN zero-ì
  280. ááááááááááááááápage. Example: AND address,X
  281. Z,Y       zero-page + Y register
  282. áááááááááááááááA≤ fo≥ Z,╪ above¼ excep⌠ tha⌠ thσ ┘ registe≥ i≤ ì
  283. áááááááááááááááused. Example: STX 20h,Y
  284. Abs,X     absolute + X register
  285. áááááááááááááááA≤ fo≥ Ab≤ above¼ excep⌠ tha⌠ thσ content≤ oµ thσ ì
  286. ááááááááááááááá╪ registe≥ arσ addeΣ t∩ givσ aε offse⌠ froφ thσ ì
  287. áááááááááááááááfollowinτ two-bytσ address« Addresse≤ d∩ no⌠ 'wra≡ ì
  288. ááááááááááááááároundº withiε thσ curren⌠ pagσ -- wherσ thσ suφ oµ ì
  289. áááááááááááááááthσ low-orde≥ addres≤ anΣ thσ ╪ registe≥ content≤ ì
  290. áááááááááááááááexceed≤ 0FFh¼ thσ high-orde≥ addres≤ i≤ ì
  291. áááááááááááááááincremented. Example: SBC 2000h,X
  292. Abs,Y     absolute + Y register
  293. áááááááááááááááA≤ fo≥ Abs,╪ above¼ excep⌠ tha⌠ thσ ┘ registe≥ i≤ ì
  294. áááááááááááááááused« Example║ AD├ address,┘ (wherσ addres≤ i≤ ì
  295. ááááááááááááááágreater than 0FFh).
  296. IX        indirect from (zpage + X register)
  297. áááááááááááááááThσ followinτ bytσ i≤ thσ lo≈ orde≥ addres≤ withiε ì
  298. ááááááááááááááázero-pagσ t∩ whicΦ thσ ╪ registe≥ i≤ addeΣ ì
  299. ááááááááááááááá('wrappinτ roundº iµ necessary)« Thσ effectivσ ì
  300. áááááááááááááááoperanΣ i≤ thσ addres≤ pointeΣ t∩ by thσ content≤ ì
  301. áááááááááááááááoµ thσ effectivσ addres≤ generated« Iµ thσ basσ ì
  302. áááááááááááááááaddres≤ doe≤ no⌠ evaluatσ t∩ aε 8-bi⌠ addres≤ ì
  303. ááááááááááááááá(i.e« thσ high-orde≥ bytσ i≤ greate≥ thaε zero⌐ ì
  304. áááááááááááááááan error is generated. Example: LDA base,IX
  305. IY        indirect from zpage, + Y register
  306. áááááááááááááááSimila≥ t∩ IX¼ excep⌠ tha⌠ thσ content≤ oµ thσ ┘ ì
  307. áááááááááááááááregiste≥ arσ addeΣ AFTER thσ indirectioε -- thσ ì
  308. ááááááááááááááácontent≤ oµ thσ ┘ registe≥ arσ addeΣ t∩ thσ ì
  309. ááááááááááááááácontent≤ oµ thσ tw∩ byte≤ a⌠ 'addressº (withiε ì
  310. ááááááááááááááázero-page⌐ t∩ creatσ thσ effectivσ address« Iµ thσ ì
  311. ááááááááááááááábasσ addres≤ doe≤ no⌠ evaluatσ t∩ aε 8-bi⌠ addres≤ ìèáááááááááááááááan error is generated. Example: CMP 20h,IY
  312. I         indirec⌠ froφ zpagσ
  313. áááááááááááááááThσ effectivσ addres≤ i≤ thσ content≤ oµ thσ tw∩ ì
  314. ááááááááááááááábyte≤ startinτ a⌠ thσ followinτ addres≤ iε zero-ì
  315. ááááááááááááááápage« Thi≤ i≤ identica∞ t∩ I┘ iε case≤ wherσ thσ ┘ ì
  316. áááááááááááááááregister is zero. Example: AND flag,I
  317.  
  318. Tw∩ othe≥ addressinτ mode≤ arσ available¼ bu⌠ onl∙ witΦ thσ JM╨ ì
  319. instruction║ absolutσ indirect¼ anΣ absolutσ indexeΣ indirect« ì
  320. Thesσ arσ availablσ a≤ JMP╔ Ab≤ anΣ JMP╔ Abs,╪ respectively╗ thσ ì
  321. JMP instruction has only the Abs addressing mode.
  322.  
  323. Numeric values
  324. --------------
  325. (Note║ Thi≤ i≤ NOT thσ samσ a≤ MO╙ Technolog∙ syntax)« Fou≥ ì
  326. numbe≥ base≤ arσ recognised║ binary¼ octal¼ decima∞ anΣ ì
  327. hexadecimal« Thesσ arσ representeΣ b∙ thσ followinτ suffixes:
  328.  
  329.      B         binary -- 011011b
  330.      O or Q    octal -- 377q
  331.      D         decimal (defaults to decimal) -- 100, 100d
  332.      H         hexadecimal -- 20h, 0FFh
  333.  
  334. Al∞ numeriπ value≤ MUST star⌠ witΦ ß numbe≥ -- he° value≤ abovσ ì
  335. 9Fh must be prefixed by 0.
  336.  
  337. Numeriπ value≤ arσ treateΣ a≤ 16-bi⌠ unsigneΣ numbers╗ thσ ì
  338. addressinτ modσ useΣ check≤ tha⌠ thσ numbe≥ i≤ withiε it≤ ì
  339. required range.
  340.  
  341. Arithmetic expressions
  342. ----------------------
  343. Operand≤ ma∙ includσ arithmetiπ expression≤ oµ considerablσ ì
  344. complexity« Thσ followinτ i≤ ß lis⌠ oµ thσ function≤ anΣ ì
  345. operator≤ tha⌠ ma∙ bσ useΣ withiε arithmetiπ expressions«
  346.  
  347.      * times
  348.      + plus
  349.      - minus
  350.      / divide
  351.      MOD remainder from divide
  352.      & binary AND (note -- not 'AND', which is a 6502 opcode)
  353.      OR binary inclusive-OR
  354.      XOR binary exclusive-OR
  355.      NOT binary negate
  356.      SHL binary shift-left
  357.      SHR binary shift-right   
  358.  
  359. Al∞ arithmetiπ operation≤ ac⌠ oε thσ curren⌠ valuσ a≤ ß 16-bi⌠ ì
  360. unsigneΣ number« Bracket≤ -- ¿ ⌐ -- enclosσ thesσ expression≤ anΣ ì
  361. ma∙ bσ nesteΣ u≡ t∩ si° deep╗ bracket≤ caε als∩ bσ useΣ t∩ forcσ ì
  362. thσ orde≥ oµ evaluatioε oµ aε expression« Seσ thσ AS═ manua∞ fo≥ ì
  363. morσ details.
  364.  
  365. Literal expressions
  366. -------------------
  367. Tex⌠ (o≥ individua∞ letters⌐ ma∙ bσ includeΣ iε operand≤ b∙ ì
  368. enclosinτ it in single quotes, e.g.:
  369. è
  370.      CMP #'T'
  371.      db   'text'
  372.  
  373. Wherσ single-quote≤ character≤ arσ t∩ bσ included¼ the∙ mus⌠ bσ ì
  374. repeated:
  375.  
  376.      db   'it''s a little confusing'
  377.      CMP #''''      ;is A single-quote?
  378.  
  379. For more details, see the ASM manual.
  380.  
  381. Pseudo-operations
  382. -----------------
  383. Pseudo-op≤ fal∞ int∩ fivσ groups║ defininτ o≥ reservinτ space¼ ì
  384. defininτ constant≤ o≥ variables¼ defininτ thσ locatioε counter¼ ì
  385. delimitinτ area≤ fo≥ conditiona∞ assembly¼ anΣ (a≤ ye⌠ ì
  386. unimplemented⌐ expansioε instructions« Onl∙ ß brieµ summar∙ i≤ ì
  387. given here: for more detail refer to the ASM manual.
  388.  
  389. Defining space
  390. --------------
  391. DB   definσ bytσ (equivalen⌠ oµ .BYT┼ iε MO╙ Technolog∙ syntax)« ì
  392. áááááReservσ bytσ orienteΣ spacσ anΣ it≤ contents¼ sucΦ a≤ ì
  393. áááááconstants, variables or embedded text.
  394. áááááExamples:
  395. ááááá     db   0,0,0,0,22,105,0
  396. ááááá     db   'text',0
  397. áááááIµ an∙ valuσ evaluate≤ t∩ greate≥ thaε 0FFh¼ aε erro≥ wil∞ ì
  398. ááááábe generated.
  399. DWááádefinσ worΣ (equivalen⌠ oµ .WOR─ iε MO╙ Technolog∙ syntax)« ì
  400. áááááReservσ word-orienteΣ spacσ anΣ it≤ contents¼ witΦ thσ ì
  401. ááááácontent≤ storeΣ iε lo-hΘ order╗ typicall∙ useΣ t∩ definσ ì
  402. áááááaddress tables.
  403. áááááExample:
  404. ááááá     dw   word1,word2,0,0FFFFh
  405. DSááádefinσ reserveΣ areß witΦ undefineΣ contents╗ typicall∙ useΣ ì
  406. áááááto define scratchpad areas.
  407. áááááExample:
  408. ááááá     ds   255
  409.  
  410. Defining constants or variables
  411. -------------------------------
  412. EQU  assigε ß constan⌠ valuσ t∩ 'labelº (equivalen⌠ oµ '=º iε MO╙ ì
  413. áááááTechnolog∙ syntax)« Thσ labe∞ mus⌠ bσ iε thσ samσ line« ì
  414. áááááValue≤ arσ considereΣ t∩ bσ 16-bi⌠ unsigneΣ numbers¼ anΣ ma∙ ì
  415. ááááábσ addresses¼ characte≥ constants¼ o≥ 16- o≥ 8-bi⌠ value≤ oµ ì
  416. áááááan∙ kind« Iµ ß constan⌠ i≤ defineΣ morσ thaε oncσ usinτ EQU¼ ì
  417. áááááaε erro≥ wil∞ bσ generated.
  418.      Example:
  419. ááááá     eof  EQU  1ah
  420. SETááassigε ß variablσ valuσ t∩ 'label'« Thσ samσ a≤ EQU¼ excep⌠ ì
  421. ááááátha⌠ n∩ erro≥ wil∞ bσ generateΣ iµ i⌠ i≤ redefined« ì
  422. áááááTypicall∙ useΣ t∩ specif∙ variable≤ t∩ contro∞ o≥ fo≥ usσ iε ì
  423. áááááconditional assembly.
  424. áááááExample:
  425. ááááá     flag SET 1
  426.  
  427. èDefining the location counter
  428. -----------------------------
  429. ORGááDefine≤ thσ curren⌠ locatioε counte≥ froφ whicΦ addresse≤ ì
  430. áááááwil∞ bσ calculateΣ (samσ a≤ '*=º iε MO╙ Technolog∙ syntax)« ì
  431. áááááMa∙ bσ defineΣ o≥ redefineΣ a⌠ an∙ timσ -- shoulΣ onl∙ bσ ì
  432. ááááádefineΣ t∩ ß highe≥ address¼ a≤ redefinition≤ t∩ lowe≥ ì
  433. áááááaddresse≤ thaε thσ curren⌠ addres≤ ma∙ causσ problem≤ a⌠ ì
  434. áááááfina∞ assembly.
  435. áááááExample:
  436. ááááá     org 0f000h
  437. ENDááDefine≤ thσ enΣ oµ thσ prograφ a≤ fa≥ a≤ assembl∙ i≤ ì
  438. áááááconcerned. Optional.
  439.  
  440. Conditional assembly
  441. --------------------
  442. IFáááStar⌠ oµ sectioε whicΦ wil∞ bσ assembleΣ onl∙ iµ thσ ì
  443. áááááfollowinτ conditioε i≤ truσ (non-zero)« Onl∙ onσ leve∞ oµ ì
  444. áááááconditional assembly is available.
  445. áááááExample:
  446. ááááá     testversion    equ  1
  447. ááááá     IF testversion
  448. ááááá                    jsr  printstatus
  449. ááááá     ENDIF
  450. ááááá     IF not testversion
  451. ááááá                    jsr clrstatus
  452. ááááá     ENDIF
  453. ááááá                    jmp mainloop
  454. ENDIF
  455. áááááEnd≤ ß sectioε oµ conditiona∞ assembly« ┴ missinτ o≥ ì
  456. áááááunmatched ENDIF will cause an error to be generated.
  457.  
  458. Unimplemented instructions
  459. --------------------------
  460. Thσ followinτ instruction≤ arσ treateΣ a≤ reserveΣ words¼ bu⌠ ì
  461. arσ no⌠ ye⌠ implementeΣ -- thei≥ usσ wil∞ causσ aε erro≥ t∩ bσ ì
  462. generated:
  463.      MACRO
  464.      ENDM
  465.      TITLE
  466.  
  467. Error messages
  468. --------------
  469. Assembl∙ erro≥ message≤ arσ rudimentary¼ consistinτ oµ ß singlσ ì
  470. lette≥ iε thσ firs⌠ columε oµ thσ listinτ (.PRN⌐ filσ anΣ thσ ì
  471. displa∙ oε thσ consolσ oµ thσ relevan⌠ line« Wherσ severa∞ error≤ ì
  472. occu≥ withiε thσ samσ line¼ onl∙ thσ lette≥ oµ thσ firs⌠ erro≥ ì
  473. wil∞ bσ shown« Iε general¼ thσ causσ oµ aε erro≥ wil∞ bσ a≤ ì
  474. describeΣ iε thσ lis⌠ iε thσ AS═ manual╗ aε exceptioε i≤ tha⌠ al∞ ì
  475. illega∞ addressinτ mode≤ arσ treateΣ a≤ 'Rº (register⌐ errors¼ ì
  476. fo≥ whicΦ threσ NOP≤ ('EAEAEA'⌐ wil∞ bσ generateΣ a≤ code«
  477.  
  478. A≤ witΦ ASM¼ assembl∙ continue≤ afte≥ al∞ errors¼ sometime≤ ì
  479. causinτ othe≥ error≤ late≥ durinτ assembl∙ a≤ ß 'knock-onº ì
  480. effect.
  481.  
  482.  
  483.  
  484.  
  485. èUsing ASM65
  486. -----------
  487. Wσ assumσ tha⌠ yo⌡ havσ createΣ you≥ prograφ oε ß sourcσ filσ ì
  488. calleΣ 'filename.A65'« (Notσ tha⌠ thσ filσ mus⌠ usσ thσ extensioε ì
  489. '.A65')« ASM6╡ caε creatσ u≡ t∩ tw∩ additiona∞ file≤ froφ thσ ì
  490. sourcσ file║ ß '.HEXº file¼ containinτ machinσ codσ iε Inte∞ he° ì
  491. format¼ and/o≥ ß '.PRNº listinτ file╗ i⌠ caε als∩ lis⌠ t∩ thσ ì
  492. console« Iε al∞ case≤ sourcσ line≤ witΦ error≤ wil∞ bσ listeΣ t∩ ì
  493. thσ screeε and¼ iµ thσ printe≥ i≤ enabled¼ t∩ thσ printe≥ a≤ ì
  494. well.
  495.  
  496. Typical examples of assemblies are:
  497.  
  498.      B>a:asm65 filename
  499.  
  500. whicΦ assume≤ ß sourcσ filσ filename.A6╡ oε thσ B║ drive¼ anΣ ì
  501. creates files filename.HEX and filename.PRN on the same drive.
  502.  
  503.      B>a:asm65 filename.bbz
  504.  
  505. which does the same, except that no .PRN file will be created.
  506.  
  507.      B>a:asm65 filename.bzx
  508.  
  509. whicΦ read≤ thσ sourcσ filσ oε B:¼ doe≤ no⌠ creatσ ß .HE╪ file¼ ì
  510. anΣ send≤ thσ listinτ onl∙ t∩ thσ screeε withou⌠ creatinτ ß .PR╬ ì
  511. file.
  512.  
  513. Notσ tha⌠ ß .PR╬ filσ ma∙ wel∞ bσ twicσ thσ sizσ oµ you≥ origina∞ ì
  514. sourcσ file║ makσ surσ tha⌠ yo⌡ havσ enougΦ disδ spacσ beforσ ì
  515. allowing the assembler to create it!
  516.  
  517. Fo≥ ful∞ detail≤ oε thσ actua∞ assembl∙ proces≤ anΣ it≤ erro≥ ì
  518. messages, refer to the ASM manual.
  519.  
  520.  
  521. Creating executable code
  522. ------------------------
  523. ASM6╡ doe≤ no⌠ b∙ itselµ creatσ executablσ codσ -- i⌠ create≤ ß ì
  524. '.HEXº filσ containinτ it≤ machinσ codσ a≤ loaΣ address¼ he° ì
  525. value≤ anΣ checksuφ iε thσ Inte∞ he° format« Thi≤ mus⌠ bσ ì
  526. converted to executable code by a separate loader.
  527.  
  528. Digita∞ Research'≤ LOA─ prograφ doe≤ thi≤ fo≥ 8080/Z8░ programs¼ ì
  529. anΣ wil∞ als∩ bσ suitablσ fo≥ non-ROMablσ 650▓ code« Thσ catcΦ ì
  530. witΦ LOA─ i≤ tha⌠ i⌠ alway≤ create≤ ß filσ assuminτ ß loaΣ ì
  531. addres≤ oµ 100h¼ wherea≤ ROMablσ 650▓ codσ wil∞ tenΣ t∩ residσ ì
  532. mucΦ highe≥ iε memory╗ LOA─ thereforσ tend≤ t∩ creatσ aε oversizσ ì
  533. filσ consistinτ mainl∙ oµ garbage¼ witΦ thσ actua∞ codσ u≡ a⌠ thσ top« ì
  534. Thσ solutioε iε thesσ case≤ i≤ t∩ pas≤ thσ he° filσ t∩ aε externa∞ 650▓ ì
  535. systeφ fo≥ processinτ it¼ o≥ usσ thσ  modifieΣ loader¼ CODE.CO═ (oε ì
  536. thi≤ disk)¼ whicΦ automaticall∙ generate≤ aε offse⌠ t∩ storσ ROMablσ ì
  537. codσ iε thσ minimuφ sizσ file« PROMLOA─ o≥ somσ othe≥ file-reade≥ caε ì
  538. theε transfe≥ thσ codσ t∩ aε externa∞ systeφ o≥ PRO═ programmer.
  539.