Emulate a KIM-1 with a Commodore 64

Emulate a KIM-1 with a Commodore 64

When you think about virtualization, you usually think about making some CPU pretend to be another CPU. However, there are sometimes advantages to making a computer pretend to be the same computer.


That’s the case with [oldvcr]’s KIMplement, which emulates a KIM-1 with a 6502 using a Commodore 64, which also uses a 6502.The reason this makes sense is that you have total control over an emulated CPU. If a program, for example, writes to a critical memory location or tries to take over the screen or keyboard, you can easily make the emulator do something more appropriate. Things like breakpoints and single stepping also become trivial.


The virtual machine at the heart of it is 6o6 (6502 on 6502), and it seems to perform well. By virtualizing, you can easily protect the system from programs that try to, for example, take over an interrupt vector. This is similar to how x86 protected mode can run old real-mode code in a virtual environment and intervene for certain instructions. The emulation is good enough that the emulator can run the emulator, which then runs the emulator to actually run the real target. That’s wasteful, of course, but it does speak to the completeness of the pretend CPU.


If you want a KIM-1 (and an 1802 Elf) but only have an Arduino, you can emulate a different way. At least an emulated KIM-1 doesn’t develop bad memory chips.



Support the originator by clicking the read the rest link below.