A convenient 6502 instruction set table for a script needed

Let's talk about anything related to the 6502 microprocessor.
Post Reply
JustClaire
Posts: 18
Joined: 27 Feb 2020

A convenient 6502 instruction set table for a script needed

Post 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. :?
Chromatix
Posts: 1462
Joined: 21 May 2018

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

Post 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.
Attachments
65C02 opcodes.csv
(2.77 KiB) Downloaded 158 times
Screen Shot 2020-10-15 at 9.02.38 am.png
Last edited by Chromatix on Thu Oct 15, 2020 12:38 pm, edited 1 time in total.
rwiker
Posts: 294
Joined: 03 Mar 2011

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

Post by rwiker »

That's a pretty nifty table! Maybe it could be added to the "Documents" section of the site?
BillG
Posts: 710
Joined: 12 Mar 2020
Location: North Tejas

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

Post 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/
User avatar
BigEd
Posts: 11463
Joined: 11 Dec 2008
Location: England
Contact:

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

Post 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.)
unclouded
Posts: 81
Joined: 24 Feb 2015

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

Post 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.
Post Reply