Page 1 of 1

A convenient 6502 instruction set table for a script needed

Posted: Thu Oct 15, 2020 4:51 am
by JustClaire
I want to make a python script that would generate C code for a project i am working on because i dont want to fill all 6502 instructions by hand (not only instructions but also the opcodes, operand count, byte size, etc.) and i need a convenient instruction set table i can usse to feed the script that does not contain bloat like descriptions, etc.

Can somebody please post a link if you know of such a table?
So far all instruction set tables need additional formatting which i would like to avoid for the sake of sanity and not spending 2h typing or removing the same stuff. :?

Re: A convenient 6502 instruction set table for a script nee

Posted: Thu Oct 15, 2020 6:07 am
by Chromatix
Here's the best I have to hand, attached. Each cell can be read as a fixed-format text field, first four characters are the mnemonic, next three are the addressing mode, last is the base cycle count (there are some cases which increment these). You can infer from the addressing mode how many program bytes are needed:
  • Blank or A: 1 byte (opcode only)
  • imm, rel, zp, zpx, zpy, izp, izx, izy: 2 bytes (opcode and short operand)
  • abs, abx, aby, ind, iax: 3 bytes (opcode and long operand)
  • zpr: 3 bytes (opcode and two short operands)
Take note of the odd order they are listed in, for the most logical grouping. Add the top and left headers in hex for the opcode of any given cell.

This is for a 65C02 with all the goodies. NMOS is a bit different.

Re: A convenient 6502 instruction set table for a script nee

Posted: Thu Oct 15, 2020 7:02 am
by rwiker
That's a pretty nifty table! Maybe it could be added to the "Documents" section of the site?

Re: A convenient 6502 instruction set table for a script nee

Posted: Thu Oct 15, 2020 12:31 pm
by BillG
There are many opcode charts online.

I found this one the other day: https://www.masswerk.at/6502/6502_instruction_set.html

And this one for the Z80: https://clrhome.org/table/

Re: A convenient 6502 instruction set table for a script nee

Posted: Thu Oct 15, 2020 12:42 pm
by BigEd
This is the table I use
http://nparker.llx.com/a2/opcodes.html

(But I don't think it answers the OP's question.)

Re: A convenient 6502 instruction set table for a script nee

Posted: Fri Oct 16, 2020 10:40 am
by unclouded
Here's the opcode list for an as yet unreleased simulator I've been using:

https://war.rui.nz/tmp/65C02-opcodes.csv

It's just the instruction and the addressing mode, the logic for which are in the simulator.