This wiki is being migrated to http://www.github.com/z88dk/z88dk/wiki

 

Differences

This shows you the differences between two versions of the page.

platform:z88_packages [2006/11/27 22:32] (current)
dom created
Line 1: Line 1:
 +====== Creating Z88 Packages ======
 +
 +==== Introduction ====
 +
 +Z88 packages, are analogous to shared libraries, the infrastructure is provided by the Installer application within the [[http://www.worldofspectrum.org/z88forever/rom-forever.html|Z88 Forever]] application. Documentation for packages can be found on this page [[http://www.worldofspectrum.org/z88forever/technical.htm]].
 +
 +A package is always attached to a application eg. The Packege Package is
 +attached to Installer and the TCP Package is attached to the application
 +ZSock, thus building a package with z88dk is tied to building an
 +application. As result this documentation is written with the assumption
 +that you know how to write and build applications with z88dk.
 +
 +==== Constructing The Package Dor ====
 +
 +The package DOR is the structure which informs the Package system about
 +your package. Creating the DOR with z88dk is incredibly simple. Normally
 +to create an application DOR you would do the following:
 +
 +<code c>
 +#include <dor.h>
 +
 +/* Define application paramaters */
 +
 +#include <application.h>
 +</code>
 +
 +In a similar vein, to build the package DOR you do the following:
 +
 +<code c>
 +#include <dor.h>
 +
 +/* Define package parameters */
 +
 +#include <package.h>
 +/* Define table of pointers to functions (jump table)*/
 +
 +/* Define application parameters */
 +
 +#include <application.h>
 +</code>
 +
 +The package parameters are as follows:
 +
 +<code c>
 +#define MAKE_PACKAGE 1
 +</code>
 +
 +Say that you do want to create a package(!
 +
 +<code c>
 +#define PACK_VERSION    $MMmm
 +</code>
 +
 +The version of the package you are creating - MM=major, mm=minor
 +
 +<code c>
 +#define PACK_NAME      "[name]"
 +</code>
 +
 +The name of the package (without the [] of course!)
 +
 +<code c>
 +#define PACK_BOOT
 +</code>
 +
 +This should be set to either 0 or 1 depending on whether the package
 +should autoboot or not (This is of course bypassed by holding down 'P'
 +on reset)
 +
 +<code c>
 +#define PACKAGE_ID      $xx
 +</code>
 +
 +The package number as allocated by Garry Lancaster
 +
 +<code c>
 +#define MAX_CALL_NUM $nn
 +</code>
 +
 +The maximum LSB of a call to your package.
 +
 +==== Setting Up The Jump Table ====
 +
 +The jump table can be easily defined using the following construct:
 +
 +<code c>
 +package_str jumptable[] = {
 +        {Func1},
 +        {Func2},
 +        ....
 +        {FuncN}
 +};
 +</code>
 +
 +Remember to prototype as external to the file Func1....FuncN
 +
 +==== Finally ====
 +
 +You have to supply 3 functions yourself to fully define the package, these are the pack_ayt, pack_bye and pack_dat functions.  Due to the complex entry and exit parameters of these functions they are best written in assembler. For more details about these calls please see Garry's documentation. These functions must either be prototyped (to allow correct linking)
 +
 +
 
platform/z88_packages.txt · Last modified: 2006/11/27 22:32 by dom
 
Recent changes RSS feed Donate Powered by PHP Valid XHTML 1.0 Valid CSS Driven by DokuWiki