Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- 78 instruction slots:
- Registers:
- A - accumulator (8-bit)
- X - index register (8-bit)
- Y - index register (8-bit)
- J - index register (8-bit)
- K - index register (8-bit)
- S - stack pointer (16-bit)
- Conditional jumps:
- jeq label - jump if equal
- jne label - jump if not equal
- jcc label - jump if carry clear
- jcs label - jump if carry set
- jpl label - jump if positive
- jmi label - jump if negative
- jvc label - jump if overflow clear
- jvs label - jump if overflow set
- Add/Sub without carry:
- add #constant - add without carry
- add zeropage - add without carry
- add absolute - add without carry
- add absolute,x - add without carry
- sub #constant - subtract without carry (alias for add #-constant)
- sub zeropage - subtract without carry
- sub absolute - subtract without carry
- sub absolute,x - subtract without carry
- Index register operations:
- adx #constant - add constant to X
- ady #constant - add constant to Y
- stx absolute,y - store indexed
- sty absolute,x - store indexed
- txy - Y = X
- tyx - X = Y
- 16-bit operations:
- inw zeropage - 16-bit increment
- dew zeropage - 16-bit decrement
- Auto-increment:
- ldai (zeropage) - LDA (zeropage) \ INW zeropage
- stai (zeropage) - STA (zeropage) \ INW zeropage
- Miscellaneous:
- wai - wait for interrupt
- com - A = ~A
- sex - A = $ff if it's negative, or $00 otherwise
- neg - A = -A
- asr - A >>= 1, keeping most significant bit the same
- cla - A = 0
- clx - X = 0
- cly - Y = 0
- ldf zeropage - read memory and discard, but set flags
- ldf absolute - read memory and discard, but set flags
- Stack extension:
- tys - high byte of stack pointer = Y (interrupts not allowed between TXS and TYS)
- tsy - Y = high byte of stack pointer
- cle - disable stack extend; stack forced to $01xx
- see - enable stack extend, stack allowed to be anywhere
- Prefixes:
- shift_op - prefix for multi-bit shifts
- index_j - index with J register instead
- index_k - index with K register instead
- Addressing modes to go with index_j and index_k:
- zeropage,j
- zeropage,k
- absolute,j
- absolute,k
- (zeropage), j
- (zeropage), k
- (zeropage, j)
- (zeropage, k)
- Mnemonics to go with index_j and index_k:
- inj, ink - increment
- dej, dek - decrement
- cpj, cpk - compare
- tja, tka - copy to A
- taj, tak - copy from A
- phj, phk - push
- plj, plk - pull
- clj, clk - clear
- ldj, ldk - load
- stj, stk - store
- adj, adk - add constant
- ---shift prefix---
- pptt dsss
- |||| |+++- shift amount, minus 1 (immediate)
- |||| +---- 0: shift left
- |||| 1: shift right
- ||++------ 0: shift in 0s
- || 1: shift in 1s
- || 2: arithmetic shift
- || 3: circular rotate
- ++-------- 0: shift accumulator
- 1: shift low zeropage byte + high zeropage byte
- 2: shift low accumulator + high zeropage byte
- 3: shift low zeropage byte + high accumulator byte
- asl #imm - shift left
- lsr #imm - shift right
- sl1 #imm - shift left (shift in 1)
- sr1 #imm - shift right (shift in 1)
- asr #imm - arithmetic shift right
- rlc #imm - circular rotate left
- rrc #imm - circular rotate right
- (zeropage low, accumulator high)
- aslzl #imm - shift left
- lsrzl #imm - shift right
- sl1zl #imm - shift left (shift in 1)
- sr1zl #imm - shift right (shift in 1)
- asrzl #imm - arithmetic shift right
- rlczl #imm - circular rotate left
- rrczl #imm - circular rotate right
- (accumulator low, zeropage high)
- aslzh #imm - shift left
- lsrzh #imm - shift right
- sl1zh #imm - shift left (shift in 1)
- sr1zh #imm - shift right (shift in 1)
- asrzh #imm - arithmetic shift right
- rlczh #imm - circular rotate left
- rrczh #imm - circular rotate right
- (word)
- aslw #imm - shift left
- lsrw #imm - shift right
- sl1w #imm - shift left (shift in 1)
- sr1w #imm - shift right (shift in 1)
- asrw #imm - arithmetic shift right
- rlcw #imm - circular rotate left
- rrcw #imm - circular rotate right
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement