Introduction

March 7, 2026 ยท View on GitHub

CP/M (Control Program/Monitor) is an operating system for 8-bit and 16-bit processors. It was the most famous operating system for 8-bit Intel 8080, Intel 8085 and Zilog Z80 processors. CP/M-68K is a CP/M operating system for Motorola 68000 and 68010 processors. It was used on the Motorola EXORmacs developments system, SORD M68 and M68MX computers. CP/M-68K was very uncommon operating system when compared to 8-bit CP/M-80 variant. Software availability is limited for the CP/M-68K, but the operating system includes for example an assembler and a C language compiler.

SturmBIOS (also known as cpm68k-amiga) is an implementation of CP/M-68K BIOS for Commodore Amiga. It allows the usage of CP/M-68K on Amiga computers.

Note: 68020, 68030 and 68040 CPU support was just addded. The support is still experimental. All exception frames are not supported.

Documentation

CP/M-68k documentation can be found from https://github.com/juollila/cpm68k-amiga/tree/main/cpm/doc

It is recommended that new users read User's Guide. If a user wants to program then Programmer's Guide and C Programming Guide are recommended.

Amiga CP/M-68k supports the following additional commands:

ProgramPurpose
format.68kFormat disk and install CP/M to reserved tracks
setbaud.68kSet baud rate for the serial port
setmap.68kChange keyboard layout (USA, UK, FI, SE or DE)

Bootable Disk Image

A bootable disk image: https://github.com/juollila/cpm68k-amiga/blob/main/amiga/adf/cpm-boot.adf

Memory Map

Start AddressEnd AddressDescription
00000003ffException vectors
004005ffffTransient program area
6000065fffBDOS and CCP
660007ffffBIOS, disk buffer, screen buffer

Disk Format

Amiga CP/M disk uses Amiga MFM sector format at the lowest level so that Amiga ADF utilities can be used to read and write physical disks. Amiga CP/M disk uses CP/M file system instead of Amiga file system (OFS, FFS or SFS).

The structure of disk:

StartEndDescription
Track 0, sector 0Track 0, sector 1Boot loader
Track 0, sector 2Track 7, sector 10CCP, BDOS and BIOS
Track 8, sector 0Track 8, sector 7CP/M file system, directory area
Track 8, sector 8Track 159, sector 10CP/M file system, data area

Disk definition for Cpmtools:

diskdef amiga
  seclen 128
  tracks 160
  sectrk 44
  blocksize 2048
  maxdir 128
  boottrk 8
  os 2.2
end

Terminal Emulation

SturmBIOS support both ADM-3A and VT-52 terminal emulation.

ADM-3a control codes:

Control codeDescription
^GBell
^H or backspaceCursor left / backspace
^I or TABTabulator
^JLine feed i.e. cursor down + scrolling if needed
^KCursor up / vertical tab
^LCursor right / form feed
^MCarriage return
^ZMove cursor home and clear screen
ESC = row colMove cursor position, add $20 to row and col

VT-52 control codes:

Control codeDescription
^GBell
^H or backspaceCursor left / backspace
^I or TABTabulator
^JLine feed i.e. cursor down + scrolling if needed
^KCursor up / vertical tab
^LCursor right / form feed
^MCarriage return
^ZMove cursor home and clear screen
ESC ACursor up without scrolling
ESC BCursor down without scrolling
ESC CCursor right
ESC DCursor left / backspace
ESC HMove cursor home
ESC ICursor up + scrolling if needed
ESC JErase to end of screen
ESC KErase to end of line
ESC Y col rowCursor position, add $20 to col and row

HW Restrictions

Amiga HW restrictions:

  • Only PAL video standard supported.
  • Only 1-2 floppy disk drives are supported.
  • Hard disks are not supported.
  • Only first 512k of RAM is used, but it is more than enough for CP/M-68k.

BIOS Functions

Standard BIOS functions are documented in System Guide: https://github.com/juollila/cpm68k-amiga/blob/main/cpm/doc/CPM-68K_System_Guide_Jan83.pdf

I/O Byte

SturmBIOS supports I/O redirection using I/O byte (BIOS functions 19 and 20).

I/O byte format:

Device:LISTAUX OUTPUTAUX INPUTCONSOLE
Bits :7,65,43,21,0

CONSOLE device values:

Value:Device:
0Serial port (TTY:)
1Console (CRT:)
2Batch mode (BAT:) console as input, printer as output
3NULL (UC1:)

AUX INPUT device values:

Value:Device:
0Serial port (TTY:)
1Serial port (PTR:)
2NULL (UR1:)
3NULL (UR2:)

AUX OUTPUT device values:

Value:Device:
0Serial port (TTY:)
1Serial port (PTP:)
2NULL (UP1:)
3NULL (UP2:)

LIST device values:

Value:Device:
0Serial port (TTY:)
1Serial port (PTP:)
2Parallel port / Centronics (LPT:)
3NULL (UL1:)

XBIOS Functions

SturmBIOS supports some non standard eXtended BIOS (XBIOS) functions. User applications do not usually call XBIOS functions. When an application calls an XBIOS function, it places the function number in register D0.W, and function parameters to other registers as specified in the following table. After that it executes a trap #4instruction.

Function Number: Function Name: Description:
0 RESERVED Reserved for future use
1 GET BAUD RATE Entry Parameters:
Register D0.W: \$1

Returned Values:
Register D0.W: Baud Rate (300, 1200, 2400, 4800, 9600, 14400, 19200, 38400, or 57600)
Register D1.W: Data Bits (8)
Register D2.W: Parity (0=None)
Register D3.W: Stop Bits (1)

Get Serial Parameters Function fetches baud rate, a number of data bits, parity, a number of stop bits for the serial port.
2 SET BAUD RATE Entry Parameters:
Register D0.W: \$2
Register D1.W: Baud Rate (300, 1200, 2400, 4800, 9600, 14400, 19200, 38400, or 57600)
Register D2.W: Data Bits (8)
Register D3.W: Parity (0=None)
Register D4.W: Stop Bits (1)

Returned Values:
Register D0.W: \$0000=configuration was successful
Register D0.W: $ffff=configuration failed

Set Serial Parameters Function configures baud rate, a number of data bits, parity, a number of stop bits for the serial port. Baud rate 9600, 8 data bits, no parity and 1 stop bit are defaults which are taken into use during the SturmBIOS start-up. Baud rate 19200 is the reliable maximum for Amiga 500.
3 GET FLOW CONTROL Entry Parameters:
Register D0.W: \$3

Returned Values:
Register D0.W: RTS/CTS Flow Control (0=No, 1=Yes)

Get RTS/CTS flow control for the serial port.
4 SET FLOW CONTROL Entry Parameters:
Register D0.W: \$4
Register D1.W: RTS/CTS Flow Control (0=No, 1=Yes)
Returned Values:
Register D0.W: \$0000=configuration was successful
Register D0.W: $ffff=configuration failed

Set RTS/CTS flow control for the serial port. RTS/CTS flow control is enabled by default during the SturmBIOS start-up.
5 FORMAT Entry Parameters:
Register D0.W: \$5
Register D1.W: Drive (0=A, 1=B)
Returned Values:
Register D0.W: \$0000=operation was successful
Register D0.W: $ffff=operation failed

Format a disk in disk drive. This function does not install reserved tracks.
6 RESERVED Reserved for future use
7 RESERVED Reserved for future use
8 SET KEYMAP Entry Parameters:
Register D0.W: \$8
Register D1.L: Address of keymap table
Returned Values:
Register D0.W: \$0000=operation was successful

Set a keymap. The keymap should be in same binary format as keymap in bios.asm. The length of keymap is 192 bytes.

Boot Process

CP/M-68K's boot process is the following:

  1. Amiga Kickstart ROM loads the boot loader from the boot block.
  2. Boot loader loads BDOS, CCP and BIOS from the reserved tracks using the trackdisk device.
  3. Boot loader enables the supervisor mode.
  4. Boot loader jumps to BDOS initialization routine ($60000).
  5. BDOS initialization routine calls BIOS init routine ($66000).
  6. BIOS takes over Amiga's operating system i.e. disables interrupts and DMA.
  7. BIOS initializes screen, CIA timers, keyboard interrupt, serial port, parallel port, floppy and trap number #3 and #4.
  8. BIOS detects CPU and install a patch for CP/M if processor is 68010 or better. CPU caches are also disabled if processor is 68020 or better.
  9. BIOS returns to BDOS.
  10. BDOS and CCP performs the rest of initializations.

Building

Requirements

The following SW is required to compile SturmBIOS for CP/M-68k and create a bootable disk image:

  1. Cpmtools, http://www.moria.de/~michael/cpmtools/
  2. Vassm68k_mot, http://sun.hasenbraten.de/vasm/
  3. A tool which can convert a Motorola S record file to a binary file. For example SDCC compiler suite's sdobjcopy utility.
  4. Python3

Creating blank CP/M disk image

The following procedure can be used to create a new blank CP/M disk image:

  1. Create a blank adf image "cpm-blank.adf" for exampale using UAE emulator.
  2. Add the following entry to diskdefs of cpmtools:
diskdef amiga
  seclen 128
  tracks 160
  sectrk 44
  blocksize 2048
  maxdir 128
  boottrk 8
  os 2.2
end
  1. Create a CP/M filesystem: mkfs.cpm -f amiga cpm-blank.adf

Note: This image is not bootable.

Makefile

Use the following commands to create a bootable floppy disk image after you have installed all requirements and added Amiga disk format to diskdefs of cpmtools:

$ cd amiga/bios
$ make

Or you may follow the manual procedure which is described in the following sections.

See also Makefile for further details.

Convert CPM60000.SR file to binary file

CP/M binary distribution contains CCP and BDOS in Motorola S record format. It can be converted to binary format using for example SDCC compiler suite's sdobjcopy utility.

$ sdobjcopy --input-target srec --output-target binary cpm60000.SR cpm60000.bin

Compiling SturmBIOS

SturmBIOS for CP/M-68k can be compiled using the following command.

$ vasmm68k_mot bios.asm -Fbin -o bios.bin

Creating CPM.BIN

CP/M binary contains CCP, BDOS and BIOS. The starting address of CCP and BDOS (cpm60000.bin) is $60000 and starting address of BIOS is $66000. A padding must be added between cpm60000.bin and bios.bin. At first a padding file is created.

$ dd if=cpm60000.bin ibs=24k count=1 of=cpm60000-padded.bin conv=sync

The cpm.bin file is created concatenating cpm60000-padded.bin, padding.bin and bios.bin.

$ cat cpm60000-padded.bin padding.bin bios.bin > cpm.bin

Creating bootable disk image

At first boot track binary is created using the following command. The binary contains boot loader, CCP, BDOS and BIOS.

$ vasmm68k_mot boot_loader.asm -Fbin -o boot.bin

Calculate and write Amiga boot block's checksum.

$ python3 checksum.py --output boot-with-checksum.bin boot.bin

Bootable disk image is created copying boot track binary to a blank CP/M disk image:

$ cp cpm-blank.adf cpm-boot.adf
$ mkfs.cpm -f amiga -b boot-with-checksum.bin cpm-boot.adf

Copy files to cpm-boot.adf

CP/M programs can be copied to cpm-boot.adf using Cpmtools.

For example:

$ cpmcp -f amiga cpm-boot.adf program 0:

References

CP/M-68K System Guide: https://github.com/juollila/cpm68k-amiga/blob/main/cpm/doc/CPM-68K_System_Guide_Jan83.pdf

Amiga Hardware Manual: http://amigadev.elowar.com/read/ADCD_2.1/Hardware_Manual_guide/node0000.html

SturmBIOS floppy drive routines were inspired by AROS and EmuTOS floppy drive implementations:

EmuTOS - Amiga specific funtions: https://github.com/emutos/emutos/blob/master/bios/amiga.c

AROS - Amiga HW floppy stuff: https://github.com/aros-development-team/AROS/blob/master/arch/m68k-amiga/devs/trackdisk/trackdisk_hw.c