=========================================
   ZXGFX.KCL
   GRAPHICS LIBRARY FOR KAMASOFT C'
=========================================

The library is loaded in the compilation
phase (ExT, G) to the upper part of
memory. A function is used by declaring
the library once with extern "zxgfx.kcl";
and each function with extern NAME();
then it is called like an ordinary
function.

FUNCTION LIST
-------------------------

name     bytes  input  output
-------  -----  -----  ------
CIRCLE     242      3       0
DRAW        51      2       0
DRAWTO      43      2       0
FADEOUT     64      1       0
PLOT        15      2       0
POINT       27      2       1

PARAMETER PASSING
--------------------------
- the last (or only) argument is in
register HL
- all arguments are also in the parameter
block
  pointed to by the system variable 5CB0h
 Each argument takes 2 bytes:
     arg1 = ((5CB0))+0 and +1
     arg2 = ((5CB0))+2 and +3   etc.
- the return value (for functions that
return
  one) is in register HL (the high byte H
  is
  zero for byte results)

=========================================
 CIRCLE - circle
=========================================

INPUT : 3 - arg1 X (0-255), arg2 Y
(0-175),
             arg3 R (radius)
OUTPUT: 0

Draws a circle with centre (X,Y) and
radius R. Taken from a fast-circle: a
squaring routine QUA and a decision via
r*r - x*x, with 8 symmetric points. Each
point is drawn by ROM PLOT-SUB (22E5h),
so the current INK/PAPER/BRIGHT/FLASH and
OVER apply. R=0 draws nothing. The circle
must fit on screen (Y above 175 would
cause an error, as with PLOT).

USAGE:
  extern "zxgfx.kcl";
  extern "basic.kcl";
  {
  ink(2); circle(128,88,40);
  }

=========================================
 DRAW - draw a line
=========================================

INPUT : 2 - arg1 X, arg2 Y (relative
offset)
OUTPUT: 0

Draws a line from the current point
(COORDS) by a relative offset X
(horizontal) and Y (vertical); both may
be negative. Uses the ROM routine
DRAW-LINE (24BAh), which calls PLOT-SUB
point by point and keeps COORDS updated,
so the next DRAW continues from there.
Set the starting point with PLOT before
the first DRAW.

USAGE:
  extern "zxgfx.kcl";
  {
  plot(50,50); draw(100,0); draw(0,80);
  }

=========================================
 DRAWTO - line to a point
=========================================

INPUT : 2 - arg1 X, arg2 Y (absolute
point)
OUTPUT: 0

Draws a line from the current point
(COORDS) to the given absolute point X
(0-255), Y (0-175). It computes the
difference against COORDS and uses the
same ROM routine DRAW-LINE (24BAh) as
DRAW; COORDS is set to the target point.
Set the starting point with PLOT.

USAGE:
  extern "zxgfx.kcl";
  {
  plot(0,0); drawto(255,175); /* diagonal
  */
  }

=========================================
 FADEOUT - fade the screen to black
=========================================

INPUT : 1  - arg1 delay (frames 0-255)
OUTPUT: 0

Fades the whole screen to black in 8
steps: each step lowers the INK and PAPER
code by one and clears BRIGHT on all
attributes and on the border (FLASH
stays). arg1 is the delay in frames (1/50
s) before each step: 0 = instant, 2 =
like a demo, 8-12 slow.

USAGE:
  extern "zxgfx.kcl";
  fadeout(2);

=========================================
 PLOT - plot a point
=========================================

INPUT : 2 - arg1 X (0-255), arg2 Y
(0-175)
OUTPUT: 0

USAGE:
  extern "zxgfx.kcl";
  {
  plot(128,88);
  }

=========================================
 POINT - pixel state on screen
=========================================

INPUT : 2 - arg1 X (0-255), arg2 Y
(0-175)
OUTPUT: 1  - 0 or 1 (HL)

USAGE:
  declare int p;
  extern "zxgfx.kcl";
  {
  p=point(100,80); /* p = 1 when the
  pixel is on */
  }

=========================================
 End

