Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -------- REGISTERS --------
- A - accumulator, 8-bit
- X - index, 8-bit
- Y - index, 8-bit
- SP - stack pointer
- PC - program counter
- F - flags: carry, negative, zero
- -------- OPCODE FORMAT --------
- ffffff00 - zero
- ffffff01 nnnnnnnn - zeropage (or immediate)
- ffffff10 nnnnnnnn nnnnnnnn - absolute
- ffffff11 nnnnnnnn nnnnnnnn - absolute,x
- Before an opcode is excuted, the bottom two bits are looked at to determine how many bytes to read,
- and this is put into a buffer. This buffer may be interpreted by the instruction as a constant value or a memory address.
- Branch opcodes interpret 8-bit values as relative, and 16-bit values as absolute.
- The "zero" addressing mode gives easy access to the first byte of memory.
- f = function, from list below:
- -------- FUNCTION TABLE --------
- Load/Store/Transfer
- 00 LDA constant
- 01 LDA memory
- 02 LDX constant
- 03 LDX memory
- 04 STA memory
- 05 STX memory
- 06 TAX
- 07 TXA
- Add/Subtract
- 08 SUB constant
- 09 SUB memory
- 0A ADD constant
- 0B ADD memory
- 0C SBC constant
- 0D SBC memory
- 0E ADC constant
- 0F ADC memory
- Bit math
- 10 NOR constant
- 11 NOR memory
- 12 XOR constant
- 13 XOR memory
- Comparisons
- 14 CMP constant
- 15 CMP memory
- 16 CPX constant
- 17 CPX memory
- Bit shifts
- 18 ASL
- 19 LSR
- 1A ROL memory
- 1B ROR memory
- Y register
- 1C LDY constant
- 1D LDY memory
- 1E CPY constant
- 1F STY memory
- 20 INY
- 21 DEY
- 22 PHY
- 23 PLY
- 24 LDA memory+y \ absolute
- 25 STA memory+y /
- 24 LDA (memory)+y \ zeropage, indirect
- 25 STA (memory)+y /
- 26 Unassigned
- 27 Unassigned
- Miscellaneous
- 28 PHP
- 29 PLP
- 2A SWAP (A and X)
- 2B RTS
- 2C SEC
- 2D CLC
- Increment/decrement
- 2E INC memory
- 2F DEC memory
- 30 INC
- 31 DEC
- 32 INX
- 33 DEX
- Push/pull
- 34 PHA
- 35 PHX
- 36 PLA
- 37 PLX
- Branches
- 38 BRA \ zeropage
- 39 BSR |
- 3A BPL |
- 3B BMI |
- 3C BNE |
- 3D BEQ |
- 3E BCC |
- 3F BCS /
- Jumps
- 38 JMP \ absolute
- 39 JSR |
- 3A JPL |
- 3B JMI |
- 3C JNE |
- 3D JEQ |
- 3E JCC |
- 3F JCS /
- -------- ALIASES/NOTES --------
- NOT = NOR
- ORA = NOR whatever, NOT
- BIC = NOT, NOR #whatever
- AND = NOT, NOR #255^whatever
- NEG = NOT, INC
- TAY = PHA, PLY
- TYA = PHY, PLA
- TXY = PHX, PLY
- TYX = PHY, PLX
- ---
- could replace CLC/SEC with ADD/SUB but it would mess up zero flag and sign flag
- A can be reset to zero in just one opcode with LDA
- do we really need a nop?
- you can do "LDA A,X,Y" if you're a weirdo
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement