I am writing the procedure for porting a CP/M-80 to a SORD M68.
What you need
CP/M2.2 source code (available at The Unofficial CP/M Web site)
CP/M2.2 binary (available at The Unofficial CP/M Web site)
ZASM.EXE (Absolute assembler that runs on MSDOS, available in VECTOR)
https://www.vector.co.jp/soft/dos/prog/se010314.html
CP/M player for Win32 (software to run CP/M programs on Windows)
http://takeda-toshiya.my.coocan.jp/cpm/index.html
MSDOS player for Win32 (software to run MSDOS programs on Windows)
http://takeda-toshiya.my.coocan.jp/msdos/
l3diskex.exe(Disk image generation and manipulation program)
http://s-sasaji.ddo.jp/bml3mk5/#l3diskex
Limitations in booting SORD M68
1. The BOOT ROM reads 2kb of track 1, side 0, and sectors 1-8. Therefore, the loader that loads the entire system must be kept within 2kb. I actually created one and it was less than 400 bytes.
2. Due to the limitation of 1, the system cannot fit into the standard system tracks 0 to 1 of CP/M. Therefore, the CP/M system (CPM22.BIN + BIOS.BIN = CPM.SYS) is placed at the appropriate location on the disk. If I devised a way, I could stuff the system into the remaining area of track 0 (single density) and track 1 (double density), but I decided not to do so because it would be too much trouble.
Creating a Loader
Nothing special to mention. There is some cutting and pasting in the binary editor after the binary is created, but it is not difficult.
Change the arguments of the disk read routine in the loader to conform to the location (track, side, sector) of the CP/M system (CPM.SYS).
TIPS is that the program may become unstable if you do not clear 0H to 100H of memory properly with 0 before jumping.
Determining Disk Parameters
Download the ZIP file containing the CP/M2.2 binary at The Unofficial CP/M Web site.
http://www.cpm.z80.de/download/cpm22-b.zip
Extract DISKDEF.LIB and MAC.COM from the unzipped folder.
The following description is written for SORD M68. This is probably identical to the disk parameters of CP/M-68K for SORD M68. It is compatible, but the data block size of 4kb is frankly difficult to use.
Creating CustomBIOS
The details are as described in the previous blog post: Assemble with ZASM.EXE to generate a hex file, and convert with hex2bin to create BIOS.BIN. Before assembling, make sure you have the desired memory model; if you change the CP/M memory model, remember to transcribe the address of the host buffer (hstbuf) for blocking/deblocking to the DMA transfer address. If you forget to do this, the file name will not appear in the DIR command. Worst case, it will freeze or run out of control.
Assembling the body of CP/M
Download the assembler source code zip file from The Unofficial CP/M Web site.
http://www.cpm.z80.de/download/cpm2-asm.zip
Assemble CPM22.Z80 in the unzipped folder with ZASM.EXE to generate a HEX file, and convert it with hex2bin to create CPM22.BIN. This is BDOS and CPP. Before assembling, set the memory model to the desired size.
Create CPM.SYS
Connect CPM22.BIN and BIOS.BIN. At this time, there is an empty jump table at the end of CPM22.BIN, so delete this and connect BIOS.BIN. Specifically, connect after 1600H. Rename the resulting binary to CPM.SYS. This can be easily done with a binary editor. I use Binary Editor BZ.
Now you have a loader (LOADER.BIN) and a CP/M80 system (CPM.SYS). From now on, use l3diskex.
Create a boot disk image
Start l3diskex and process as shown in the image below to complete the CP/M image for SORD M68.
Press the "New(新規)" button and make your selection as shown on the screen.
「BASIC用にフォーマット」mean Format for BASIC.
‘
Select CP/M for SORD
Writing CPM.SYS to a CP/M image disk
Drag and drop any CP/M program into the disk image window of l3diskex and it will be copied into the image. Now select the copied CPM.SYS and right-click to see its properties. You will then see where it was saved on the disk, as shown in the screenshot, so make a note of it and change the argument to the loader's disk read routine. In this example, you can see that it occupies track 7, side 0, sectors 13 to 26, and track 7, side 1, sectors 1 to 12.
Write loader
Switch to raw disk mode(生ディスクモード), select Track 1, Side 0, Sector 1, right-click and select "Import(インポート)". A file selection window will open, select LOADER.BIN. You will be asked for the last sector to be written, so assume it is up to 2 sectors; LOADER.BIN is less than 400 bytes, so it can be stored in 2 sectors (512 bytes).
The boot disk image of the CP/M system for SORD M68 is now complete. Simply drag and drop the program of your choice to create and run the desired disk image.
If successful, you will see the following on the terminal screen