playground
6502 in your browser
Write 6502 assembly, hit Run, and watch it execute. The CPU is a from-scratch C++ emulator compiled to WebAssembly; the assembler is TypeScript running right here on the page. Nothing leaves your browser.
Console $FF00 out · $FF01/$FF02 in
Registers
- A
- 00
- X
- 00
- Y
- 00
- SP
- FD
- PC
- 0000
- Cycles
- 0
NV-BDIZC
Memory
Assembly listing & symbols
Quick reference
Syntax
; comment
ORG $0600 ; where code goes (default $0200)
LIMIT = 10 ; constant
loop: LDA #LIMIT
STA $10,X
BNE loop
.byte 1, "hi", 0
.word $1234
.fill 4, $FFNumbers: $FF%101042'A'. Operators:+ - * / & | ^ << >>, plus <label / >labelfor the low / high byte. Execution stops when an instruction jumps to itself (JMP *).
Devices
| Address | What |
|---|---|
$FF00 | Write a byte: shows in the console |
$FF01 | Read: bit 0 set if a key is waiting |
$FF02 | Read: next key (0 if none) |
$FF10–11 | Timer reload value (lo, hi) |
$FF12 | Timer control: bit 0 enable, bit 1 periodic |
$FF13 | Timer status; any write acknowledges the IRQ |
The IRQ vector lives at $FFFE: put .word handler there under anORG $FFFE. The Timer example does exactly this.