Welcome to Data Crystal's new home! Data Crystal is now part of the TCRF family (sort of).
The wiki has recently moved; please report any issues in Discord. Pardon the dust.
The wiki has recently moved; please report any issues in Discord. Pardon the dust.
6502 opcodes: Difference between revisions
Jump to navigation
Jump to search
mNo edit summary |
(Cleanup) |
||
Line 1: | Line 1: | ||
The following table contains a list of | The following table contains a list of opcodes for the 6502 processor, used in the [[Nintendo Entertainment System|NES]]. | ||
* <tt>ABS</tt> = Absolute | |||
* <tt>ACC</tt> = Accumulator | |||
* <tt>IMM</tt> = Immediate | |||
* <tt>IND</tt> = Indirect | |||
---- | |||
{|border="1" align="center" cellpadding="4" cellspacing="0" style="margin: 0 0 1em 1em; background: #f7f8ff; border: 1px #8888cc solid; border-collapse: collapse; font-size: 95%" | {|border="1" align="center" cellpadding="4" cellspacing="0" style="margin: 0 0 1em 1em; background: #f7f8ff; border: 1px #8888cc solid; border-collapse: collapse; font-size: 95%" | ||
|- style=background:#ccccff | |- style=background:#ccccff | ||
! Mnemonic !! Description !! Implied / ACC !! (IND),X !! (IND,Y) !! ABS !! ABS,X !! IMM !! ABS,Y !! Zero Page !! Zero Page,X | ! Mnemonic !! Description !! Implied / ACC !! (IND),X !! (IND,Y) !! ABS !! ABS,X !! IMM !! ABS,Y !! Zero Page !! Zero Page,X | ||
|- | |- | ||
||ADC || add memory to accumulator with carry | ||ADC || add memory to accumulator with carry || || 61 || 71 || 6D || 7D || 69 || 79 || 65 || 75 | ||
|- | |- | ||
||AND || AND memory with accumulator | ||AND || AND memory with accumulator || || 21 || 31 || 2D || 3D || 29 || 39 || 25 || 35 | ||
|- | |- | ||
||ASL || shift left one bit (memory or accumulator) || 0A || || || || || || || 06 || 16 | ||ASL || shift left one bit (memory or accumulator) || 0A || || || || || || || 06 || 16 | ||
|- | |- | ||
||BCC || branch on carry clear | ||BCC || branch on carry clear || 90 || || || || || || || || | ||
|- | |- | ||
||BCS || branch on carry set | ||BCS || branch on carry set || B0 || || || || || || || || | ||
|- | |- | ||
||BEQ || branch on result zero | ||BEQ || branch on result zero || F0 || || || || || || || || | ||
|- | |- | ||
||BIT || test bits in memory with accumulator || || || || 2C || || || || 24 || | ||BIT || test bits in memory with accumulator || || || || 2C || || || || 24 || | ||
|- | |- | ||
||BMI || | ||BMI || branch on result minus || 30 || || || || || || || || | ||
|- | |- | ||
||BNE || branch on result not zero | ||BNE || branch on result not zero || D0 || || || || || || || || | ||
|- | |- | ||
||BPL || branch on result plus | ||BPL || branch on result plus || 10 || || || || || || || || | ||
|- | |- | ||
||BVC || branch on overflow clear | ||BVC || branch on overflow clear || 50 || || || || || || || || | ||
|- | |- | ||
||BVS || branch on overflow set | ||BVS || branch on overflow set || 70 || || || || || || || || | ||
|- | |- | ||
||CLC || clear carry flag || 18 || || || || || || || || | ||CLC || clear carry flag || 18 || || || || || || || || | ||
Line 44: | Line 44: | ||
||CMP || compare memory and accumulator || || C1 || D1 || CD || DD || C9 || D9 || C5 || D5 | ||CMP || compare memory and accumulator || || C1 || D1 || CD || DD || C9 || D9 || C5 || D5 | ||
|- | |- | ||
||CPX || compare memory and X register || || || || EC || || E0 || || E4 || | ||CPX || compare memory and X register || || || || EC || || E0 || || E4 || | ||
|- | |- | ||
||CPY || compare memory and Y register || || || || CC || || C0 || || C4 || | ||CPY || compare memory and Y register || || || || CC || || C0 || || C4 || | ||
|- style=background:#ccccff | |- style=background:#ccccff | ||
! Mnemonic !! Description !! Implied / ACC !! (IND),X !! (IND,Y) !! ABS !! ABS,X !! IMM !! ABS,Y !! Zero Page !! Zero Page,X | ! Mnemonic !! Description !! Implied / ACC !! (IND),X !! (IND,Y) !! ABS !! ABS,X !! IMM !! ABS,Y !! Zero Page !! Zero Page,X | ||
|- | |- | ||
||DEC || decrement memory | ||DEC || decrement memory || || || || CE || DE || || || C6 || D6 | ||
|- | |- | ||
||DEX || decrement register | ||DEX || decrement X register || CA || || || || || || || || | ||
|- | |- | ||
||DEY || decrement register | ||DEY || decrement Y register || 88 || || || || || || || || | ||
|- | |- | ||
||EOR || EXCLUSIVE OR memory with accumulator | ||EOR || EXCLUSIVE OR memory with accumulator || || 41 || 51 || 4D || 5D || 49 || 59 || 45 || 55 | ||
|- | |- | ||
||INC || increment memory | ||INC || increment memory || || || || EE || FE || || || E6 || F6 | ||
|- | |- | ||
||INX || increment register | ||INX || increment X register || E8 || || || || || || || || | ||
|- | |- | ||
||INY || increment register | ||INY || increment Y register || C8 || || || || || || || || | ||
|- | |- | ||
||JMP || jump to new location | ||JMP || jump to new location || 6C || || || 4C || || || || || | ||
|- | |- | ||
||JSR || jump to new location saving return address | ||JSR || jump to new location saving return address || 20 || || || || || || || || | ||
|- | |- | ||
||LDA || load accumulator with memory | ||LDA || load accumulator with memory || || A1 || B1 || AD || BD || A9 || B9 || A5 || B5 | ||
|- | |- | ||
||LDX || load register | ||LDX || load X register with memory || || || || AE || || A2 || BE || A6 || B6 | ||
|- | |- | ||
||LDY || load register | ||LDY || load Y register with memory || || || || AC || BC || A0 || || A4 || B4 | ||
|- | |- | ||
||LSR || shift right one bit ( memory or accumulator) | ||LSR || shift right one bit (memory or accumulator) || 4A || || || 4E || 5E || || || 46 || | ||
|- | |- | ||
||NOP || no operation | ||NOP || no operation || EA || || || || || || || || | ||
|- | |- | ||
||ORA || OR memory with accumulator | ||ORA || OR memory with accumulator || || 01 || 11 || 0D || 1D || 09 || 19 || 05 || 15 | ||
|- | |- | ||
||PHA || push accumulator on stack | ||PHA || push accumulator on stack || 48 || || || || || || || || | ||
|- | |- | ||
||PHP || push processor status on stack | ||PHP || push processor status on stack || 08 || || || || || || || || | ||
|- | |- | ||
||PLA || pull accumulator from from stack | ||PLA || pull accumulator from from stack || 68 || || || || || || || || | ||
|- | |- | ||
||PLP || pull processor status from stack | ||PLP || pull processor status from stack || 28 || || || || || || || || | ||
|- style=background:#ccccff | |- style=background:#ccccff | ||
! Mnemonic !! Description !! Implied / ACC !! (IND),X !! (IND,Y) !! ABS !! ABS,X !! IMM !! ABS,Y !! Zero Page !! Zero Page,X | ! Mnemonic !! Description !! Implied / ACC !! (IND),X !! (IND,Y) !! ABS !! ABS,X !! IMM !! ABS,Y !! Zero Page !! Zero Page,X | ||
|- | |- | ||
||ROL || rotate one bit left ( memory or accumulator) | ||ROL || rotate one bit left (memory or accumulator) || 2A || || || 2E || || || || 26 || 36 | ||
|- | |- | ||
||ROR || rotate one bit right ( memory or accumulator) | ||ROR || rotate one bit right (memory or accumulator) || 6A || || || 6E || 7E || || || 66 || 76 | ||
|- | |- | ||
||RTI || return from interrupt | ||RTI || return from interrupt || 40 || || || || || || || || | ||
|- | |- | ||
||RTS || return from subroutine | ||RTS || return from subroutine || 60 || || || || || || || || | ||
|- | |- | ||
||SBC || subtract memory from accumulator with borrow | ||SBC || subtract memory from accumulator with borrow || || E1 || F1 || ED || FD || E9 || F9 || E5 || F5 | ||
|- | |- | ||
||SEC || set carry flag | ||SEC || set carry flag || 38 || || || || || || || || | ||
|- | |- | ||
||SED || set decimal mode | ||SED || set decimal mode || F8 || || || || || || || || | ||
|- | |- | ||
||SEI || set interrupt disable | ||SEI || set interrupt disable bit || 78 || || || || || || || || | ||
|- | |- | ||
||STA || store accumulator in memory | ||STA || store accumulator in memory || || 81 || 91 || 8D || 9D || || 99 || 85 || 95 | ||
|- | |- | ||
||STX || store register | ||STX || store X register in memory || || || || 8E || || || || 86 || 96 | ||
|- | |- | ||
||STY || store register | ||STY || store Y register in memory || || || || 8C || || || || 84 || 94 | ||
|- | |- | ||
||TAX || transfer accumulator to register | ||TAX || transfer accumulator to X register || AA || || || || || || || || | ||
|- | |- | ||
||TAY || transfer accumulator to register | ||TAY || transfer accumulator to Y register || A8 || || || || || || || || | ||
|- | |- | ||
||TSX || transfer stack pointer to register | ||TSX || transfer stack pointer to X register || BA || || || || || || || || | ||
|- | |- | ||
||TXA || transfer X to accumulator | ||TXA || transfer X register to accumulator || 8A || || || || || || || || | ||
|- | |- | ||
||TXS || transfer register | ||TXS || transfer X register to stack pointer || 9A || || || || || || || || | ||
|- | |- | ||
||TYA || transfer register | ||TYA || transfer Y register to accumulator || 98 || || || || || || || || | ||
|} | |} | ||
[[Category:Nintendo Entertainment System]] | [[Category:Nintendo Entertainment System]] |
Revision as of 00:24, 31 August 2011
The following table contains a list of opcodes for the 6502 processor, used in the NES.
- ABS = Absolute
- ACC = Accumulator
- IMM = Immediate
- IND = Indirect
Mnemonic | Description | Implied / ACC | (IND),X | (IND,Y) | ABS | ABS,X | IMM | ABS,Y | Zero Page | Zero Page,X |
---|---|---|---|---|---|---|---|---|---|---|
ADC | add memory to accumulator with carry | 61 | 71 | 6D | 7D | 69 | 79 | 65 | 75 | |
AND | AND memory with accumulator | 21 | 31 | 2D | 3D | 29 | 39 | 25 | 35 | |
ASL | shift left one bit (memory or accumulator) | 0A | 06 | 16 | ||||||
BCC | branch on carry clear | 90 | ||||||||
BCS | branch on carry set | B0 | ||||||||
BEQ | branch on result zero | F0 | ||||||||
BIT | test bits in memory with accumulator | 2C | 24 | |||||||
BMI | branch on result minus | 30 | ||||||||
BNE | branch on result not zero | D0 | ||||||||
BPL | branch on result plus | 10 | ||||||||
BVC | branch on overflow clear | 50 | ||||||||
BVS | branch on overflow set | 70 | ||||||||
CLC | clear carry flag | 18 | ||||||||
CLD | clear decimal mode | D8 | ||||||||
CLI | clear interrupt disable bit | 58 | ||||||||
CLV | clear overflow flag | B8 | ||||||||
CMP | compare memory and accumulator | C1 | D1 | CD | DD | C9 | D9 | C5 | D5 | |
CPX | compare memory and X register | EC | E0 | E4 | ||||||
CPY | compare memory and Y register | CC | C0 | C4 | ||||||
Mnemonic | Description | Implied / ACC | (IND),X | (IND,Y) | ABS | ABS,X | IMM | ABS,Y | Zero Page | Zero Page,X |
DEC | decrement memory | CE | DE | C6 | D6 | |||||
DEX | decrement X register | CA | ||||||||
DEY | decrement Y register | 88 | ||||||||
EOR | EXCLUSIVE OR memory with accumulator | 41 | 51 | 4D | 5D | 49 | 59 | 45 | 55 | |
INC | increment memory | EE | FE | E6 | F6 | |||||
INX | increment X register | E8 | ||||||||
INY | increment Y register | C8 | ||||||||
JMP | jump to new location | 6C | 4C | |||||||
JSR | jump to new location saving return address | 20 | ||||||||
LDA | load accumulator with memory | A1 | B1 | AD | BD | A9 | B9 | A5 | B5 | |
LDX | load X register with memory | AE | A2 | BE | A6 | B6 | ||||
LDY | load Y register with memory | AC | BC | A0 | A4 | B4 | ||||
LSR | shift right one bit (memory or accumulator) | 4A | 4E | 5E | 46 | |||||
NOP | no operation | EA | ||||||||
ORA | OR memory with accumulator | 01 | 11 | 0D | 1D | 09 | 19 | 05 | 15 | |
PHA | push accumulator on stack | 48 | ||||||||
PHP | push processor status on stack | 08 | ||||||||
PLA | pull accumulator from from stack | 68 | ||||||||
PLP | pull processor status from stack | 28 | ||||||||
Mnemonic | Description | Implied / ACC | (IND),X | (IND,Y) | ABS | ABS,X | IMM | ABS,Y | Zero Page | Zero Page,X |
ROL | rotate one bit left (memory or accumulator) | 2A | 2E | 26 | 36 | |||||
ROR | rotate one bit right (memory or accumulator) | 6A | 6E | 7E | 66 | 76 | ||||
RTI | return from interrupt | 40 | ||||||||
RTS | return from subroutine | 60 | ||||||||
SBC | subtract memory from accumulator with borrow | E1 | F1 | ED | FD | E9 | F9 | E5 | F5 | |
SEC | set carry flag | 38 | ||||||||
SED | set decimal mode | F8 | ||||||||
SEI | set interrupt disable bit | 78 | ||||||||
STA | store accumulator in memory | 81 | 91 | 8D | 9D | 99 | 85 | 95 | ||
STX | store X register in memory | 8E | 86 | 96 | ||||||
STY | store Y register in memory | 8C | 84 | 94 | ||||||
TAX | transfer accumulator to X register | AA | ||||||||
TAY | transfer accumulator to Y register | A8 | ||||||||
TSX | transfer stack pointer to X register | BA | ||||||||
TXA | transfer X register to accumulator | 8A | ||||||||
TXS | transfer X register to stack pointer | 9A | ||||||||
TYA | transfer Y register to accumulator | 98 |