Website logo depicts

I ❤ to create appealing stuff


C64JS is a Commodore 64 emulator written in JavaScript. It learned me a lot about emulation of CPU, Video (VIC-II) and Audio (SID) and other stuff (Disk format, Input/Output, keyboard handling) and about performance coding in JavaScript. And that emulation is boring :-)

There is almost no keyboard support yet, but you can use the buttons to load some test programs.

You need something modern than your C=64 to emulate a C=64!
Log messages

The red ones are very buggy and crash the emulator. Also you may need to refresh the page because a 'hard reset' doesn't reset everything.

It is far from finished, but other individual parts have been written:

Version history

VersionDate January 2014Initial version. Runs test1.prg, test2.prg, test3.prg succesfully! January 2014Loads KERNAL, BASIC and CHARGEN. But ends up in a loop due to no VIC (KERNAL does initialize $d012 to some non-zero value and later on $d012; BNE *-3 :-). Fixed by initializing $d012 to zero. January 2014Runs KERNAL, BASIC and crashes. January 2014Still crashes due to wrong instruction decoding (probably). Added rudimentary disassembler and debugger. January 2014Added preliminary VIC-II emulation. Textmodus only.
Kernal still ends up in an endless loop though :-( January 2014Added preliminary SID emulation.
Kernal still looping :-( Suspect is that ADC / SBC do not set the overflow-flag correctly and cause an incorrect branch (BVS) January 2014[Branch] .D64 support January 2014[Branch] Start writing unit tests for 6510. January 2014KERNAL loop was caused by BEQ not branching on Z = 1, but on Z = 0 :s. Another KERNAL loop was caused by initializing I/O (but there is no I/O yet). Patched up KERNAL for now. Added missing opcodes. January 2014Prints BASIC startup message! Compare instructions did not handle C-flag very well (reversed logic). Added a bunch of opcodes. BASIC BYTES FREE is incorrect though ('H26439.4215'). January 2014Rudimentary keyboard and CIA timer implementation, enough to call timer IRQ and thus show a blinking cursor and waiting for input \o/ Every command yields a syntax error though.
Also known as IFYOUREHAPPYANDYOUKNOWITSYNTAXERROR-version. February 2014Fixed some carry- and overflow-flag bugs. Is able to execute BASIC programs, but bugs when doing calculations. PRINT 10 yields 0.00000128 :-) February 2014[Branch] minor work on VIC-II emulation; timings, colors and XSCROLL ($d016) February 2014Fixed a lot of ASL, LSR, ROR and ROL bugs (mostly carry-flag related), wrong addressing modes etc. CPU emulation is at ~90% now. Lacks BCD-mode (Binary-coded decimal) and illegal opcodes.
ART.BAS other BASIC programs run fine. BASIC BYTES FREE is better now, but still wrong ('51216') because all memory is writable and memory test sees $d011 as highest non-writable address :-) Hence $d011 - $0801 = 51216!
Performance in Firefox degraded badly :-( February 2014VIC-II emulation: implemented HIRES mode ($d011, bit 5). Runs HIRES.BAS, hairline-monochrome.prg and last but not least: MATRIX.PRG! February 2014Implemented basic memory manager for I/O-traps. February 2014[Branch] Improved keyboard emulation; all keys on a regular C=64 are supported now.