z88dk is able to generate code for the Commodore 128’s Z80 CPU. Two versions of the library are provided for both “native” mode and CP/M.
In addition to the z88dk “standard” functionalities the “SG Tools” library by Steve Goldsmith is included. Even if with limits the developer now has the possibility to use it in “native mode”, not needing to run CP/M and loading the program from tape or from a 1541 disk drive.
Roadmap to compile a program and run it onto the VICE emulator.
RUN x128 and create a blank disk image (mydisk.d64), then exit emulator and do the following steps:
zcc +c128ansi program.c -> compile the program bin3000 a.bin z80mc -> add the 2 bit address stub c1541 mydisk.d64 (write z80run) -> insert the BASIC loader (if new disk) (delete z80mc) -> delete the old MC program (if any) write z80mc -> insert the (new) MC program exit
x128 mydisk.d64 -> run the emulator load "z80run",8 -> load the BASIC loader run
The code is put at the address $3000; to modify at least the ORG address in c128_crt0.asm and the line 12 of the BASIC loader need to be changed (BLOAD “z80mc”,b0,P[location]).
The CP/M target support can be extended with C128 specific functions, grouped in the “c128cpm” library”. It contains a port of the SG Tools, permitting to use sound tweaked text ane graphics resolutions and more.
A good option to transfer a CP/M program is the “ctools04.zip” program by Jochen Metzinger.