CP/M for Sega SG-1000/SC-3000
How to shoehorn CP/M onto a 40 year old Sega games console?
I have experimented with this, and the approach I came up with is a bank switched cartridge that contains RAM in one of the 32K banks, in addition to 32K RAM in the upper area. This cartridge does not (yet) exist physically, but it can run on several emulators, so in theory it might be possible on real hardware as well. There exists a floppy drive for the SC-3000 called the SF-7000, which might have been suitable for running CP/M somehow as well, but this is very rare and details about its operation is scarce.
This proof-of-concept project builds a cartridge with a bootloader and up to four IBM 3740 compatible floppy disk images spread over the different banks. The bank switching is based on the same mechanism as used in the SC-3000 Survivors Multicart.
I relied heavily on my own SG-Touzen emulator for developing this and I even found some bugs in the emulator itself. Bank switching support needed to be added as well of course. I have included these updates in a new version 0.2 that can be downloaded here or gotten from the updated Git repository. I also managed to modify both the MAME and MEKA emulators to work with this cartridge as well.
The console input and output to CP/M is handled by a minimal terminal implementation in the CBIOS that polls the SK-1100 keyboard and outputs characters on the TMS9918 chip in text mode. Due to complexity and space constraints only basic ASCII control characters are handled and there is no cursor. This works well enough with several pieces of CP/M software including MBASIC, Sargon Chess and Zork.
Download the CP/M project source code from here or from the Git repository. The zmac assembler is required to build it. The included README.md contains more technical details and instructions on how to modify the other emulators to work with the cartridge.
Here is a screenshot from the SG-Touzen emulator running MBASIC within CP/M:
Here is a video demo with the different emulators as well.