Close

Port CP/M-68K to MPU302, part 1

A project log for Reverse Engineering Soneplex SPX-MPU SBC

Reverse engineering logs for salvaged MC68302 based SBC

plasmodePlasmode 12/23/2017 at 18:120 Comments

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/):

  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