Since the salvaged SPX-MPU board is now a general-purpose 68302 SBC unrelated to the Soneplex products, I will hereafter refer it as MPU302.
Having 2.25 megabyte of flash and 1 megabyte of RAM, the MPU302 should be able to run CP/M-68K. Furthermore, the top 256K of the 1 megabyte RAM is backed up with a super capacitor with a data retention period of many weeks, the top 256K RAM can serve as a RAMdisk. Some of the remaining 768K of RAM is for monitor, CP/M, and BIOS leaving 640k for TPA. 640K, as a famous person once said, 'ought to be enough for anyone'!
My first challenge is that I don't know much about CP/M and don't own an actual CP/M computer. Fortunately CP/M was designed to be ported to many different hardware and good documentations are still available on the web even after 35 years. cpm.z80.de contains a wealth of CP/M related information. Here are links for CP/M binaries and documentation I used for my porting:
http://cpm.z80.de/download/68kv1_3.zip CP/M 68K binaries <- CP/M 68K ver 1.3 binaries
http://cpm.z80.de/manuals/sys68k-m.zip System Guide <-CP/M porting guide
The system guide is very helpful in getting CP/M started. The first step is to develop a BIOS specific to my hardware. The system guide even have a BIOS template in Appendix B. To test the BIOS, I need to have a 68000 assembler and simulator. The SIM68K simulator of the EASy68K toolset is a very capable simulator, but there are no instruction to how to use it to simulate CP/M. After much fumbling around and reading various CP/M porting experiences on the web, the following is my procedure for simulation CP/M68K with SIM68K:
1. Study the CP/M System Guide carefully, very very carefully in my case because this is all new to me.
2. Use cpmtools to create a CP/M disk image (cpmtools download at http://www.moria.de/~michael/cpmtools/):
- Unzip the 68kv1_3.zip which resulted in 9 subdirectories containing the entire ver 1.3 distribution files.
- Create an entry in diskdefs with the same disk parameter block attributes as the BIOS.
- Create a 2-megabyte disk image with mkfs.cpm. 2 megabyte is the maximum data size that'll fit in my flash memory.
- Use cpmcp to copy the v1.3 distribution files into the 2-megabyte image. This creates a disk image that has all CP/M68K distribution files in a virtual disk.
- The disk image is in binary format. SIM68K expects S record datafile at the appropriate address. I used "BIN2MOT" utility to convert the binary image to Srecord with the correct offset. We now have a loadable CP/M disk image.
3. The v1.3 distribution contains a CP/M file "CPM15000.SR" which is S-record of CCP & BDOS portion of CP/M starting at location $15000. Change the extension to .s68, it becomes the loadable CP/M image.
4. BIOS follows the CPM15000 which means the _ccp is at $150BC and _init is at $1B000. Since there are no actual disk (just memory-resident disk image), the head/track/sector algorithm simplifies to calculating offsets into memory locations correspond to a particular head/track/sector value. This makes BIOS fairly easy to write.
5. Putting it all together: in SIM68K load data files of the disk image, CPM15000, and BIOS. Set PC to 0x15000 (starting address of CPM15000) and run. You should see the A> prompt and 'dir' command will display the following.
CP/M68K is now running in simulation!
Part 2 will talk about moving from simulation to the actual hardware.
Discussions
Become a Hackaday.io Member
Create an account to leave a comment. Already have an account? Log In.