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.
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:
## 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
appmake +cpmdisk -h
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.
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).
- -laussie (Aussie Byte)
- -lcpccpm (Amstrad CPC)
- -lc128cpm, -lgfx128, -lgfx128hr, -lgfx128hr480 (Commodore 128)
-subtype=px4(Epson PX4 (HC-40))
- -lnbcpm (Grundy NewBrain)
-subtype=tiki100(Tiki-100 (formerly Kon-Tiki))
- -ltrs80cpm, -lgfxtrs80, -lgfxeg2000 (Tandy Radio Shack 80 and clones)
- -startup=3 -lzxcpm (Sinclair ZX Spectrum)
- -lgfxzcn (Amstrad NC-100/NC-200) 480x64 graphics on ZCN
-subtype=attache(Otrona Attachè 320x240 graphics)
-subtype=adam(Colecovision Adam 256x192 graphics)
-subtype=excali64(BGR Excalibur 64)
- (untested) -lgfxep, -lgfxephr (Enterprise 64 / 128)
- (untested) -lgfx9001, -lgfx9001krt (Robotron Z9001, KC85/1, KC87)
Additionally, -create-app will create discs for the following machines:
-subtype=msx(MSX for use with MSXDOS)
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://zxvgs.yarek.com/en-index.html (ZXVGS is also natively supported)