Commodore 64 emulator
Introduction
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/file system, 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.
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
Version | Date | |
---|---|---|
0.0.0.1 | 5 January 2014 | Initial version. Runs test1.prg, test2.prg, test3.prg succesfully! |
0.0.0.2 | 6 January 2014 | Loads 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. |
0.0.0.3 | 8 January 2014 | Runs KERNAL, BASIC and crashes. |
0.0.0.4 | 13 January 2014 | Still crashes due to wrong instruction decoding (probably). Added rudimentary disassembler and debugger. |
0.0.0.5 | 16 January 2014 | Added preliminary VIC-II emulation. Textmodus only. Kernal still ends up in an endless loop though :-( |
0.0.0.6 | 20 January 2014 | Added preliminary SID emulation. Kernal still looping :-( Suspect is that ADC / SBC do not set the overflow-flag correctly and cause an incorrect branch (BVS ) |
0.0.0.7 | 27 January 2014 | [Branch] .D64 support |
0.0.0.8 | 28 January 2014 | [Branch] Start writing unit tests for 6510. |
0.0.0.9 | 29 January 2014 | KERNAL 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. |
0.0.1.0 | 29 January 2014 | Prints 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'). |
0.0.1.1 | 30 January 2014 | Rudimentary 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. |
0.0.1.2 | 6 February 2014 | Fixed some carry- and overflow-flag bugs. Is able to execute BASIC programs, but bugs when doing calculations. PRINT 10 yields 0.00000128 :-) |
0.0.1.3 | 8 February 2014 | [Branch] minor work on VIC-II emulation; timings, colors and XSCROLL ($d016) |
0.0.1.4 | 9 February 2014 | Fixed 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 :-( |
0.0.1.5 | 10 February 2014 | VIC-II emulation: implemented HIRES mode ($d011, bit 5). Runs HIRES.BAS, hairline-monochrome.prg and last but not least: MATRIX.PRG! |
0.0.1.6 | 27 February 2014 | Implemented basic memory manager for I/O-traps. |
0.0.1.7 | ? February 2014 | [Branch] Improved keyboard emulation; all keys on a regular C=64 are supported now. |