Kjetil's Information Center: A Blog About My Projects

Commodore PC 20-III Emulator

Following my trend of emulators to be run in a Linux terminal, this time the target is the Commodore PC 20-III XT-class IBM clone. This computer is fairly well documented, with even circuit diagrams being available, making the work somewhat easier. I also have a real one which was helpful when trying to reverse engineer parts of the MOS 5720 chip which is unique to these Commodore PCs.

My intention with this emulator is not accuracy, but rather a testing and experimentation platform for dealing with IBM compatible PCs and DOS. Several hacks are used to control the timing and the emulation is not cycle accurate at all. One possibly unique feature of this emulator is interception of the BIOS keyboard services to block on stdin and relax the host CPU. This can be configured for either DOS or CP/M-86. Comprehensive CPU instruction trace with disassembly is also a compile time option.

I have mostly tested using the Commodore PC BIOS ROM v4.38 which I happen to have in my real PC 20-III, but some other ROM versions might work as well. Booting is easiest done from a floppy disk image, but it is also possible to possible to boot from a hard disk image if it has the correct C/H/S layout matching the WD93024-X 20 MB hard drive originally meant for this PC.

Graphics wise the 80 column CGA screen buffer is presented in curses, with color support and also clever translation of some CP437 characters to ACS (Alternative Character Set). I had intended to include curses mouse support as well, but currently only the left and right mouse button is supported. Emulating the mouse position was too difficult and will probably require lots of additional hacks to work if implemented sometime in the future. The host system clock will be exposed through emulation of the OKI MSM6242 RTC. Most other standard PC functions like DMA and IRQ handling are handled by the Faraday FE2010 chipset emulation as needed.

Here is a screenshot of the boot and MS-DOS 3.21, also showing the ACS symbols:

PC 20-III bootup in curses.

You can download version 0.1 here or check the Git repository which might be more up to date.

Topic: Open Source, by Kjetil @ 29/03-2024, Article Link