离线模式
漫林
今日觉察
Free tools

6502 Emulator & Assembler

Type 6502 assembly and press Run: it is assembled and runs on a 32×32 colour screen with keyboard input. Step one instruction at a time, set breakpoints and watch the registers, flags and memory change.

Open 6502 Emulator →

How to use the 6502 emulator

Write or pick a program

Type 6502 assembly in the editor or choose an example such as Snake, Colour bars or the maths demo. Programs start at $0600.

Run it

Press Run (or Ctrl/⌘+Enter). The code is assembled; mistakes are listed with their line numbers. Click the screen to send keys to the program.

Debug it

Pause, step one instruction at a time and click a line number to set a breakpoint. Watch the registers, flags, memory and disassembly as it runs.

6502 tips for beginners

The screen is memory

Each byte from $0200 to $05FF is one pixel, 32 per row. STA $0200 colours the top-left pixel; add $20 to move down one row.

Zero page is fast

Addresses $00–$FF take one byte to name and one cycle less to read. Keep counters and pointers there.

Pointers use (zp),Y

Store a 16-bit address in two zero-page bytes, low byte first, then LDA ($10),Y reads from that address plus Y. The Snake and pattern examples use this to walk the screen.

Carry before maths

ADC adds the carry too, so start an addition with CLC and a subtraction with SEC. Branches like BCC and BCS test the carry afterwards.

Decimal mode

After SED, ADC and SBC count in decimal: $58 + $46 gives $04 with the carry set (104). Handy for scores; turn it off again with CLD.

Read the flags

Every load and arithmetic instruction updates N and Z. Step through a loop and watch them change before the branch that tests them.

Manlin services

Make space for what matters

Use Manlin to reflect, plan and take your next step.

Manlin Life OS: a path from awareness to action

6502 emulator FAQ

Is this 6502 emulator free?

Yes. It is free with no sign-up, no ads and no limits. Your program is saved in your browser so it is still there next time.

Which 6502 does it emulate?

The original NMOS 6502 with all 151 documented instructions, binary-coded decimal mode with the NMOS flag behaviour, the JMP ($xxFF) page bug and the documented cycle counts, including page-crossing and branch penalties.

How accurate is it?

It passes a widely used 6502 functional test program and 1.5 million single-instruction test cases that check registers, flags, memory and cycle counts.

What is the memory map?

64 KB of RAM. The screen is $0200–$05FF (one byte per pixel, 16 colours), reading $FE gives a new random byte, $FF holds the last key you pressed, and programs load at $0600. Programs written for the popular beginner 6502 tutorials that use this layout run unchanged.

How do I send keys to my program?

Click or tap the screen, then type: the key's ASCII code goes to $FF. The arrow keys and the on-screen arrows send w, a, s and d, which the Snake and Paint examples use.

What assembler syntax is supported?

Labels (loop: or a word at the start of a line), constants (define name value or name = value), *= or .org, .byte/dcb, .word, .text, .asciiz and .res, numbers in hex ($FF), binary (%1010), decimal and characters ('A'), arithmetic, and < and > for the low and high byte. A value below $100 uses zero page; write $00FF to force the absolute form.

How do breakpoints and stepping work?

Click a line number (or press F9 on a line) to set a breakpoint. Run stops before that instruction; Step (F10) runs one instruction and highlights its line. The registers, flags, memory and disassembly update after every stop, which makes it a great way to learn 6502 assembly.

Can I save or share my program?

Your program is saved in your browser automatically. You can also save it as an .asm file, download the assembled .bin, copy a hex dump, save the whole machine state, or copy a link that contains the program.

Is my code uploaded anywhere?

No. Assembling and running happen in your browser. A share link keeps the program in the part of the address after #, which browsers do not send to the server.

More tools in this category

View all free tools →