Difference between revisions of "Z88DK"
(Category) |
|||
(9 intermediate revisions by 4 users not shown) | |||
Line 10: | Line 10: | ||
Warning : you would really install a recent version like the nightly build to enjoy of the last improvement for CPC. | Warning : you would really install a recent version like the nightly build to enjoy of the last improvement for CPC. | ||
− | + | [[Image:Chessboard.png|300px|thumb|right|Chessboard using z88dk graphics library]] | |
+ | |||
== Supported Targets == | == Supported Targets == | ||
Line 51: | Line 52: | ||
== Usage == | == Usage == | ||
− | world.c from the z88dk console examples : | + | Here is world.c from the z88dk console examples: |
<pre> | <pre> | ||
Line 66: | Line 67: | ||
</pre> | </pre> | ||
− | + | Compile this example with: | |
+ | zcc +cpc -create-app -make-app -O3 -unsigned -o out.bin world.c -lndos -zorg=16384 | ||
− | < | + | If you get an error message during compilation ("File open/read error"), make sure the <tt>Z80_OZFILES</tt> environment variable is set correctly, see [http://www.z88dk.org/wiki/doku.php?id=installation#z80_ozfiles]. |
− | + | [[File:Z88dk hw.png|thumb|256px|''Hello world'' example]] | |
− | + | ||
+ | The resulting binary can be run from BASIC with: | ||
+ | |||
+ | memory &3fff | ||
+ | load "out.cpc",&4000 | ||
+ | call &4000 | ||
+ | |||
+ | Another more specific example: | ||
+ | |||
+ | <pre> | ||
#include <stdio.h> | #include <stdio.h> | ||
#include <cpc.h> | #include <cpc.h> | ||
Line 104: | Line 114: | ||
} | } | ||
</pre> | </pre> | ||
+ | |||
+ | graphics library examples : [[Image:Moivre.png|300px|thumb|right]] | ||
+ | |||
+ | <pre> | ||
+ | #include <graphics.h> | ||
+ | |||
+ | main() | ||
+ | { | ||
+ | int i,x1,y1,x2,y2; | ||
+ | clg(); | ||
+ | |||
+ | for ( i=0;i<11;i++) | ||
+ | { | ||
+ | y1 = 200 - 20 * i ; | ||
+ | x2 = 50 + 20 * i ; | ||
+ | draw(50,y1,x2,0); | ||
+ | } | ||
+ | } | ||
+ | </pre> | ||
+ | |||
must-read topic on z88dk wiki : | must-read topic on z88dk wiki : | ||
Line 112: | Line 142: | ||
*[[CPCRSlib]] | *[[CPCRSlib]] | ||
− | * Crocolib by Arnaudstorq (link | + | * Crocolib by Arnaudstorq (no link exists anymore) |
== Released Software == | == Released Software == | ||
Line 124: | Line 154: | ||
* [[Nanako Descends To Hell]] (game) | * [[Nanako Descends To Hell]] (game) | ||
* [[Platformer Medley Block #1]] (game) | * [[Platformer Medley Block #1]] (game) | ||
− | |||
== Weblinks == | == Weblinks == | ||
Line 131: | Line 160: | ||
* [http://z88dk.sourceforge.net/platforms.html Machine support page] | * [http://z88dk.sourceforge.net/platforms.html Machine support page] | ||
* [http://z88dk.sourceforge.net/screenshots.html Screenshots on different machines] | * [http://z88dk.sourceforge.net/screenshots.html Screenshots on different machines] | ||
− | * [http://www.octoate.de/ | + | * [http://www.octoate.de/wp/articles/german/entwickeln-mit-z88dk/ Tutorial on how to develop with Z88dk for the CPC] (in German) |
* [http://espsoft.amstrad.es/?page_id=257 CPC Sprite library for z88dk] | * [http://espsoft.amstrad.es/?page_id=257 CPC Sprite library for z88dk] | ||
− | [[Category:C]][[Category:Programming_software]][[Category:CrossDev]] | + | [[Category:C]] [[Category:GSX]] [[Category:Programming_software]] [[Category:CrossDev]] |
Latest revision as of 05:16, 26 January 2022
Text copied from the official Z88dk website.
Contents
What is Z88dk?
z88dk is a Z80 C cross compiler supplied with an assembler/linker and a set of libraries implementing the C standard library for a number of different Z80 based machines. The name z88dk originates from the time when the project was founded and targetted only the Cambridge z88 portable.
The compiler featured in z88dk is much enhanced Small C compiler, the compiler accepts many features of ANSI C and is only deficient in a few areas where implementation on a Z80 processor might prove inefficient. The compiler performs simple optimizations, but the bulk of the optimization is done by a set of peep-hole rules, which will typically reduce the size of a large project by up to a third.
The libraries supplied with z88dk are designed to be as generic as possible, indeed it is possible to port to a new machine simply by supplying two library routines and some startup code. It is hoped that one day z88dk will support as many z80 based machines as there is information available and sufficient interest in.
Warning : you would really install a recent version like the nightly build to enjoy of the last improvement for CPC.
Supported Targets
z88dk produces code and programs that will run on the following machines:
- Cambridge Computers z88
- Sinclair ZX Spectrum
- Sinclair ZX81
- CP/M based machines
- Amstrad NC100
- VZ200/300
- Sharp MZ series
- TI calculators (TI82, TI83, TI83+, TI85, TI86)
- ABC80, Jupiter Ace
- Xircom REX 6000
- Sam Coupe
- MSX1
- Spectravideo
- Mattel Aquarius
- Peters Sprinter
- C128 (in Z80 mode)
Supported Platforms
z88dk is known to run on the following platforms:
- Amiga
- BeOS
- HP-UX 9
- Linux
- MacOS X
- Solaris
- Win32
- Win16
- MSDOS
Binary releases are available for Amiga, Solaris and Win32. Win16/MSDOS needs to be rolled by the user. On BSD machines, GNU make should be used instead of the native make program.
Usage
Here is world.c from the z88dk console examples:
/* * Hello World */ #include <stdio.h> main() { printf("Hello world!\n"); }
Compile this example with:
zcc +cpc -create-app -make-app -O3 -unsigned -o out.bin world.c -lndos -zorg=16384
If you get an error message during compilation ("File open/read error"), make sure the Z80_OZFILES environment variable is set correctly, see [1].
The resulting binary can be run from BASIC with:
memory &3fff load "out.cpc",&4000 call &4000
Another more specific example:
#include <stdio.h> #include <cpc.h> int main(void) { int model; char * model_name; model = cpc_model() ; switch (model) { case 0: model_name = "464"; break; case 1: model_name = "664"; break; case 2: model_name = "6128"; break; default: model_name = "unknown"; } printf("model=%s\n",model_name); return 0 ; }graphics library examples :
#include <graphics.h> main() { int i,x1,y1,x2,y2; clg(); for ( i=0;i<11;i++) { y1 = 200 - 20 * i ; x2 = 50 + 20 * i ; draw(50,y1,x2,0); } }
must-read topic on z88dk wiki :
Libraries for the CPC
- CPCRSlib
- Crocolib by Arnaudstorq (no link exists anymore)
Released Software
CPC programs which are using Z88dk:
- Mariano the dragon (game)
- Magical drop (game)
- PHAT (demo)
- Nanako in Classic Japanese Monster Castle v.2 (game)
- Phantomas Tales #1: Marsport (game)
- Nanako Descends To Hell (game)
- Platformer Medley Block #1 (game)