A KIM-1 emulator for the Commodore 64

This last week I started by updating the Incredible KIMplement, my MOS/Commodore KIM-1 emulator for the Commodore 64.

No, that’s not a joke. The KIMplement runs real KIM-1 code using a software 6502 core I’ve christened “6o6” (6502-on-6502). 6o6 implements protected memory, exception handling and all legal NMOS instructions. In addition, the KIMplement not only emulates those famous six seven-segment LEDs and the hex keypad, but also is one of the few KIM-1 emulators that emulates a TTY connection (an old-school ASR-33) and a KIM-4 expander with 16K of RAM, allowing you to run “big programs” too.

Via a discussion on Hacker News [ The KIMplement 0.2b: a KIM-1 emulator for the Commodore 64 | Hacker News ]

4 Likes

Interesting note about decimal mode. Two other snippets:

The eventual goal is to open-source the KIMplement, and in particular 6o6, but I want to have another demonstration application for 6o6 as well before I do. A small multitasking general-purpose kernel sounds like an ideal way to show off how it works.

I think this scheme is probably near the fastest way a 6502 can run “untrusted” 6502 code. In practice it is about 35-50 times slower than native code

1 Like

“Untrusted” 6502 code? What kinds of nefarious secrets are hidden behind this simple phrase? :thinking:

1 Like

Hee hee! Well, I do like the idea of being able to run code which has the ROM or the I/O devices at quite different addresses. And the virtualised code isn’t able to make unwanted writes to zero page… it’s a pity the performance penalty is so large, but it’s possible it can be improved on. I look forward to the source code being released!

1 Like

Great! And I had no idea that FOCAL-65 even existed!

Regarding “untrusted code” and virtualization, it may be interesting that the KIM ROM does already something in that direction by replicating the processor state and registers for software access.

Does this also replicate the ROR bug of the pre-June 1976 production series of the 6502, the truly “untrusted instruction”? :slight_smile:

2 Likes