What is this?

6502asm.com is an online 6502 compiler and emulator written entirely in JavaScript. The 6502 CPU was fitted into several 8-bit computers and gaming consoles in the 1980's, such as the Apple ][, Nintendo NES and many more. If you have ever coded assembly on the C64 (which featured a 6510 CPU), then this should be a walk in the park for you. I also firmly believe that this can be an excellent platform for learning assembly code.

Who made this?

The idea, design and code behind this website was done by Stian Søreng.


The development platform for this project was a 1.25GHz Mac Mini running MacOSX 10.4.6 with Safari 2.0.3. It should also work in Internet Explorer version 6+, Opera 8+, and Firefox 1.0+.

Missing instructions

All but a few instructions from the 6502 are implemented. Those left out are CLI, RTI and SEI - simply because interrupts are not supported (yet). The commands will be compiled and executed, but have no effect. For a complete list of all available instructions, see

Instruction timing and cycles

The emulator part of this project does not take timing or cycles in consideration - it simply tries to execute the code as fast as possible.

Zero Page hack

On a typical 6502-based machine, you will find the ZP ranging from $00 through $FF. This is the case here as well, except the last two are read-only: $FE is a random generator and $FF contains the ASCII code of the key pressed (or zero if none). They are not truly RO, you can overwrite the values, but only until the next value is generated.

The screen and palette

The address space for the screen is from $200 (top left corner) to $5ff (lower right corner). For your convenience the screen is 32 by 32 pixels - 1024 in total. Moving one line down is simply done by shifting five times to the left. The palette is a direct rip-off from the C64, and the colours are as follows:

Black ($0)
White ($1)
Red ($2)
Cyan ($3)
Purple ($4)
Green ($5)
Blue ($6)
Yellow ($7)
Orange ($8)
Brown ($9)
Light red ($a)
Dark gray ($b)
Gray ($c)
Light green ($d)
Light blue ($e)
Light gray ($f)

The colors on the screen are always ANDed by $f, so no matter what value you poke into the memory, you will get one of these colours.

I need some inspiration

I hope this will help:

It's slow!

Not as slow as it was a month ago.

It doesn't work / I noticed a bug

Send an email to 6502asm@gmail.com.