Platform CPM - marinus-lab/z88dk GitHub Wiki
- Native console output
- Native console input
- ANSI vt100 engine
- Generic console
- Redefinable font
- UDG support
- Paper colour
- Ink colour
- Inverse attribute
- Bold attribute
- Underline attribute
- Lores graphics
- Hires graphics
- PSG sound
- One bit sound
- Inkey driver
- Hardware joystick
- File I/O
- Interrupts
- RS232
z88dk provides extra libraries for many CP/M machines that support accessing functionality such as sound, graphics etc
The new library also has a CP/M target, which can be reached by supplying -subtype=new
for sccz80, or -subtype=sdcc_ix
, or -subtype=sdcc_iy
for sdcc compiler, respectively.
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 -lndos -o adventure.com adv_a.c
zcc +cpm -lm -o ddir.com ddir.c
The ndos.lib library is useful to save memory when file support is not necessary.
Without specifying a -o
option, a file called a.com
is produced, this can be run with zxcc
as follows:
zxcc a.com
By default, z88dk will generate code suitable for running on a z80 based machine, to compile for an 8080 machine add the option -clib=8080
:
zcc +cpm -clib=8080 -lm -lndos -o adventure.com adv_a.c
Alternatively for an 8085 machine:
zcc +cpm -clib=8085 -lm -lndos -o adventure.com adv_a.c
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:
z88dk-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:
z88dk-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.
A hardware agnostic generic console that maps into ADM-3A control codes is available. This permits portability of <conio.h>
code across CP/M targets that do not have a specific implementation. To use it add the following command line parameters:
--generic-console -pragma-define:CONSOLE_COLUMNS=X -pragma-define:CONSOLE_ROWS=Y
Where X and Y are replaced with the size of the screen. The maximum supported screen size is 80x25.
The classic CP/M target supports file access and distinguishes between text and binary files. A sector cache is implemented within the fcntl functions to speed up byte-orientated read and write operations.
The default configuration provides space for 3 FCBs, to configure more use the pragma: -pragma-define:CLIB_OPEN_MAX=nn
'stdin' and 'stdout' redirection is also supported at startup, by passing the "<filein" or ">fileout" command arguments. This will have an impact on FCB usage.
A fixed program name for argv[0] can be set with the following #pragma directive: #pragma string name
There are a couple of #pragma commands which might be used to cut down the size of the resultant executable:
-
-pragma-define:CRT_ENABLE_COMMANDLINE=0
- Disable command line argument parsing -
-pragma-define:CRT_COMMANDLINE_REDIRECTION=0
- Disable command line argument redirection ('<', '>') -
-pragma-define:CRT_OPEN_MAX=0
- Disable file support, you will link with-lndos
-
#pragma output noprotectmsdos
- strip the MS-DOS protection header
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).
-
-subtype=actrix
(Actrix disk image format) -
-subtype=alphatro
(Alphatronic PC) -
-subtype=altos5
(Altos 5 disk image format) -
-subtype=apple2
(Apple II Softcard disk image format) -
-subtype=aussie
(Aussie Byte) - -lcpccpm (Amstrad CPC)
- -lc128cpm, -lgfx128, -lgfx128hr, -lgfx128hr480 (Commodore 128)
-
-subtype=pcw40
(Amstrad PCW 8256) -
-subtype=pcw80
(Amstrad PCW 9512) -
-subtype=bondwell
(Bondwell 12/14) -
-subtype=bw2
(Bondwell 2) -
-subtype=einstein
(Tatung Einstein) -
-subtype=px4
(Epson PX4 (HC-40)) -
-subtype=px8
(Epson PX8 (HC-80)) -
-subtype=gemini
(Gemini Galaxy) -
-subtype=microbee
(MicroBEE) - -lnewbrain_cpm (Grundy NewBrain)
-
-subtype=dmv
(NCR DecisionMate disk image format) -
-subtype=televideo
(Televideo TS-80x disk format) -
-subtype=tiki100
(Tiki-100 (formerly Kon-Tiki)) - -ltrs80_cpm, -lgfxtrs80, -lgfxtrs80m2, -lgfxeg2000, -lgrafyx4, -lgrafyx4_3 (TRS-80 and clones)
-
-subtype=omikron
(TRS-80 Model I) Omikron CP/M disk image -
-subtype=lifeboat
, -lgfxtrs80m2 (TRS-80 Model II) LifeBoat or ATON CP/M disk image -
-subtype=ptcpm
, -lgfxtrs80m2 (TRS-80 Model II) Pickles & Trout CP/M disk image -
-subtype=fmgcpm
, -lgfxtrs80m2 (TRS-80 Model II) FMG CP/M disk image -
-subtype=holmes
, (TRS-80) Holmes VID-80 upgrade CP/M disk image -
-subtype=merchant
, (TRS-80 Model III) Memory Merchant CP/M disk image -
-subtype=montezuma
(TRS-80 Model 4) Montezuma CP/M disk image -
-subtype=lnw80
(LNW-80, a TRS80 clone) -
-subtype=zxplus3
(Sinclair ZX Spectrum) - -lgfxzcn (Amstrad NC-100/NC-200) 480x64 graphics on ZCN
-
-subtype=hp125
(HP-125/HP-120) -
-subtype=kaypro83
(Kaypro 83) -
-subtype=kaypro84
(Kaypro 84) -
-subtype=attache
(Otrona Attachè 320x240 graphics) -
-subtype=adam
(Colecovision Adam 256x192 graphics) -
-subtype=nascom
(Nascom) -
-subtype=excali64
(BGR Excalibur 64) -
-subtype=rc700
(Regnecentralen RC700) - (untested) -lgfxep, -lgfxephr (Enterprise 64 / 128)
- (untested) -lgfx9001, -lgfx9001krt (Robotron Z9001, KC85/1, KC87)
-
-subtype=svi
(Spectravideo SVI) -
-subtype=qc10
(Epson QX-10/QC-10) -
-subtype=kayproii
(Kaypro II) -
-subtype=lynx
(Camputers Lynx) -
-subtype=md2
(Morrow MicroDecision 2) -
-subtype=md3
(Morrow MicroDecision 3) -
-subtype=mbc200
(Sanyo MBC-200/225/1200/1250) -
-subtype=mbc1100
(Sanyo MBC-1000/1100/1150, or MBC-1250 on drive F:) -
-subtype=mbc1160
(Sanyo MBC-1160 or MBC-200/1200/1250 with no extra lib) -
-subtype=mbc2000
(Sanyo MBC-2000) -
-subtype=mz2500
(Sharp MZ2500) -
-subtype=osborne1
(Osborne 1), (Osborne Executive) -
-subtype=osborne1sd
(Osborne 1), single density format -
-subtype=smc777
(Sony SMC-70/SMC-777) -
-subtype=pasopia
(Toshiba Pasopia) -
-subtype=msx
(MSX for use with MSXDOS, the MSX specific target is generally preferrable) -
-subtype=bic
(A5105/BIC) -
-subtype=nabu
,-subtype=nabubdos
(NabuPC) -
-subtype=tim011
(TIM-011) -
-subtype=v1050
(Visual Technology - Visual 1050) -
-subtype=vt180
(DEC VT-180 disk image format) -
-subtype=x1
(Sharp X1) -
-subtype=bigboard
(Xerox 820 / Ferguson BigBoard, 8" 77trk disk image format) -
-subtype=x820
(Xerox 820 / Ferguson BigBoard, 5" 40trk disk image format) -
-subtype=z80pack
Z80pack emulator floppy format
Additionally, the following options support the following S100 video cards which were common additions to early 8080 machines such as the Altair 8800, IMSAI.
-
--vti -pragma-export:VTI_DISPLAY=0xc000
Support for display on the VTI graphics card. Change VTI_DISPLAY to the address configured with the hardware dip switches. -
--vio
Support for generic console and lores graphics on the VIO graphics card. -
--vdm
Support for generic console and very lores graphics on the Altair 8800 VDM-1 graphics card.
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 could crash if compiled for the Z80).
Just add to your source program:
#pragma output protect8080
The 'samdisk' tool by Andrew Owen provides powerful features to convert between the disk images or edit them.
A very useful option permits to copy the boot tracks from a valid system disk and overwrite the approximation introduced by appmake.
In example, supposing we created a disk image for LNW-80, we can borrow the 3 boot sectors from another disk image:
samdisk --cyls=3 --merge lnw80.imd a.imd
- http://www.seasip.info/Cpm/index.html
- http://zxvgs.yarek.com/en-index.html (ZXVGS is also natively supported)