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