User Tools

Site Tools


6502/6510 Coding

This section contains articles on programming the 6502/6510 processors in general. The information here is not primarily focused on coding graphics, sound or IO stuff, but covers instead operations of various opcodes and about speed/memory optimization and so on.

Machine-code and Assembly-language

  • Beginners guide - Part 1 - Beginners guide to machine-code and assembly-language for the 6510 by Rudi B. Stranden
  • Machine language tutorial - An incomplete series about 6510 machine language written by Karmic/HVSC.
  • TurboAssembler 5.2 (Bacchus Version) — This may be useful if you plan to code on the C64 itself. Reference document by Bacchus/FLT.
  • HeyMon - If all else fails, here's an 86-line BASIC monitor to type in, with assembler and disassembler, by White Flame.

Instruction set and Addressing modes

This section should contain info on the instruction set of the 6502 and 6510, addressing modes, cycle tables, illegal opcodes, timings pinout, etc.

General Documentation

  • c64doc - detailed specification of opcodes & memory handling, by John West and Marko Mäkelä
  • Opcodes and Quasi-opcodes - by Craig Taylor from C=Hacking #1

In general external links should be avoided in the “base” section of this wiki, but the following two links to references of opcodes (including the “illegal” ones) are suitable here:

Definitions of constants for Mnemonic to Opcode correspondence

This section contains two lists of constant definitions without meta information for inclusion in your assembler code. The first list includes only the legal opcodes, whereas the second list includes also the illegal ones. The lists were checked against Grahams table, which seems to be error free in contrast to other sources (For example the Commodore Hacking list).

General tutorials

  • Tutorials by Craig Bruce, from C= Hacking:

Illegal opcodes

In addition to the standard opcodes available in 6502, the 6510 CPU of the C64 also have a few undocumented opcodes. Some of them are possible to use in a productive way and this section contains some info on this. Note that the fact that these opcodes are not official ones has resulted in a situation where there is no real naming convention. Thus you will find that the same illegal opcode will have a range of different names in different documents.

Illegal opcode tricks

A collection articles and routines that exemplify particular aspects of some illegal opcode.

The Addresses 00 and 01

These two addresses are used for (among other things) settings up the memory layout of the C64. These are the only differences between a 6502 and a 6510 (besides the Tri-State Bus, which is needed to cooperate with the Video Chip)

General stuff

base/6502_6510_coding.txt · Last modified: 2023-10-20 08:14 by white_flame