Changes

Jump to: navigation, search

Z88DK

2,183 bytes added, 10:16, 26 January 2022
Category
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.
[[Image:Chessboard.png|300px|thumb|right|Chessboard using z88dk graphics library]]
== Supported Targets ==
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:
<pre>
/*
* Hello World
*/
 
#include <stdio.h>
 
main()
{
printf("Hello world!\n");
}
</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 <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 ;
}
</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 :
* [http://www.z88dk.org/wiki/doku.php?id=platform:amstradcpc Amstrad CPC]
* [http://www.z88dk.org/wiki/doku.php?id=usage:stackframe stackframe]
 
== 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)
== Weblinks ==
 
* [http://z88dk.sourceforge.net/ Official Z88dk homepage]
* [http://z88dk.sourceforge.net/platforms.html Machine support page]
* [http://z88dk.sourceforge.net/screenshots.html Screenshots on different machines]
* [http://www.octoate.de/joomlawp/articles/german/entwickeln-mit-z88dk/index.php?option=com_content&task=view&id=17&Itemid=36 Tutorial on how to develop with Z88dk for the CPC ] (in German)* [http://espsoft.amstrad.es/?page_id=257 CPC Sprite library for z88dk]
[[Category:ProgrammingC]] [[Category:GSX]] [[Category:Programming_software]] [[Category:CrossDev]]
901
edits