Notes on the CPC target
=======================

Loading Addresses
-----------------

The code is compiled to address $6000 (24576), to run the code on a CPC you
should do the following:

MEMORY &5fff
load "[filename]",&6000
call &6000

Floating Point Support
----------------------

The CPC target supports a native maths library, this is selected using the 
-lmz switch when compiling.

The library that is linked in by default supports 3 models of CPC - CPC464,
CPC664 and CPC6128. Should memory be in short supply and you wish to compile
for a specific CPC then you can do the following:

zcc +cpc [...] -lmz -l6128_math

or -l664_math or -l664_math which will save about 600 bytes of memory.

The native CPC library supports some additional functions, these are:

void deg();

Switch the FP engine into degrees mode

void rad();

Switch the FP engine into radians mode

double pi();

Return the value of pi.

double pow10(int x);

Returns 10^x

File IO Library
---------------

Support for file IO on the CPC has been added. This uses the CAS_ interface
and as such as the limitation that only 2 files may be open at a time -
one for reading and one for writing. In addition due to the firmware
implementation of these routines, a 2k buffer is required for both input
and output. This buffer is statically built into the program.

The following routines are not supported by the CPC fcntl library:

ftell()
fgetpos()
fsetpos()
rewind()
fseek()
creat()
lseek()
mkdir()
getcwd()
rmdir()
getwd()

Additionally, open() only supports the O_RDONLY and O_WRONLY flags.

To link in the library supply the -lcpcfs flag to the compiler. If you do
not require file IO in your program then supply the -lndos flag which 
links in a dummy stub library that simply returns errors.

Application Creation
--------------------

The appmake has been updated to support the CPC as a target. When compiling
if you supply the -create-app flag then a file with the suffix .cpc is
generated. This file contains a CPC disc file header which can then be 
easily transferred onto a CPC disc using cpcfs or a similar tool.

