-
Notifications
You must be signed in to change notification settings - Fork 181
Platform Commodore c128
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 the obvious limits of the lack of an Operating System, 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.
NOTE: a bug in the emulator will prevent this method to work with VICE version 3.x
zcc +c128 -create-app program.c
The default program name is "A", so a file named "A.T64" will be created. Attach the file image to your favourite emulator (or convert it to WAV).
Load the M/C block: LOAD
Load the BASIC kickstarter (but a simple SYS jump could also work): LOAD
..run the thing ! RUN
The code is built by default at $5000, different locations can be specified (e.g. '-zorg=16384).
Specific audio conversion tools can be used to transfer the ".T64" file (e.g. WAV-PRG).
Roadmap to compile a program and run it onto the VICE emulator.
Create a blank disk image (mydisk.d64), x128 is buggy so to succeed you could use an external tool, such as "cc1541" (a disk image creator, while "c1541" is a disk image editor).
Then do the following steps:
zcc +c128 -create-app -subtype=disk program.c -> compile the program using the default output name ("A")
c1541 mydisk.d64
write a.ldr -> insert the BASIC loader (if new disk)
write a -> insert the MC program
exit
x128 mydisk.d64 -> run the emulator
run "a.ldr" -> load and run the BASIC loader
The code is built by default at $3000, different locations can be specified (e.g. '-zorg=16384).
A good alternative to c1541 is "DirMaster": http://style64.org/dirmaster
- $2000 - Text screen
- $3000 - Custom font/udgs (if configured)
- $5000 - Start address of program
The CP/M target is extended with C128 specific functions, grouped in the "c128cpm" library (add "-lc128cpm" to your zcc command). "c128cpm" also contains a port of the SG Tools, permitting to use sound, tweaked text, graphics resolutions and more.
z88dk style graphics libraries can be included by adding "-lgfx128", "-lgfx128udg" (together with "-zorg=16384"), "-lgfx128hr" or "-gfx128hr480" (this last video mode is still untested and not supported by the current VICE emulator version).
The above options are also listed in the CP/M section in this Wiki.
A good option to transfer a CP/M program is the "ctools04.zip" program by Jochen Metzinger.
Graphics support libraries are available for fourdifferent resolution modes: lorez (gfx128), mid-rez (gfx128udg -zorg=16384), hirez (gfx128hr) and ultra-hirez (gfx128hr480)
To mix text and graphics at the moment the only ready made option is "-clib=gfxtext". It is uppercase only and has no scroll support but it is reasonably compact and portable on all the targets.
- Overview
- Platform List
- Unsupported Platforms
- i8080/5 Support
- Homebrew hardware quickstart
- Retargetting
- Building the libraries
- Clang support
- Pragmas
- Adding to Classic
- Introduction
- Library Configuration
- CRT
- Header Files
- Assembly Language
- Library in Depth
- Embedded Platform
- Adding to NewLib
- Benchmarks
- Datatypes
- Debugging
- Decompression
- More than 64k
- Deficiencies
- Compiling Larger Applications
- Importing routines written in 8080 assembly mnemonics
- Using CP/M libraries in REL format with z88dk
- Writing optimal code
- Speeding up Compilation
- CMake usage