This wiki is being migrated to

User Tools

Site Tools


CP/M LIBRARY (cpm.h)

Version all
Header {z88dk}/include/cpm.h
Source {z88dk}/libsrc/cpm
Include #include <cpm.h>
Linking n/a
Compile n/a
Supported CP/M
Comments n/a

The CP/M library contains functions specific to the CP/M Operating system.

CP/M Functions

bdos (int func, int arg)

This is a quite common function in

bios (int func, int arg, int arg2)

File support

*getfcb (void)

fcb *getfcb (void)

setfcb (struct fcb *fc, unsigned char *name)

Fill up the filename stuff

parsefcb (struct fcb *fc, unsigned char *name)

Write the file offset into the FCB

putoffset (char *dest, long val)


Set userid


Get userid

_putoffset (unsigned char *where, long offset)

Write an offset as 3 bytes


Mark an FCB as being unused

int change_volume (int volume)

Disk control (as for OSCA FLOS)

int get_current_volume()

Current 'drive' (0..n)

Directory related commands

This function set is also availble for OSCA FLOS target platform

int dir_move_first()

int dir_move_next()

int dir_get_entry_type()

Result: 0=normal, 1=directory

char *dir_get_entry_name()

unsigned long dir_get_entry_size()

char *get_dir_name()

Directory stuff

  struct fcb *fc_dir;
  char fc_dirpos;
  char *fc_dirbuf;

Amstrad XBIOS specific commands

Extensions introduced by Amstrad in its CP/M Plus implementation, used also on the Spectrum +3.

a_statusline(int onoff);

Enable/disable the bottom status line, no effect on some version.

a_keyspeed(int delay, int repeat);

Set keyboard speed

a_border(int color);

Set border color, 6 bit color encoding, (or 8 bit if ULA256.FID is installed)

a_paper(int color);

Set paper color, 6 bit color encoding, (OS patch needed or 8 bit if ULA256.FID is installed)

a_ink(int color);

Set ink color, 6 bit color encoding, (OS patch needed or 8 bit if ULA256.FID is installed)

int a_curx();

Get x cursor position in viewport

int a_cury();

Get y cursor position in viewport

int a_machine();

Get the machine type on which the Amstrad CP/M implementation is running

  #define M_CPC        0    // CPC6128
  #define M_PCW        1    // PCW8000/9000/10 series
  #define M_SPECTRUM   3    // Spectrum +3
  #define M_PCW16     65    // (65 = 'A', ie "Anne")

int a_machinever();

Get Machine HW version (or HW details on recent PCW versions)

int a_biosver();

Get BIOS version

int a_memsize();

Get system memory size

int a_driveb();

Are 2 drives available ?

int a_serialport();

Is the Serial Port available ?

library/cpm.txt · Last modified: 2017/03/24 15:08 (external edit)