Advertisement
NovaYoshi

custom 65c02

May 11th, 2018
182
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.14 KB | None | 0 0
  1. 78 instruction slots:
  2.  
  3. Registers:
  4. A - accumulator (8-bit)
  5. X - index register (8-bit)
  6. Y - index register (8-bit)
  7. J - index register (8-bit)
  8. K - index register (8-bit)
  9. S - stack pointer (16-bit)
  10.  
  11. Conditional jumps:
  12. jeq label - jump if equal
  13. jne label - jump if not equal
  14. jcc label - jump if carry clear
  15. jcs label - jump if carry set
  16. jpl label - jump if positive
  17. jmi label - jump if negative
  18. jvc label - jump if overflow clear
  19. jvs label - jump if overflow set
  20.  
  21. Add/Sub without carry:
  22. add #constant - add without carry
  23. add zeropage - add without carry
  24. add absolute - add without carry
  25. add absolute,x - add without carry
  26. sub #constant - subtract without carry (alias for add #-constant)
  27. sub zeropage - subtract without carry
  28. sub absolute - subtract without carry
  29. sub absolute,x - subtract without carry
  30.  
  31. Index register operations:
  32. adx #constant - add constant to X
  33. ady #constant - add constant to Y
  34. stx absolute,y - store indexed
  35. sty absolute,x - store indexed
  36. txy - Y = X
  37. tyx - X = Y
  38.  
  39. 16-bit operations:
  40. inw zeropage - 16-bit increment
  41. dew zeropage - 16-bit decrement
  42.  
  43. Auto-increment:
  44. ldai (zeropage) - LDA (zeropage) \ INW zeropage
  45. stai (zeropage) - STA (zeropage) \ INW zeropage
  46.  
  47. Miscellaneous:
  48. wai - wait for interrupt
  49. com - A = ~A
  50. sex - A = $ff if it's negative, or $00 otherwise
  51. neg - A = -A
  52. asr - A >>= 1, keeping most significant bit the same
  53. cla - A = 0
  54. clx - X = 0
  55. cly - Y = 0
  56. ldf zeropage - read memory and discard, but set flags
  57. ldf absolute - read memory and discard, but set flags
  58.  
  59. Stack extension:
  60. tys - high byte of stack pointer = Y (interrupts not allowed between TXS and TYS)
  61. tsy - Y = high byte of stack pointer
  62. cle - disable stack extend; stack forced to $01xx
  63. see - enable stack extend, stack allowed to be anywhere
  64.  
  65. Prefixes:
  66. shift_op - prefix for multi-bit shifts
  67. index_j - index with J register instead
  68. index_k - index with K register instead
  69.  
  70. Addressing modes to go with index_j and index_k:
  71. zeropage,j
  72. zeropage,k
  73. absolute,j
  74. absolute,k
  75. (zeropage), j
  76. (zeropage), k
  77. (zeropage, j)
  78. (zeropage, k)
  79.  
  80. Mnemonics to go with index_j and index_k:
  81. inj, ink - increment
  82. dej, dek - decrement
  83. cpj, cpk - compare
  84. tja, tka - copy to A
  85. taj, tak - copy from A
  86. phj, phk - push
  87. plj, plk - pull
  88. clj, clk - clear
  89. ldj, ldk - load
  90. stj, stk - store
  91. adj, adk - add constant
  92.  
  93. ---shift prefix---
  94. pptt dsss
  95. |||| |+++- shift amount, minus 1 (immediate)
  96. |||| +---- 0: shift left
  97. |||| 1: shift right
  98. ||++------ 0: shift in 0s
  99. || 1: shift in 1s
  100. || 2: arithmetic shift
  101. || 3: circular rotate
  102. ++-------- 0: shift accumulator
  103. 1: shift low zeropage byte + high zeropage byte
  104. 2: shift low accumulator + high zeropage byte
  105. 3: shift low zeropage byte + high accumulator byte
  106.  
  107. asl #imm - shift left
  108. lsr #imm - shift right
  109. sl1 #imm - shift left (shift in 1)
  110. sr1 #imm - shift right (shift in 1)
  111. asr #imm - arithmetic shift right
  112. rlc #imm - circular rotate left
  113. rrc #imm - circular rotate right
  114.  
  115. (zeropage low, accumulator high)
  116. aslzl #imm - shift left
  117. lsrzl #imm - shift right
  118. sl1zl #imm - shift left (shift in 1)
  119. sr1zl #imm - shift right (shift in 1)
  120. asrzl #imm - arithmetic shift right
  121. rlczl #imm - circular rotate left
  122. rrczl #imm - circular rotate right
  123.  
  124. (accumulator low, zeropage high)
  125. aslzh #imm - shift left
  126. lsrzh #imm - shift right
  127. sl1zh #imm - shift left (shift in 1)
  128. sr1zh #imm - shift right (shift in 1)
  129. asrzh #imm - arithmetic shift right
  130. rlczh #imm - circular rotate left
  131. rrczh #imm - circular rotate right
  132.  
  133. (word)
  134. aslw #imm - shift left
  135. lsrw #imm - shift right
  136. sl1w #imm - shift left (shift in 1)
  137. sr1w #imm - shift right (shift in 1)
  138. asrw #imm - arithmetic shift right
  139. rlcw #imm - circular rotate left
  140. rrcw #imm - circular rotate right
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement