Advertisement
NovaYoshi

small coprocessor

Dec 12th, 2016
178
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.29 KB | None | 0 0
  1. -------- REGISTERS --------
  2. A - accumulator, 8-bit
  3. X - index, 8-bit
  4. Y - index, 8-bit
  5. SP - stack pointer, 6-bit?
  6. PC - program counter, 12-bit
  7. F - flags: carry, negative, zero
  8.  
  9. 3KB of RAM to put the program and data in
  10.  
  11. -------- OPCODE FORMAT --------
  12. ffffff00 - zero
  13. ffffff01 nnnnnnnn - zeropage (or immediate)
  14. ffffff10 nnnnnnnn nnnnnnnn - absolute
  15. ffffff11 nnnnnnnn nnnnnnnn - absolute,x
  16.  
  17. The bottom two bits tell the CPU how many bytes of parameters to read and put into a buffer.
  18. For a constant it may be zero or an 8-bit value. Absolute and Absolute,x are reserved.
  19. For memory it may be zero (first byte of RAM), zeropage, absolute or absolute,x.
  20. For a branch, an 8-bit parameter is relative and a 16-bit parameter is absolute. Jumping to absolute,x is allowed.
  21. Memory+Y acts like (zeropage),y for zeropage instructions.
  22.  
  23. f = function, from list below:
  24.  
  25. -------- FUNCTION TABLE --------
  26. 000000 00 LDA constant
  27. 000001 01 LDA memory
  28. 000010 02 LDX constant
  29. 000011 03 LDX memory
  30. 000100 04 LDY constant
  31. 000101 05 LDY memory
  32. 000110 06 CLC
  33. 000111 07 SEC
  34. 001000 08 ADD constant
  35. 001001 09 ADD memory
  36. 001010 0A SUB constant
  37. 001011 0B SUB memory
  38. 001100 0C ADC constant
  39. 001101 0D ADC memory
  40. 001110 0E SBC constant
  41. 001111 0F SBC memory
  42. 010000 10 NOR constant
  43. 010001 11 NOR memory
  44. 010010 12 XOR constant
  45. 010011 13 XOR memory
  46. 010100 14 CMP constant
  47. 010101 15 CMP memory
  48. 010110 16 CPX constant
  49. 010111 17 CPX memory
  50. 011000 18 ASL
  51. 011001 19 ROL memory
  52. 011010 1A LSR
  53. 011011 1B ROR memory
  54. 011100 1C CPY constant
  55. 011101 1D INC memory
  56. 011110 1E Unused
  57. 011111 1F DEC memory
  58. 100000 20 NOP - neither TAX or TXA firing
  59. 100001 21 STA memory
  60. 100010 22 TAX
  61. 100011 23 STX memory
  62. 100100 24 TXA
  63. 100101 25 STY memory
  64. 100110 26 SWAP (X and Y) - TAX and TXA firing at the same time
  65. 100111 27 RTS
  66. 101000 28 LDA memory+y
  67. 101001 29 STA memory+y
  68. 101010 3A INC
  69. 101011 3B DEC
  70. 101100 3C INX
  71. 101101 3D DEX
  72. 101110 2E INY
  73. 101111 2F DEY
  74. 110000 30 PHP
  75. 110001 31 PLP
  76. 110010 32 PHA
  77. 110011 33 PLA
  78. 110100 34 PHX
  79. 110101 35 PLX
  80. 110110 36 PHY
  81. 110111 37 PLY
  82. 111000 38 BRA/JMP location
  83. 111001 39 BSR/JSR location
  84. 111010 3A BPL/JPL location
  85. 111011 3B BMI/JMI location
  86. 111100 3C BNE/JNE location
  87. 111101 3D BEQ/JEQ location
  88. 111110 3E BCC/JCC location
  89. 111111 3F BCS/JCS location
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement