CP/M on Spectravideo SVI-728/SVI-707 using openMSX


It is now Friday, June 1st, 2018. On Monday, May 28th, 2018 I bought a boxed Spectravideo SVI-707 floppy drive to complement my Spectravideo collection. It is very rare. I do not have much Spectravideo or MSX hardware, but I do have a boxed Spectravideo SVI-728 MSX home computer and a boxed Spectravideo SVI-767 tape drive to go with it. I actually thought that I had sold the SVI-728 and SVI-767, but to my delight I was wrong: I still had them in my closet. And I certainly do not want to part with them, either. It is good to have some MSX hardware and Spectravideos are nice, uncommon, made in USA machines. (UPDATE June 15th, 2018: Well, I guess many Spectravideos were in fact made in Hong Kong instead of USA, but in any case the company was based in the USA.) Spectravideo SVI-728 was pretty popular here in Finland back in the 1980s and I believe it was Commodore 64's biggest competitor in our country.

In any case, getting the SVI-707 floppy drive inspired me to try out CP/M operating system. Back in the 1980s, it was a common selling argument for Spectravideo SVI-728 that using SVI-707 floppy drive, you could boot your MSX home computer into CP/M and have access to many utility programs written for CP/M. A big rival machine of that era, Commodore 64, did have a Z80 CPU expansion module, but as far as I know, it was seriously flawed and was quickly withdrawn. So to the best of my knowledge, although it was advertised that Commodore 64 would be able to run CP/M using the Z80 CPU expansion, it never worked out. Spectravideo SVI-728, on the other hand, would work with CP/M. It has a Z80 CPU inside without any need for expansion modules.

So I was eager to see whether I could boot to CP/M using openMSX emulator on my Fedora Linux 28 laptop. I started the project on Monday evening and expected that I would accomplish the goal of running CP/M in a few hours. It turned out I was wrong. In fact I only completed the project today, after much struggling. What is more, I wanted to run Wordstar word processing program, but that goal did not materialize, for reasons explained later in this article. But I eventually got CP/M running and managed to create SVI MSX compatible CP/M disk images for the SVI-707 floppy drive.

My first real obstacle was to find a suitable CP/M boot disk for SVI-707 that would work with openMSX. With help from MSX forum, I found out that there exists a Windows program called DiskManip that was originally written for handling TRS-80 disk images. Using that tool it is possible to convert IMD-format files into DMK-format. DMK is the format required by openMSX. As I have no access to Windows machines, I installed WINE and ran DiskManip to see if the conversion would work. And it did. But I had already contacted an MSX forum member who had the CP/M boot disk in the DMK format, so I used the disk image I got from him.

But in order to boot to CP/M using the CP/M floppy, you first need to have two system ROMs for the Spectravideo SVI-707 floppy drive: one for MSX-DOS and another for CP/M. Without those ROM files, the SVI-707 emulation using openMSX just will not work. Luckily the files were pretty easy to find. And of course you will need a system ROM for the Spectravideo SVI-728 computer, too.

I also needed a way to create floppy disk images suitable for SVI-707 and CP/M, because I wanted to download Wordstar for CP/M, and see whether I could run it using openMSX emulation of SVI-728 and SVI-707. Fortunately a gentleman called Michael Haardt has written a software package for POSIX systems that allows you to work with CP/M file systems. Using his cpmtools, it is possible to do many things. However, it turned out that Michael's CP/M tools did not have a suitable disk definition for SVI-707 CP/M floppies. It took many failed attempts to add it, but after the frustration, it was rewarding to see how it finally worked out: SVI-728 and SVI-707 could read HELLO.TXT from a CP/M disk image that I created on Fedora Linux 28. Without Michael's CP/M tools, I could not have done it. Adding the disk definition for SVI-707 CP/M floppies did not require modifications to the C source code. Instead, it was sufficient to add the correct floppy disk parameters to diskdefs configuration file. I sent the patch to Michael in case he wanted to include it in the next release of CP/M tools. He soon replied that it will be included in the 2.21 release. But for this article, I have released a patched cpmtools 2.20 RPM package for Fedora Linux 28. Source RPM is also available for those who wish to compile the tools.

How to get CP/M running using openMSX

This section presents a step-by-step tutorial on how to get CP/M running using openMSX. More specifically, we will use emulated SVI-728 and SVI-707. I assume you have a basic understanding of how to use a shell such as bash on Linux. I also assume that you are running Fedora Linux 28, but by using some creativity you can easily adapt these instructions to other operating systems, too.

So let's get started.

  1. Install the openMSX emulator by issuing command:
    sudo dnf -y install openmsx
  2. As a regular user (not root!), start openMSX by typing:
    so that it will create ~/.openMSX directory. Then close the emulator.
  3. Download svi_files.tar.gz. This archive contains four files. Three of them are system ROMs, one is CP/M boot disk. Unpack the archive with:
    tar xzvf svi_files.tar.gz
  4. Copy the system ROMs to the directories that openMSX searches:
    cd svi_files
    cp -iv svi-728_basic-bios1.rom ~/.openMSX/share/systemroms
    cp -iv svi707_cpm.rom ~/.openMSX/share/systemroms/extensions
    cp -iv svi-707_disk.rom ~/.openMSX/share/systemroms/extensions
  5. Create a directory for this project and copy CP/M boot disk into it:
    mkdir ~/svi
    cp -iv CP224R13.dmk ~/svi
  6. Start the openMSX emulator choosing Spectravideo SVI-728 MSX home computer as emulation target machine, with emulated SVI-707 floppy drive as its attached extension, with CP/M boot disk inserted in the SVI-707 floppy drive:
    cd ~/svi
    openmsx -machine Spectravideo_SVI-728 -ext Spectravideo_SVI-707 -diska CP224R13.dmk
  7. Enjoy CP/M and close the emulator when you are done.

Copying a file from Linux into the emulated CP/M operating system

In this section we will install cpmtools. Then we will create a 170KB disk image suitable for Spectravideo SVI-707 floppy drive CP/M, copy a text file from Linux onto that disk image, and finally we will read our text file on CP/M.

  1. Download cpmtools-2.20-kk1.x86_64.rpm and install it:
    sudo dnf -y install /path/to/downloaded/cpmtools-2.20-kk1.x86_64.rpm
    Alternatively, if you want to compile cpmtools, you can download the source RPM cpmtools-2.20-kk1.src.rpm. If you choose to download the source RPM, I assume you will know how to compile and install it on your own.
  2. Create a text file:
    cd ~/svi
    echo hellocontent > hello.txt
  3. Create a zero-filled 170KB file. This is the basis of our CP/M floppy disk image:
    dd if=/dev/zero of=cpmfloppy bs=1 count=$((170 * 1024))
  4. Create a CP/M file system suitable for Spectravideo SVI-707:
    mkfs.cpm -f svi cpmfloppy
  5. Copy the hello.txt text file onto the floppy disk image. Note that we specify -t switch because this is a text file. According to cpmcp manual page its purpose is to [c]onvert text files between CP/M and UNIX conventions. Obviously, when you copy binary files such as executables, -t must be omitted. But here we use it:
    cpmcp -f svi -t cpmfloppy hello.txt 0:hello.txt
  6. Verify that hello.txt got copied:
    cpmls -f svi -d cpmfloppy
  7. Just to be paranoid, verify that the CP/M file system contains no errors:
    fsck.cpm -f svi cpmfloppy
  8. We are getting closer, but there is still some work to be done. Our cpmfloppy needs to be converted into DMK-format so that openMSX emulator will accept it. In order to do that, we need to download the latest openMSX source code tree from Github. To download the source code, you need git source code tool. It might already be installed, but to make sure try to install it:
    sudo dnf -y install git
  9. Download ("clone" in the git jargon) openMSX source tree from Github:
    git clone https://github.com/openMSX/openMSX.git
  10. Install GNU C++ compiler so that you can compile svicpm2dmk utility:
    sudo dnf -y install gcc-c++
  11. Compile svicpm2dmk so that we can use it:
    g++ -o svicpm2dmk openMSX/Contrib/dmk/svicpm2dmk.cc
  12. Create a DMK-format floppy image based on cpmfloppy:
    ./svicpm2dmk cpmfloppy cpmfloppy.dmk
  13. Start openMSX to boot into CP/M:
    openmsx -machine Spectravideo_SVI-728 -ext Spectravideo_SVI-707 -diska CP224R13.dmk
  14. Wait patiently until you see CP/M operating system's A> prompt. Then press F10 to enter the openMSX emulator's control console. Type:
    diska eject
    to eject the CP/M boot disk from the A-drive. Next insert our CP/M floppy disk image into drive A by issuing command:
    diska cpmfloppy.dmk
    openmsx screenshot 01
  15. Press F10 again to exit the console. You will return to the emulated Spectravideo CP/M operating system. Type:
    to see our HELLO.TXT file in the directory listing. Then issue command:
    type hello.txt
    to see the hellocontent text:
    openmsx screenshot 02


We are now done. By applying the method explained above, you can copy any files from Linux and present them to the CP/M operating system running inside openMSX SVI-728/SVI-707 emulation. Naturally that includes all CP/M executable files having COM filename extension. I tried to get Wordstar installed and running, but that attempt failed because Wordstar file set was too large for a 170KB CP/M floppy image. But I did observe that installer WSINSTALL.COM ran. It proves that Spectravideo SVI-728 and SVI-707 CP/M works properly under openMSX! Nice job, guys!

Finally I want to say many thanks to the MSX forum's friendly folks, especially Manuel Bilderbeek for helpful tips and work on openMSX emulator.

UPDATE June 5th, 2018: I got the boxed SVI-707 floppy drive today. Here are some photos.

spectravideo svi-707 1
spectravideo svi-707 2
spectravideo svi-707 3
spectravideo svi-707 4