Skip to content

Platform CPM

suborb edited this page Jun 16, 2019 · 17 revisions

The CP/M platform is a surprisingly useful port when used in combination with ZXCC, the two together can easily test whether an algorithm works, or whether there's an issue in the compiled output code.

ZXCC is trivial to extend, and you can easily permit access to serial ports, host system calls, advanced paging techniques etc testing out many areas of your code.

Quick Start

zcc +cpm -lm -o adventure.com adv_a.c

Without specifying a ''-o'' option, a file called ''a.com'' is produced, this can be run with zxcc as follows:

zxcc a.com

## Creating a disc

appmake supports creating a number of CP/M disc formats that can be used directly by emulators or easily converted using 3rd party tools. Many of these can be produced as part of the compilation step using the -subtype=XXXX -create-app options.

To create a disc image with a binary, you can use the following command:

 appmake +cpmdisk -f [format] -b [binary file]

The file will be created on disc with a .COM extension.

The supported formats are displayed by specifying the -h option:

 appmake +cpmdisk -h

Library Support

Besides the standard library routines, the ''bdos(int func,int arg)'' and the the ''bios(int func,int arg,int arg2)'' function calls allows direct access to the bios of the system.

Optimization

There are a couple of #pragma commands which might be used to cut down the size of the resultant executable:

#pragma output nostreams - No stdio disc files

#pragma output nofileio - No fileio at all

#pragma output noprotectmsdos - strip the MS-DOS protection header

#pragma output noredir - do not insert the file redirection option while parsing the command line arguments (useless if "nostreams" is set)

Hardware specific extensions

Some hardware specific functions have been adapted to run on both native platorm and generic CP/M environment (the 'gfx' prefix is used for library modules including graphics extensions only).

Additionally, -create-app will create discs for the following machines:

Program boot protection

The code generated for CP/M based computers is protecting by default the MS-DOS environment.

In a similar way we can extend the protection to the 8080 based systems (which would crash otherwise).

Just add to your source program:

#pragma output protect8080

CP/M related Links

http://www.seasip.info/Cpm/index.html

http://zxvgs.yarek.com/en-index.html (ZXVGS is also natively supported)

Clone this wiki locally
You can’t perform that action at this time.