Created
October 17, 2017 15:24
-
-
Save kirbyUK/1a0797e19f54c1e35e67ce7b385b323e to your computer and use it in GitHub Desktop.
6502 instruction set in JSON
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[ | |
{ | |
"bytes" : "2", | |
"description" : "Add with Carry", | |
"name" : "ADC", | |
"opcode" : "$69", | |
"mode" : "Immediate" | |
}, | |
{ | |
"opcode" : "$65", | |
"name" : "ADC", | |
"bytes" : "2", | |
"description" : "Add with Carry", | |
"mode" : "ZeroPage" | |
}, | |
{ | |
"description" : "Add with Carry", | |
"bytes" : "2", | |
"opcode" : "$75", | |
"name" : "ADC", | |
"mode" : "ZeroPage,X" | |
}, | |
{ | |
"name" : "ADC", | |
"opcode" : "$6D", | |
"bytes" : "3", | |
"description" : "Add with Carry", | |
"mode" : "Absolute" | |
}, | |
{ | |
"mode" : "Absolute,X", | |
"name" : "ADC", | |
"opcode" : "$7D", | |
"bytes" : "3", | |
"description" : "Add with Carry" | |
}, | |
{ | |
"mode" : "Absolute,Y", | |
"name" : "ADC", | |
"opcode" : "$79", | |
"description" : "Add with Carry", | |
"bytes" : "3" | |
}, | |
{ | |
"mode" : "(Indirect,X)", | |
"description" : "Add with Carry", | |
"bytes" : "2", | |
"opcode" : "$61", | |
"name" : "ADC" | |
}, | |
{ | |
"mode" : "(Indirect),Y", | |
"bytes" : "2", | |
"description" : "Add with Carry", | |
"name" : "ADC", | |
"opcode" : "$71" | |
}, | |
{ | |
"bytes" : "2", | |
"description" : "Logical AND", | |
"name" : "AND", | |
"opcode" : "$29", | |
"mode" : "Immediate" | |
}, | |
{ | |
"mode" : "ZeroPage", | |
"name" : "AND", | |
"opcode" : "$25", | |
"bytes" : "2", | |
"description" : "Logical AND" | |
}, | |
{ | |
"bytes" : "2", | |
"description" : "Logical AND", | |
"name" : "AND", | |
"opcode" : "$35", | |
"mode" : "ZeroPage,X" | |
}, | |
{ | |
"mode" : "Absolute", | |
"opcode" : "$2D", | |
"name" : "AND", | |
"description" : "Logical AND", | |
"bytes" : "3" | |
}, | |
{ | |
"description" : "Logical AND", | |
"bytes" : "3", | |
"name" : "AND", | |
"opcode" : "$3D", | |
"mode" : "Absolute,X" | |
}, | |
{ | |
"mode" : "Absolute,Y", | |
"bytes" : "3", | |
"description" : "Logical AND", | |
"opcode" : "$39", | |
"name" : "AND" | |
}, | |
{ | |
"description" : "Logical AND", | |
"bytes" : "2", | |
"opcode" : "$21", | |
"name" : "AND", | |
"mode" : "(Indirect,X)" | |
}, | |
{ | |
"name" : "AND", | |
"opcode" : "$31", | |
"description" : "Logical AND", | |
"bytes" : "2", | |
"mode" : "(Indirect),Y" | |
}, | |
{ | |
"description" : "Arithmetic Shift Left", | |
"bytes" : "1", | |
"opcode" : "$0A", | |
"name" : "ASL", | |
"mode" : "Accumulator" | |
}, | |
{ | |
"opcode" : "$06", | |
"name" : "ASL", | |
"bytes" : "2", | |
"description" : "Arithmetic Shift Left", | |
"mode" : "ZeroPage" | |
}, | |
{ | |
"description" : "Arithmetic Shift Left", | |
"bytes" : "2", | |
"name" : "ASL", | |
"opcode" : "$16", | |
"mode" : "ZeroPage,X" | |
}, | |
{ | |
"mode" : "Absolute", | |
"description" : "Arithmetic Shift Left", | |
"bytes" : "3", | |
"name" : "ASL", | |
"opcode" : "$0E" | |
}, | |
{ | |
"mode" : "Absolute,X", | |
"description" : "Arithmetic Shift Left", | |
"bytes" : "3", | |
"name" : "ASL", | |
"opcode" : "$1E" | |
}, | |
{ | |
"mode" : "Relative", | |
"bytes" : "2", | |
"description" : "Branch if Carry Clear", | |
"opcode" : "$90", | |
"name" : "BCC" | |
}, | |
{ | |
"mode" : "Relative", | |
"bytes" : "2", | |
"description" : "Branch if Carry Set", | |
"name" : "BCS", | |
"opcode" : "$B0" | |
}, | |
{ | |
"bytes" : "2", | |
"description" : "Branch if Equal", | |
"name" : "BEQ", | |
"opcode" : "$F0", | |
"mode" : "Relative" | |
}, | |
{ | |
"opcode" : "$24", | |
"name" : "BIT", | |
"bytes" : "2", | |
"description" : "Bit Test", | |
"mode" : "ZeroPage" | |
}, | |
{ | |
"mode" : "Absolute", | |
"description" : "Bit Test", | |
"bytes" : "3", | |
"name" : "BIT", | |
"opcode" : "$2C" | |
}, | |
{ | |
"mode" : "Relative", | |
"description" : "Branch if Minus", | |
"bytes" : "2", | |
"name" : "BMI", | |
"opcode" : "$30" | |
}, | |
{ | |
"opcode" : "$D0", | |
"name" : "BNE", | |
"description" : "Branch if Not Equal", | |
"bytes" : "2", | |
"mode" : "Relative" | |
}, | |
{ | |
"mode" : "Relative", | |
"opcode" : "$10", | |
"name" : "BPL", | |
"description" : "Branch if Positive", | |
"bytes" : "2" | |
}, | |
{ | |
"name" : "BRK", | |
"opcode" : "$00", | |
"description" : "Force Interrupt", | |
"bytes" : "1", | |
"mode" : "Implied" | |
}, | |
{ | |
"mode" : "Relative", | |
"description" : "Branch if Overflow Clear", | |
"bytes" : "2", | |
"opcode" : "$50", | |
"name" : "BVC" | |
}, | |
{ | |
"mode" : "Relative", | |
"description" : "Branch if Overflow Set", | |
"bytes" : "2", | |
"name" : "BVS", | |
"opcode" : "$70" | |
}, | |
{ | |
"mode" : "Implied", | |
"opcode" : "$18", | |
"name" : "CLC", | |
"bytes" : "1", | |
"description" : "Clear Carry Flag" | |
}, | |
{ | |
"bytes" : "1", | |
"description" : "Clear Decimal Mode", | |
"name" : "CLD", | |
"opcode" : "$D8", | |
"mode" : "Implied" | |
}, | |
{ | |
"mode" : "Implied", | |
"bytes" : "1", | |
"description" : "Clear Interrupt Disable", | |
"opcode" : "$58", | |
"name" : "CLI" | |
}, | |
{ | |
"mode" : "Implied", | |
"description" : "Clear Overflow Flag", | |
"bytes" : "1", | |
"opcode" : "$B8", | |
"name" : "CLV" | |
}, | |
{ | |
"opcode" : "$C9", | |
"name" : "CMP", | |
"bytes" : "2", | |
"description" : "Compare", | |
"mode" : "Immediate" | |
}, | |
{ | |
"mode" : "ZeroPage", | |
"bytes" : "2", | |
"description" : "Compare", | |
"opcode" : "$C5", | |
"name" : "CMP" | |
}, | |
{ | |
"opcode" : "$D5", | |
"name" : "CMP", | |
"bytes" : "2", | |
"description" : "Compare", | |
"mode" : "ZeroPage,X" | |
}, | |
{ | |
"mode" : "Absolute", | |
"opcode" : "$CD", | |
"name" : "CMP", | |
"bytes" : "3", | |
"description" : "Compare" | |
}, | |
{ | |
"name" : "CMP", | |
"opcode" : "$DD", | |
"bytes" : "3", | |
"description" : "Compare", | |
"mode" : "Absolute,X" | |
}, | |
{ | |
"opcode" : "$D9", | |
"name" : "CMP", | |
"bytes" : "3", | |
"description" : "Compare", | |
"mode" : "Absolute,Y" | |
}, | |
{ | |
"name" : "CMP", | |
"opcode" : "$C1", | |
"bytes" : "2", | |
"description" : "Compare", | |
"mode" : "(Indirect,X)" | |
}, | |
{ | |
"name" : "CMP", | |
"opcode" : "$D1", | |
"bytes" : "2", | |
"description" : "Compare", | |
"mode" : "(Indirect),Y" | |
}, | |
{ | |
"mode" : "Immediate", | |
"name" : "CPX", | |
"opcode" : "$E0", | |
"description" : "Compare X Register", | |
"bytes" : "2" | |
}, | |
{ | |
"mode" : "ZeroPage", | |
"bytes" : "2", | |
"description" : "Compare X Register", | |
"opcode" : "$E4", | |
"name" : "CPX" | |
}, | |
{ | |
"mode" : "Absolute", | |
"description" : "Compare X Register", | |
"bytes" : "3", | |
"name" : "CPX", | |
"opcode" : "$EC" | |
}, | |
{ | |
"mode" : "Immediate", | |
"name" : "CPY", | |
"opcode" : "$C0", | |
"bytes" : "2", | |
"description" : "Compare Y Register" | |
}, | |
{ | |
"opcode" : "$C4", | |
"name" : "CPY", | |
"bytes" : "2", | |
"description" : "Compare Y Register", | |
"mode" : "ZeroPage" | |
}, | |
{ | |
"bytes" : "3", | |
"description" : "Compare Y Register", | |
"name" : "CPY", | |
"opcode" : "$CC", | |
"mode" : "Absolute" | |
}, | |
{ | |
"bytes" : "2", | |
"description" : "Decrement Memory", | |
"name" : "DEC", | |
"opcode" : "$C6", | |
"mode" : "ZeroPage" | |
}, | |
{ | |
"opcode" : "$D6", | |
"name" : "DEC", | |
"description" : "Decrement Memory", | |
"bytes" : "2", | |
"mode" : "ZeroPage,X" | |
}, | |
{ | |
"bytes" : "3", | |
"description" : "Decrement Memory", | |
"name" : "DEC", | |
"opcode" : "$CE", | |
"mode" : "Absolute" | |
}, | |
{ | |
"name" : "DEC", | |
"opcode" : "$DE", | |
"description" : "Decrement Memory", | |
"bytes" : "3", | |
"mode" : "Absolute,X" | |
}, | |
{ | |
"description" : "Decrement X Register", | |
"bytes" : "1", | |
"name" : "DEX", | |
"opcode" : "$CA", | |
"mode" : "Implied" | |
}, | |
{ | |
"mode" : "Implied", | |
"bytes" : "1", | |
"description" : "Decrement Y Register", | |
"opcode" : "$88", | |
"name" : "DEY" | |
}, | |
{ | |
"opcode" : "$49", | |
"name" : "EOR", | |
"description" : "Exclusive OR", | |
"bytes" : "2", | |
"mode" : "Immediate" | |
}, | |
{ | |
"opcode" : "$45", | |
"name" : "EOR", | |
"bytes" : "2", | |
"description" : "Exclusive OR", | |
"mode" : "ZeroPage" | |
}, | |
{ | |
"mode" : "ZeroPage,X", | |
"bytes" : "2", | |
"description" : "Exclusive OR", | |
"name" : "EOR", | |
"opcode" : "$55" | |
}, | |
{ | |
"mode" : "Absolute", | |
"name" : "EOR", | |
"opcode" : "$4D", | |
"bytes" : "3", | |
"description" : "Exclusive OR" | |
}, | |
{ | |
"description" : "Exclusive OR", | |
"bytes" : "3", | |
"name" : "EOR", | |
"opcode" : "$5D", | |
"mode" : "Absolute,X" | |
}, | |
{ | |
"mode" : "Absolute,Y", | |
"name" : "EOR", | |
"opcode" : "$59", | |
"description" : "Exclusive OR", | |
"bytes" : "3" | |
}, | |
{ | |
"mode" : "(Indirect,X)", | |
"description" : "Exclusive OR", | |
"bytes" : "2", | |
"name" : "EOR", | |
"opcode" : "$41" | |
}, | |
{ | |
"mode" : "(Indirect),Y", | |
"bytes" : "2", | |
"description" : "Exclusive OR", | |
"opcode" : "$51", | |
"name" : "EOR" | |
}, | |
{ | |
"bytes" : "2", | |
"description" : "Increment Memory", | |
"name" : "INC", | |
"opcode" : "$E6", | |
"mode" : "ZeroPage" | |
}, | |
{ | |
"opcode" : "$F6", | |
"name" : "INC", | |
"description" : "Increment Memory", | |
"bytes" : "2", | |
"mode" : "ZeroPage,X" | |
}, | |
{ | |
"mode" : "Absolute", | |
"bytes" : "3", | |
"description" : "Increment Memory", | |
"opcode" : "$EE", | |
"name" : "INC" | |
}, | |
{ | |
"opcode" : "$FE", | |
"name" : "INC", | |
"bytes" : "3", | |
"description" : "Increment Memory", | |
"mode" : "Absolute,X" | |
}, | |
{ | |
"mode" : "Implied", | |
"opcode" : "$E8", | |
"name" : "INX", | |
"description" : "Increment X Register", | |
"bytes" : "1" | |
}, | |
{ | |
"description" : "Increment Y Register", | |
"bytes" : "1", | |
"name" : "INY", | |
"opcode" : "$C8", | |
"mode" : "Implied" | |
}, | |
{ | |
"mode" : "Absolute", | |
"description" : "Jump", | |
"bytes" : "3", | |
"name" : "JMP", | |
"opcode" : "$4C" | |
}, | |
{ | |
"mode" : "Indirect ", | |
"opcode" : "$6C", | |
"name" : "JMP", | |
"description" : "Jump", | |
"bytes" : "3" | |
}, | |
{ | |
"mode" : "Absolute", | |
"name" : "JSR", | |
"opcode" : "$20", | |
"description" : "Jump to Subroutine", | |
"bytes" : "3" | |
}, | |
{ | |
"description" : "Load Accumulator", | |
"bytes" : "2", | |
"name" : "LDA", | |
"opcode" : "$A9", | |
"mode" : "Immediate" | |
}, | |
{ | |
"mode" : "ZeroPage", | |
"name" : "LDA", | |
"opcode" : "$A5", | |
"bytes" : "2", | |
"description" : "Load Accumulator" | |
}, | |
{ | |
"opcode" : "$B5", | |
"name" : "LDA", | |
"description" : "Load Accumulator", | |
"bytes" : "2", | |
"mode" : "ZeroPage,X" | |
}, | |
{ | |
"name" : "LDA", | |
"opcode" : "$AD", | |
"bytes" : "3", | |
"description" : "Load Accumulator", | |
"mode" : "Absolute" | |
}, | |
{ | |
"mode" : "Absolute,X", | |
"bytes" : "3", | |
"description" : "Load Accumulator", | |
"opcode" : "$BD", | |
"name" : "LDA" | |
}, | |
{ | |
"mode" : "Absolute,Y", | |
"name" : "LDA", | |
"opcode" : "$B9", | |
"bytes" : "3", | |
"description" : "Load Accumulator" | |
}, | |
{ | |
"opcode" : "$A1", | |
"name" : "LDA", | |
"description" : "Load Accumulator", | |
"bytes" : "2", | |
"mode" : "(Indirect,X)" | |
}, | |
{ | |
"mode" : "(Indirect),Y", | |
"name" : "LDA", | |
"opcode" : "$B1", | |
"description" : "Load Accumulator", | |
"bytes" : "2" | |
}, | |
{ | |
"description" : "Load X Register", | |
"bytes" : "2", | |
"name" : "LDX", | |
"opcode" : "$A2", | |
"mode" : "Immediate" | |
}, | |
{ | |
"description" : "Load X Register", | |
"bytes" : "2", | |
"name" : "LDX", | |
"opcode" : "$A6", | |
"mode" : "ZeroPage" | |
}, | |
{ | |
"description" : "Load X Register", | |
"bytes" : "2", | |
"name" : "LDX", | |
"opcode" : "$B6", | |
"mode" : "ZeroPage,Y" | |
}, | |
{ | |
"mode" : "Absolute", | |
"opcode" : "$AE", | |
"name" : "LDX", | |
"bytes" : "3", | |
"description" : "Load X Register" | |
}, | |
{ | |
"bytes" : "3", | |
"description" : "Load X Register", | |
"name" : "LDX", | |
"opcode" : "$BE", | |
"mode" : "Absolute,Y" | |
}, | |
{ | |
"mode" : "Immediate", | |
"opcode" : "$A0", | |
"name" : "LDY", | |
"description" : "Load Y Register", | |
"bytes" : "2" | |
}, | |
{ | |
"name" : "LDY", | |
"opcode" : "$A4", | |
"bytes" : "2", | |
"description" : "Load Y Register", | |
"mode" : "ZeroPage" | |
}, | |
{ | |
"description" : "Load Y Register", | |
"bytes" : "2", | |
"name" : "LDY", | |
"opcode" : "$B4", | |
"mode" : "ZeroPage,X" | |
}, | |
{ | |
"name" : "LDY", | |
"opcode" : "$AC", | |
"description" : "Load Y Register", | |
"bytes" : "3", | |
"mode" : "Absolute" | |
}, | |
{ | |
"bytes" : "3", | |
"description" : "Load Y Register", | |
"name" : "LDY", | |
"opcode" : "$BC", | |
"mode" : "Absolute,X" | |
}, | |
{ | |
"mode" : "Accumulator", | |
"description" : "Logical Shift Right", | |
"bytes" : "1", | |
"opcode" : "$4A", | |
"name" : "LSR" | |
}, | |
{ | |
"mode" : "ZeroPage", | |
"name" : "LSR", | |
"opcode" : "$46", | |
"description" : "Logical Shift Right", | |
"bytes" : "2" | |
}, | |
{ | |
"mode" : "ZeroPage,X", | |
"description" : "Logical Shift Right", | |
"bytes" : "2", | |
"name" : "LSR", | |
"opcode" : "$56" | |
}, | |
{ | |
"mode" : "Absolute", | |
"opcode" : "$4E", | |
"name" : "LSR", | |
"description" : "Logical Shift Right", | |
"bytes" : "3" | |
}, | |
{ | |
"mode" : "Absolute,X", | |
"name" : "LSR", | |
"opcode" : "$5E", | |
"description" : "Logical Shift Right", | |
"bytes" : "3" | |
}, | |
{ | |
"mode" : "Implied", | |
"description" : "No Operation", | |
"bytes" : "1", | |
"opcode" : "$EA", | |
"name" : "NOP" | |
}, | |
{ | |
"name" : "ORA", | |
"opcode" : "$09", | |
"bytes" : "2", | |
"description" : "Logical Inclusive OR", | |
"mode" : "Immediate" | |
}, | |
{ | |
"opcode" : "$05", | |
"name" : "ORA", | |
"description" : "Logical Inclusive OR", | |
"bytes" : "2", | |
"mode" : "ZeroPage" | |
}, | |
{ | |
"mode" : "ZeroPage,X", | |
"opcode" : "$15", | |
"name" : "ORA", | |
"description" : "Logical Inclusive OR", | |
"bytes" : "2" | |
}, | |
{ | |
"opcode" : "$0D", | |
"name" : "ORA", | |
"bytes" : "3", | |
"description" : "Logical Inclusive OR", | |
"mode" : "Absolute" | |
}, | |
{ | |
"mode" : "Absolute,X", | |
"description" : "Logical Inclusive OR", | |
"bytes" : "3", | |
"name" : "ORA", | |
"opcode" : "$1D" | |
}, | |
{ | |
"mode" : "Absolute,Y", | |
"description" : "Logical Inclusive OR", | |
"bytes" : "3", | |
"name" : "ORA", | |
"opcode" : "$19" | |
}, | |
{ | |
"mode" : "(Indirect,X)", | |
"bytes" : "2", | |
"description" : "Logical Inclusive OR", | |
"name" : "ORA", | |
"opcode" : "$01" | |
}, | |
{ | |
"mode" : "(Indirect),Y", | |
"description" : "Logical Inclusive OR", | |
"bytes" : "2", | |
"opcode" : "$11", | |
"name" : "ORA" | |
}, | |
{ | |
"opcode" : "$48", | |
"name" : "PHA", | |
"bytes" : "1", | |
"description" : "Push Accumulator", | |
"mode" : "Implied" | |
}, | |
{ | |
"mode" : "Implied", | |
"opcode" : "$08", | |
"name" : "PHP", | |
"description" : "Push Processor Status", | |
"bytes" : "1" | |
}, | |
{ | |
"mode" : "Implied", | |
"bytes" : "1", | |
"description" : "Pull Accumulator", | |
"name" : "PLA", | |
"opcode" : "$68" | |
}, | |
{ | |
"description" : "Pull Processor Status", | |
"bytes" : "1", | |
"opcode" : "$28", | |
"name" : "PLP", | |
"mode" : "Implied" | |
}, | |
{ | |
"mode" : "Accumulator", | |
"name" : "ROL", | |
"opcode" : "$2A", | |
"bytes" : "1", | |
"description" : "Rotate Left" | |
}, | |
{ | |
"mode" : "ZeroPage", | |
"description" : "Rotate Left", | |
"bytes" : "2", | |
"opcode" : "$26", | |
"name" : "ROL" | |
}, | |
{ | |
"bytes" : "2", | |
"description" : "Rotate Left", | |
"opcode" : "$36", | |
"name" : "ROL", | |
"mode" : "ZeroPage,X" | |
}, | |
{ | |
"bytes" : "3", | |
"description" : "Rotate Left", | |
"name" : "ROL", | |
"opcode" : "$2E", | |
"mode" : "Absolute" | |
}, | |
{ | |
"name" : "ROL", | |
"opcode" : "$3E", | |
"bytes" : "3", | |
"description" : "Rotate Left", | |
"mode" : "Absolute,X" | |
}, | |
{ | |
"name" : "ROR", | |
"opcode" : "$6A", | |
"description" : "Rotate Right", | |
"bytes" : "1", | |
"mode" : "Accumulator" | |
}, | |
{ | |
"bytes" : "2", | |
"description" : "Rotate Right", | |
"opcode" : "$66", | |
"name" : "ROR", | |
"mode" : "ZeroPage" | |
}, | |
{ | |
"mode" : "ZeroPage,X", | |
"opcode" : "$76", | |
"name" : "ROR", | |
"bytes" : "2", | |
"description" : "Rotate Right" | |
}, | |
{ | |
"mode" : "Absolute", | |
"bytes" : "3", | |
"description" : "Rotate Right", | |
"name" : "ROR", | |
"opcode" : "$6E" | |
}, | |
{ | |
"mode" : "Absolute,X", | |
"description" : "Rotate Right", | |
"bytes" : "3", | |
"name" : "ROR", | |
"opcode" : "$7E" | |
}, | |
{ | |
"mode" : "Implied", | |
"bytes" : "1", | |
"description" : "Return from Interrupt", | |
"opcode" : "$40", | |
"name" : "RTI" | |
}, | |
{ | |
"mode" : "Implied", | |
"name" : "RTS", | |
"opcode" : "$60", | |
"description" : "Return from Subroutine", | |
"bytes" : "1" | |
}, | |
{ | |
"bytes" : "2", | |
"description" : "Subtract with Carry", | |
"opcode" : "$E9", | |
"name" : "SBC", | |
"mode" : "Immediate" | |
}, | |
{ | |
"name" : "SBC", | |
"opcode" : "$E5", | |
"bytes" : "2", | |
"description" : "Subtract with Carry", | |
"mode" : "ZeroPage" | |
}, | |
{ | |
"description" : "Subtract with Carry", | |
"bytes" : "2", | |
"name" : "SBC", | |
"opcode" : "$F5", | |
"mode" : "ZeroPage,X" | |
}, | |
{ | |
"name" : "SBC", | |
"opcode" : "$ED", | |
"description" : "Subtract with Carry", | |
"bytes" : "3", | |
"mode" : "Absolute" | |
}, | |
{ | |
"opcode" : "$FD", | |
"name" : "SBC", | |
"description" : "Subtract with Carry", | |
"bytes" : "3", | |
"mode" : "Absolute,X" | |
}, | |
{ | |
"mode" : "Absolute,Y", | |
"opcode" : "$F9", | |
"name" : "SBC", | |
"bytes" : "3", | |
"description" : "Subtract with Carry" | |
}, | |
{ | |
"mode" : "(Indirect,X)", | |
"opcode" : "$E1", | |
"name" : "SBC", | |
"description" : "Subtract with Carry", | |
"bytes" : "2" | |
}, | |
{ | |
"bytes" : "2", | |
"description" : "Subtract with Carry", | |
"name" : "SBC", | |
"opcode" : "$F1", | |
"mode" : "(Indirect),Y" | |
}, | |
{ | |
"description" : "Set Carry Flag", | |
"bytes" : "1", | |
"name" : "SEC", | |
"opcode" : "$38", | |
"mode" : "Implied" | |
}, | |
{ | |
"name" : "SED", | |
"opcode" : "$F8", | |
"description" : "Set Decimal Flag", | |
"bytes" : "1", | |
"mode" : "Implied" | |
}, | |
{ | |
"mode" : "Implied", | |
"opcode" : "$78", | |
"name" : "SEI", | |
"bytes" : "1", | |
"description" : "Set Interrupt Disable" | |
}, | |
{ | |
"description" : "Store Accumulator", | |
"bytes" : "2", | |
"name" : "STA", | |
"opcode" : "$85", | |
"mode" : "ZeroPage" | |
}, | |
{ | |
"mode" : "ZeroPage,X", | |
"bytes" : "2", | |
"description" : "Store Accumulator", | |
"name" : "STA", | |
"opcode" : "$95" | |
}, | |
{ | |
"mode" : "Absolute", | |
"opcode" : "$8D", | |
"name" : "STA", | |
"description" : "Store Accumulator", | |
"bytes" : "3" | |
}, | |
{ | |
"bytes" : "3", | |
"description" : "Store Accumulator", | |
"opcode" : "$9D", | |
"name" : "STA", | |
"mode" : "Absolute,X" | |
}, | |
{ | |
"bytes" : "3", | |
"description" : "Store Accumulator", | |
"name" : "STA", | |
"opcode" : "$99", | |
"mode" : "Absolute,Y" | |
}, | |
{ | |
"mode" : "(Indirect,X)", | |
"description" : "Store Accumulator", | |
"bytes" : "2", | |
"name" : "STA", | |
"opcode" : "$81" | |
}, | |
{ | |
"bytes" : "2", | |
"description" : "Store Accumulator", | |
"opcode" : "$91", | |
"name" : "STA", | |
"mode" : "(Indirect),Y" | |
}, | |
{ | |
"bytes" : "2", | |
"description" : "Store X Register", | |
"name" : "STX", | |
"opcode" : "$86", | |
"mode" : "ZeroPage" | |
}, | |
{ | |
"mode" : "ZeroPage,Y", | |
"name" : "STX", | |
"opcode" : "$96", | |
"bytes" : "2", | |
"description" : "Store X Register" | |
}, | |
{ | |
"mode" : "Absolute", | |
"name" : "STX", | |
"opcode" : "$8E", | |
"bytes" : "3", | |
"description" : "Store X Register" | |
}, | |
{ | |
"mode" : "ZeroPage", | |
"name" : "STY", | |
"opcode" : "$84", | |
"description" : "Store Y Register", | |
"bytes" : "2" | |
}, | |
{ | |
"mode" : "ZeroPage,X", | |
"name" : "STY", | |
"opcode" : "$94", | |
"bytes" : "2", | |
"description" : "Store Y Register" | |
}, | |
{ | |
"bytes" : "3", | |
"description" : "Store Y Register", | |
"name" : "STY", | |
"opcode" : "$8C", | |
"mode" : "Absolute" | |
}, | |
{ | |
"mode" : "Implied", | |
"name" : "TAX", | |
"opcode" : "$AA", | |
"description" : "Transfer Accumulator to X", | |
"bytes" : "1" | |
}, | |
{ | |
"mode" : "Implied", | |
"description" : "Transfer Accumulator to Y", | |
"bytes" : "1", | |
"name" : "TAY", | |
"opcode" : "$A8" | |
}, | |
{ | |
"mode" : "Implied", | |
"bytes" : "1", | |
"description" : "Transfer Stack Pointer to X", | |
"name" : "TSX", | |
"opcode" : "$BA" | |
}, | |
{ | |
"mode" : "Implied", | |
"bytes" : "1", | |
"description" : "Transfer X to Accumulator", | |
"opcode" : "$8A", | |
"name" : "TXA" | |
}, | |
{ | |
"description" : "Transfer X to Stack Pointer", | |
"bytes" : "1", | |
"name" : "TXS", | |
"opcode" : "$9A", | |
"mode" : "Implied" | |
}, | |
{ | |
"mode" : "Implied", | |
"description" : "Transfer Y to Accumulator", | |
"bytes" : "1", | |
"name" : "TYA", | |
"opcode" : "$98" | |
} | |
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/perl -w | |
use JSON; | |
use HTML::TableExtract; | |
use LWP::Simple; | |
use strict; | |
# Download the file if needed | |
my $reference = "reference.html"; | |
if (! -f $reference) | |
{ | |
my $url = "http://www.obelisk.me.uk/6502/reference.html"; | |
getstore($url, $reference); | |
} | |
my $html; | |
{ | |
local $/; | |
open my $file, '<', $reference or die "Cannot open '$reference': $!\n"; | |
$html = <$file>; | |
close $file; | |
} | |
# Get the instructions and their descriptions from H3 tags | |
my @headers; | |
while ($html =~ m{<H3><A NAME="([A-Z]{3})"></A>\1 - (.*)</H3>}g) | |
{ | |
push @headers, { "name" => "$1", "description" => "$2" }; | |
} | |
# Parse the tables to gain information about individual instructions | |
my @instructions; | |
my $i = 0; | |
my $te = HTML::TableExtract->new("headers" => [ "Addressing Mode", "Opcode", "Bytes", "Cycles" ]); | |
$te->parse($html); | |
for my $ts ($te->tables) | |
{ | |
for my $row ($ts->rows) | |
{ | |
s/[\n\s]//g for (@{$row}); | |
push @instructions, { | |
"name" => $headers[$i]->{"name"}, | |
"description" => $headers[$i]->{"description"}, | |
"mode" => ${$row}[0], | |
"opcode" => ${$row}[1], | |
"bytes" => ${$row}[2], | |
}; | |
} | |
$i++; | |
} | |
my $json = JSON->new(); | |
print $json->pretty->encode(\@instructions); |
Thanx, it's really helpful
thx
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I've more than once needed the 6502 instruction set in a machine-readable format, typically to generate code because I'm lazy. Thought someone else might find it a tad useful. It's literally just this reference parsed through some Perl