Description #
6502 Assembly is the machine-level programming language for the MOS Technology 6502 microprocessor, used in many early home computers and game consoles. It is simple, efficient, and ideal for resource-constrained environments.
History #
The 6502 processor was introduced in 1975 and powered iconic systems like the Apple II, Commodore 64, Atari 2600, and Nintendo Entertainment System (NES). Its assembly language features a small, efficient instruction set optimized for 8-bit architecture.
Hello World Code #
(Note: 6502 has no built-in output, so “Hello, World!” programs usually output characters to memory-mapped I/O, e.g., on a Commodore 64. This example is a conceptual print routine.)
LDX #0 ; X = 0 (string index)
loop:
LDA message,X ; Load byte from message
BEQ done ; If zero byte, end
JSR $FFD2 ; Call C64 KERNAL print routine
INX ; Increment index
JMP loop ; Loop
done:
RTS ; Return
message:
.ascii "HELLO, WORLD!"
.byte 0
How to Run #
Option 1: Online
Try 6502 assembly with Easy 6502.
Option 2: Local
- Use assemblers like ca65
- Use emulators for target hardware (VICE for Commodore 64)
Key Concepts #
- 8-bit architecture with simple instruction set
- Uses registers A (accumulator), X, and Y
- Memory-mapped I/O for devices
- Limited addressing modes (immediate, zero page, absolute)
- Efficient use in low-memory systems
- Popular in early home computing and game development
- Supports interrupts and hardware timers
- Strong community for retro computing and emulation
- Assembly programming requires detailed hardware knowledge
- Still used today for hobbyist projects and embedded systems
Try It Online #
Fun Facts #
- The 6502 was incredibly cheap compared to competitors at its release, helping democratize computing.
- The NES used a custom 6502 variant without decimal mode.
- The Apple II was one of the first highly successful personal computers using 6502.
- 6502 code is still written by retro computing enthusiasts and in educational contexts.
- The instruction set inspired many later 8-bit microprocessors.