Resurrecting ancient CP/M programs


In the process of researching some accounting programs I found it useful to restore the LS Software product DIAMOND Accounting, last updated 1984. This program originally ran on HDOS (Heath/Zenith), CP/M, and the original Zenith Z-100 series.

I do have the MSBASIC source code. Note that on those systems, MSBASIC -- before there was a "gee whiz" GWBASIC -- stored your code in compressed format. GWBASIC can read compressed files from MS-DOS MSBASIC / BASICA, but the HDOS, CP/M, and Z-100 versions of MSBASIC all used slightly different code bytes.

Other minor differences

On HDOS you could use terminate a line with the @ character for line continuation; that was not true on MSBASIC or GWBASIC. HDOS and CP/M also required the WIDTH 255 command to ensure a CR/LF was not output in the middle of an escape sequence. That's right, you had to control the terminal by printing escape codes (VT-52 style for the Heath/Zenith series)... and accept escape codes as input. On the IBM PC variants, you have to translate all that to LOCATE commands and PC keystroke codes... quite a tall order for 25-year old code.

DOSEMU to the rescue

Even without translating the escape codes and keystrokes, you can at least get much of the code from HDOS or CP/M BASIC to run with the Linux dosemu package. If you have a copy of GWBASIC.EXE or possibly QuickBasic QB.EXE lying about, you are golden. If not you might be able to Google one.

Note that on Debian, after apt-get install dosemu you will get an error which is easily resolved. Typed commands are underlined.

$ <span style="text-decoration: underline;">sudo apt-get install dosemu</span>
[sudo] password for youtheuser: 
Reading package lists... Done
Building dependency tree       
Reading state information... Done
The following extra packages will be installed:
The following NEW packages will be installed:
 dosemu libsndfile1
0 upgraded, 2 newly installed, 0 to remove and 65 not upgraded.
1 not fully installed or removed.
Need to get 2605kB of archives.
After this operation, 6103kB of additional disk space will be used.
Do you want to continue [Y/n]? 

$ <span style="text-decoration: underline;">dosemu</span>
<strong>LOWRAM mmap: Invalid argument</strong>
<strong>Segmentation fault</strong>
$ <span style="text-decoration: underline;">sudo sysctl -w vm.mmap_min_addr=0</span>
vm.mmap_min_addr = 0
$ <span style="text-decoration: underline;">dosemu</span>


Now I can run:

C:> basgwbasic start.bas

and it spits out a bunch of VT-52 / H-19 escape codes and asks me whether I want SY1: or DK0: to be my data diskette. Hmm, this is gonna take some work. Nevertheless, here is code that has sat idle since 1984, on a 2 MHz Z-80 with 48K RAM, working on a 2 GHz CPU with 4 GB RAM!