             -----------------------------------
            |           G F A - L I S T         |
             -----------------------------------

A Short (?) summary of all the commands in GFA BASIC 3.0x Interpreter.
I hope it will be to some help...



Chapter 1                THE EDITOR:
                         -----------

Left Arrow, C-Num 4      -    Cursor moves one character left
Right Arrow, C-Num 6     -    Cursor moves one character right
Up Arrow, C-Num 8        -    Cursor moves up one line
Down Arrow, C-Num 2      -    Cursor moves down one line
Insert, C-Num 0, C-N     -    Inserts a blank line at cursor position
Clr/Home                 -    Cursor moves to upper left corner
C-Clr/Home, C-Num 7      -    Jump to beginning of program
C-Z, C-Num 1             -    Jump to the end of the program
Undo                     -    Cancel any changes made to the line
Help                     -    Hides/Shows procedures
C-Help                   -    Hides/Shows all following procedures
Delete,C-Num .           -    Deletes the character at cursor position
Backspace                -    Deletes character left of cursor
Tab                      -    Move cursor eight characters to the right
C-Tab                    -    Move cursor eight characters to the left
Return,Enter             -    Move cursor to next line
ESC                      -    Enter direct mode
C-Delete,C-Y             -    Deletes the line on which the cursor appears
C-U                      -    Restores a line deleted as above
C-Q                      -    Call block menu (like F4)
C-B                      -    Mark beginning of block
C-K                      -    Mark end of block
C-R, C-up arrow          -    Page up
C-C, C-down arrow        -    Page down
C-E                      -    Replace text
Sh-C-E                   -    Find/Replace input text
C-F                      -    Find text
Sh-C-F                   -    Input text and find it
C-left arrow             -    To the beginning of line
C-right arrow            -    To the end of line
C-G                      -    Move to line number display, then enter nr
C-P                      -    Deletes everything to the right of the cursor.
C-O                      -    Brings back the string deleted with C-P

Editor marks can be set by pressing Control and a number between 0 and 9.
Alternate + number moves the cursor to the specified mark.
The numbers 7-9 and 0 are preallocated:
Alt-7                    -    Last cursor position before changing modes
                              or before a program was last Run.
Alt-8                    -    Cursor jumps to its position at the start
                              of the Editor.
Alt-0                    -    Cursor moves to a position where the last
                              change was made.
Alt-9                    -    Cursor moves to the position at which the 
                              last search procedure was started.


Special Commands:

DEFBIT f$
DEFBYT f$
DEFINT f$
DEFWRD f$
DEFFLT f$
DEFSTR f$

f$:string constant

DEFxxx f$

The instruction DEFxxx facilitates variable declaration, where xxx is the
variable type, specified as follows:

DEFBIT "b" !
All variables beginning with letter 'b' or post-fixed with '!' are declared
as Boolean (logical) variables.

DEFBYT "by" |
All variables beginning with the two letters 'by' or post-fixed with '|'
('rule' character) are declared as 1-byte integers.

DEFWRD "w" &
All variables beginning with the letter 'w' or post-fixed with '&' are declared
as 2-byte signed integers.

DEFINT "i-k,m-p" %
All variables beginning with letters from i to k and m to p, or post-fixed with
'% are declared as 4-byte signed integers.

DEFFLT "x-z" #
All variables beginning with letters from x to z, or post-fixed with '#' are
declared as 8-byte floating point (the default variable type).

DEFSTR "s,t" $
All variables beginning with the letters 's' or 't' or ending with '$' are
declared character strings.

Appearances of DEFSNG or DEFDBL will be replaced automatically by 
the Editor with DEFFLT.

These definitions will normally be declared at the beginning of a program,
but may be changed at any time. The post-fixed symbols will always
override any previous global definitions. The default variable type is
floating point.

The above definitions will have no effect on variable which are already in
the program, they only affect those which are still to be typed in.


DEFLIST n
n: integer expression

DEFLIST determined the format of the program listing. The numerical
expression n can take a value between 0 an 3:

     n         Command        variable
---------------------------------------
     0         PRINT          abc
     1         Print          Abc
     2         PRINT          abc#
     3         Print          Abc#

$ text
The command $, which is treated by the Interpreter like a REM, is used for
the control of the compiler.


Chapter 2                VARIABLES AND MEMORY MANAGEMENT
                         -------------------------------
Variable types:

Name      Postfix        Memory requirements           Range
Boolean   !              1 Byte (1 bit in arrays)      0 (FALSE) or -1 (TRUE)
Byte      |              1 Byte                        0 - 255
Word      &              2 Byte                        -32768 - 32767
Integer   %              4 Byte                        -2147483648 - 2147483647
Float     #              8 Byte                        2.225073858507E-308 to
String    $              (Dependent on the length)     3.59538626972E+308

Arrays:

DIM x(d1,[d2,...])[,y(d1,[d2,...])]
DIM?(x())                               Determines the size of an array
OPTION BASE 0 (default)
OPTION BASE 1                           x(0) don't exists
ARRAYFILL x(),y                         Fill x() with y's

Type Transformation:

TYPE(x) => 0 Fp,1 $,2 %,3 !,4 Fp(),5 $(),6 %(),7 !(),8 &,9 |,12 &(),13 
ASC(a$)
CHR$(x)
STR$(x[,y][,z])
BIN$(x[,y])
OCT$(x[,y])
HEX$(x,[y])
STR$(x)
STR$(x,y)           String with y figures
STR$(x,y,z)         ... and z decimal places
VAL(a$)
VAL?(a$)            Determines how many char can be converted
CVD(a$)             8 byte string to GFA BASIC 3 fp format
CVF(a$)             6 byte string into GFA BASIC 1 or 2 floating point
CVI(a$)             2 byte string to integer
CVL(a$)             4 byte string to integer
CVS(a$)             4 byte string containing a valid BASIC compatible 
 number to GFA fp
MKD$(x)             GFA BASIC 3 fp format to 8 byte string 
MKF$(x)             GFA BASIC 1 or 2 floating point to 6 byte string
MKI$(x)             integer to 2 byte string 
MKL$(x)             integer to 4 byte string 
MKS$(x)             GFA fp to 4 byte string
y=CFLOAT(y%)        Changes a integer to a floating-point    
y%=CINT(y)          Changes a floating-point to a integer

Pointer Operations:

PEEK(x) DPEEK(x) LPEEK(x)               Read bytes
POKE x,y  DPOKE x,y  LPOKE x,y          Write bytes
SPOKE x,y  SDPOKE x,y  SLPOKE x,y       Supervisor-state

BYTE{x}    Reads/writes a byte  
CARD{x}    Reads/writes a 2-byte unsigned integer
INT{x}     -      "    -  2-byte signed integer
WORD{x}    Same as INT{x}
LONG{x}    -      "    -  4-byte integer
{x}        -      "        "          -
FLOAT{x}   -      "    -  8-byte variable in BASIC v3 floating point format
SINGLE{x}  -      "    -  4-byte floating point in IEEE single-precision format
DOUBLE{x}  -      "    -  8-byte -           "       -  double-precision format
CHAR{x}    Reads a string until 0 is found, or writes a string + 0
VARPTR(x)  Returns the address of variable x  
V:x        -              "                -
ARRPTR(y) Returns address of variables or (string,array) the Descriptor
*y        -              "              "              "            -
ABSOLUTE x,y   Variable x gives address y

Deleting an Exchanging:

CLEAR               All variables
CLR x[,y...] 
ERASE z1()[,z2(),...]
SWAP a,b            Change variables
SWAP e(),f()        Swap arrays
SWAP *c,d()         Used for indirect passing of arrays to subroutines.
QSORT a(s)[,n][,j%()]
QSORT x$(s) [OFFSET o] [WITH i()] [,n[,j%()]]
SSORT a(s)[,n][,j%()]
SSORT x$(s) [OFFSET o] [WITH i()] [,n[,j%()]]
 a():  arbitrary array, or string array
 i():  Integer-array (|,& or %)
 j%(): 4-byte integer array
 x$(): String array
 n:    integer expression
 s:    +,- or no sign
INSERT x(i)=y       Insert element in array
DELETE x(i)         Delete elements in arrays.

Reserved Variable Names:

FALSE               0
TRUE                -1
PI                  3.14159265359
DATE$               Current Date
TIME$               Current Time
SETTIME time$,date$
TIMER               Elapsed time in 1/200 seconds since system was started.

Special Commands:

LET x=y             Same as x=y
VOID                Forget the returned value: VOID INP(2)
~                   Same as VOID

Memory Management:

BMOVE source,destination,length    Block move
BASEPAGE            Address of GFA Interpreters Basepage
HIMEM               First free memory location not used by BASIC
RESERVE [n]         Specify size of storage area used by GFA BASIC
INLINE addr,length  Allows mcode-prg to be place inside program.
 Place cursor on INLINE and press HELP then a separate menu line appears
 where you can LOAD and SAVE data, DUMP it to printer or CLEAR it. 
MALLOC(x)           Used to reserve ALLOCate areas of memory. If x=-1 it
 returns the largest contiguous free area. x pos then reserve x bytes.
 Function returns 0 if error occurred.
MFREE(x)            Releases storage area. x specify start address of area
 (returned by MALLOC). Functions returns 0 if all was ok.
MSHRINK(y,x)        Reduces storage area. y specify start address from
 MALLOC, and z gives the required (shrunk) size)


Chapter 3                     OPERATORS
                              ---------
Arithmetic operators:

+, -, *, /, ^
DIV, \              Fast integer division
MOD                 Remainder of division x by y

Logical Operators:

AND
OR
XOR
NOT
IMP                 Result only FALSE if a FALSE expression follows a TRUE.
EQV                 Same as NOT(x XOR y)

Comparison Operators:

=
==                  Approximate equality
>=
<=
<>

Operator Hierarchy:

()                       Brackets
+                        Character string addition
=< >= => <= <>           Character string comparison
+ -                      Signing
^                        Exponentiation
* /                      Multiplication, Division
DIV MOD                  Integral and modulo division
+ -                      Addition, subtraction
= == < <= >= > <>        Numeric and logical comparison
AND OR XOR IMP EQV       Logical operators
NOT                      Negation


Chapter 4                NUMERICAL FUNCTIONS
                         -------------------

Mathematical Functions:

ABS(s)
SGN(s)
ODD(s)
EVEN(s)
INT(x)
TRUNC(x)
FIX(x)
FRAC(x)
ROUND(x[,n])
MIN(x[,y,z,...])         Returns the minimum variable
MIN(x$[,y$,z$,...])
MAX(x[,y,z,...])         Return the maximum variable
MAX(x$[,y$,z$,...])
SQR(x)
EXP(x)
LOG(x)
LOG10(x)
SIN(x)
COS(x)
TAN(x)
ASIN(x)
ACOS(x)
ATN(x)
DEG(x)                   Convert Rad to Degrees
RAD(degrees)             Convert Degrees to rad
SINQ(degrees)            10 times faster as SIN, but not as accurate
COSQ(degrees)

Random Number Generation:

RND[(x)]                 Gives random number between 0 and 1. x no meaning.
RANDOM(x)                Produces random between 0 and x.
RAND(y)                  Produces a 16-bit random integer from 0 to y-1
RANDOMIZE y              Initialises random generator

Integer Arithmetic:

DEC i
INC i
ADD x,y
SUB x,y
MUL x,y
DIV x,y
PRED(i)                  Returns the next lower number than the argument.
SUCC(i)                  -       "     -  higher -      "       "     -
ADD(x,y)                 Quick integer arithmetic with polish notation.
SUB(x,y)
MUL(x,y)
DIV(x,y)
MOD(x,y)

Bit operations:

BCLR(x,y)                Clear bit y in x
BSET(x,y)                Set bit y in x  
BTST(x,y)                Test bit y in x. TRUE if bit=1  
BCHG(x,y)                If bit y in x=1 -> 0 and vice versa
SHL(x,y), SHL&(x,y), SHL|(x,y)     Shift left 32-bit, 16-bit, 8-bit
SHR(x,y), SHR&(x,y), SHR|(x,y)     Shift right
ROL(x,y), ROL&(x,y), ROL|(x,y)     Rotate Left
ROR(x,y), ROR&(x,y), ROR|(x,y)     Rotate Right
AND(x,y)
OR(x,y)
XOR(x,y)
IMP(x,y)
EQV(x,y)
SWAP(x)                  Exchanges upper and lower word in a longword.
BYTE(x)                  Returns the lower 8 bits
CARD(x)                  -        -       -16 bits
WORD(x)                  Converts a word to long word length with sign.


Chapter 5                STRING MANIPULATION
                         -------------------
LEFT$(a$[,x])
RIGHT$(a$[,x])
MID$(a$,x[,y])
PRED(a$)       Supplies the character with ASCII code one less than that
 of the first character of the specified string.
SUCC(a$)       Returns character with ASCII code one greater than that of 
 the first character of the string specified.
LEN(a$)
TRIM$(a$)      Removes spaces from the left and right ends of a string.
INSTR(a$,b$)        Searches a$ for occurrence of b$
INSTR(a$,b$,[x])
INSTR([x],a$,b$)
RINSTR(a$,b$)       Reverse INSTR (begins from the end.)
RINSTR(a$,b$,[x])
RINSTR([x],a$,b$)
STRING$(x,a$)       Produces a string with x a$
STRING$(x,code)
SPACE$(x)           Produces a string with x spaces.
SPC(x)              Inserts x spaces in a PRINT statement
UPPER$(a$)          All lowercase are converted to upper-case.
LSET a$=b$          Sets b$ into a$ justified to the left.
RSET a$=b$          -              "         -       right
MID$(a$,x[,y])      As an instruction to replace a$ into x

Chapter 6           INPUT AND OUTPUT
                    ---------------
Keyboard and screen handling:

INKEY$
INPUT ["text",]x[,y,...]
INPUT ["text";]x[,y,...]
LINE INPUT ["text",]a$[,b$...]
LINE INPUT ["text";]a$[,b$...]
FORM INPUT n,a$          Input n characters to a$.
FORM INPUT n AS a$       Displays a$ which then can be edited
PRINT
PRINT expression
PRINT AT(column,row);expression
WRITE expression
LOCATE row,column
PRINT USING format$,expression[;]
PRINT AT(column,line);USING format$,expression[;]
 format$ for numbers:
 #        Reserves a character position for a number
 .        Specifies position of decimal point
 ,        Specifies insertion of commas
 -        Reserves a character position for sign
 +        Reserves a char position for plus sign
 *        As # but leading zeros are replace by asterisks
 $        Causes a $ char to be printed before number
 ^        Specifies length of exponent
 format$ for strings$
 &        Causes output of the entire string
 !        Only the first character is printed
 \...\    Specifies the number of characters of the string to be printed
 _        Causes the output of the character following the '_' character.
MODE n    Representation of decimal points etc:
    Mode  USING          DATE$
     0    #,###.##       17,09,1989
     1    #,###.##       09/17/1989
     2    #.###,##       17,09,1989
     3    #.###,##       09/17/1989
DEFNUM n            Number of digits that will be shown by PRINT etc
CRSCOL              Current column position
CRSLIN              Current line position
POS(x)              Number of characters since the last CR
TAB(n)              TAB(n) prints space until POS(0) reaches n.
HTAB column         Positions cursor to column column
VTAB line           Positions cursor to line line
KEYPAD n       N has the following meaning:
 Bit      Meaning                  0                   1
------------------------------------------------------------
 0        NUMLOCK                  On                  Off
 1        NUMLOCK                  Not switchable      Switchable
 2        CTRL-KEYPAD              Normal              Cursor
 3        ALT-KEYPAD               Normal              ASCII
 4        KEYDEF without ALT       Off                 On
 5        KEYDEF with ALT          Off                 On
KEYTEST n      Similar to INKEY$, but also scan codes etc (see KEYGET)
KEYGET n       Waits for key and return a long word value:
 Bits 0-7:     The ASCII code
 Bits 8-15:    Zero
 Bits 16-23:   The Scan Code
 Bits 24-31:   Status of Shift, Control, Alternate, Caps Lock :
 Bit           Key
-------------------
 0             Right Shift
 1             Left Shift
 2             Control
 3             Alternate
 4             Caps Lock
KEYLOOK n      Read a character from keyboard buffer, without changing its
 contents
KEYPRESS n     Simulate pressing of a key 
KEYDEF n,s$    Define strings to function keys. Must use KEYPAD 16 before.
 If the string are to be used in the Editor, Alternate must also be pressed.

Data Input and Output:

DATA const[,const1,const2,...]
READ var[,var1,var2,...]
RESTORE [label]

File Management:

DFREE(n)            Amount of free space on drive n
CHDRIVE n or n$     Sets default drive
DIR$(n)             Returns a string with current path for drive. 
CHDIR name$         Sets current directory
DIR p$ [TO name$)   p$:path$  name$:device (PRN:,CON: etc or file)
FILES p$ [TO name$) With length  
FGETDTA                  Read the disk transfer address.
FSETDTA(addr)            Set the DTA address  
FSFIRST(p$,attr)         Searches the first file with matches p$  
FSNEXT()                 Searches the next file.
MKDIR name$              Create a directory
RMDIR name$              Remove directory

Files:

EXIST(name$)             Check if file name$ exist
OPEN mode$,#n,name$[,len]     Opens a data channel to a file or to a
 peripheral device.
 mode$:  O (output)           A file is opened to receive data
         I (input)            A file is opened for reading
         A (append)           An existing file is open and pointer to end.
         U (update)           An existing file is opened for write and read.
         R (Random Access)    A random access file is opened for read and write.
 n: a number between 0 and 99
 instead of a filename a device can be specified. Len is for Random-access.
         LST:(list)               Printer
         AUX:(auxiliary)          Serial (RS232)
         CON:(console)            Keyboard/Screen
         MID:(MIDI)               MIDI Interface
         IKB:(intelligent kbd.)   Keyboard Processor
         VID:(video)              Screen
LOF(#n)        Length of file
LOC(#n)        Returns current position of data pointer
EOF(#n)             -1 if pointer at end of file 
CLOSE[#n]           If channel number omitted, all channels are closed
TOUCH[#]n           Updates date and time stamps of a file.
NAME old$ AS new$   
RENAME old$ AS new$ Same as NAME
KILL name$          Delete file name$
BLOAD name$[,addr]  Binary load.
BSAVE name$,addr,count 
BGET #n,addr,count       Load count bytes from #n to addr
BPUT #n,addr,count       Write count bytes to #n from addr 

Sequential Access:

INP(#n)             Get a 8-bit value from channel n 
INP&(#n)            Get a 16-bit value from channel n
INP%(#n)            Get a 32-bit value from channel n
OUT #n,a[,b,c,..]   Put a 8-bit value to channel n
OUT& #n...          16-bit
OUT% #n...          32-bit
INPUT$(count[,#n])  Read 'count' characters from keyboard or file
INPUT #n,var1[,var2,var3,...]
LINE INPUT #n,a1$[,a2$,a3$,...]
PRINT #n,expression
PRINT #n,USING form$,expression
WRITE #n,expression
STORE #n,x$()[,n [TO m]]      Used for sending contents of an array to a file
RECALL #n,x$(),n [TO m] ,x    Get array from file. x contains number read.
SEEK #n,pos
RELSEEK #n,num

Random Access:

FIELD #n,num AS svar$[,num AS svar$,num AS svar$,...]
FIELD #n,num AT(x)[,num AT(x),num AT(x),..]  
GET #n[,r]
PUT #n[,r]
RECORD #n,r

Communicating with Peripherals:

INP(n)         Get a character from device:
     n    Contraction              Meaning
     0    LST:(list)               Printer
     1    AUX:(auxiliary)          Serial (RS232)
     2    CON:(console)            Keyboard/Screen
     3    MID:(MIDI)               MIDI Interface
     4    IKB:(intelligent kbd.)   Keyboard Processor
     5    VID:(video)              Screen
INP?(n)        Test status of device (see above)  
OUT [#]n,a[,b,c,..
OUT?(n)        Test output status
INPAUX$        Read data (fast!) from RS232 interface
INPMID$        Read data (fast!) from MIDI interface
MOUSEX         Mouse x-pos
MOUSEY         Mouse y-pos
MOUSEK         Mouse k : 0=none, 1=Left, 2=Right, 3=Both
MOUSE mx,my,mk The above information is given to variables mx,my and mk.
SETMOUSE mx,my[,mk] Positions the mouse. mk simulates mouse buttons.
HIDEM          Hide Mouse
SHOWM          Show Mouse
STICK m        STICK 0 cause Port 0 to supply mouse info, STICK 1 cases
 it to supply joystick info. Port 1 always read joystick.
STICK(p)       Return position of a joystick:
               5  1  9
                \ | /
             4 -- 0 -- 8
                / | \
               6  2  10
STRIG(p)       Return state of fire button of joystick in port p.

Printing:

LPRINT expression
LPOS(x)        Returns the numbers of characters printed since last CR.
HARDCOPY       Alt+Help

Sound Generation:

SOUND chan,vol,note,octave,del
SOUND chan,vol,#per,del
WAVE voice,env,form,per,del
 Chan: 0-3, Vol: 1-15, Note: 1-12, Octave: 1-8, Del: Delay in 1/50:th second
 before next GFA BASIC command is executed, Per: period of waveform multiplied
 by 125000,  
 Voice: 256 * period of noise (0-31) + sum of following:
 1 = Channel 1      2 = Channel 2       4 = Channel 3
 8 = Noise Ch 1    16 = Noise Ch 2     32 = Noise Ch 3
 Env: channels for which 'form' is to be active: 1=Ch 1,2=Ch 2,4=Ch 3
 Form: 0-15:
 0 to 3 = as 9                          4 to 7 = as 15
 8 = Falling saw tooth                  9 = Falling linearly
 10 = Triangle, beginning with fall     11 = Falling linearly, then to max
 12 = Rising saw tooth                  13 = Rising linearly and holding
 14 = Triangle, beginning with rise     15 = Linearly rising, the to zero


Chapter 7           PROGRAM STRUCTURE
                    -----------------
Decision Commands:

IF condition [THEN]
ELSE or ELSE IF condition
ENDIF  

Multiple Branching:

ON x GOSUB proc1, proc2,...

SELECT x
CASE y [TO z] or CASE y[,z,...] 
CASE TO y
CASE y TO
DEFAULT
ENDSELECT
CONT

Loops:

FOR c=b TO or DOWNTO e [STEP s]  ...... NEXT c
REPEAT ..... UNTIL condition
WHILE condition  ..... WEND
DO ... LOOP         Continuous loop exitted with EXIT IF or GOTO 
DO UNTIL condition ... LOOP
DO WHILE condition ... LOOP
LOOP UNTIL condition
LOOP WHILE condition
EXIT IF condition

Procedures and Functions:

GOSUB proc[(par1,par2,...)]
PROCEDURE proc[(var1,var2,...)]
RETURN

VAR
LOCAL var1[,var2,var3,...]

x=@func[(par1,par2,...)] or x$=@func$...
FUNCTION func[(var1,var2,...)]
RETURN exp
ENDFUNC

DEFFN func[(x1,x2,...)]=expression
FN func[(y1,y2,...)] 

Error Handling:

ON BREAK                 Activate ctrl+shift+alt
ON BREAK CONT            Turn off ctrl+shift+alt
ON BREAK GOSUB proc

ON ERROR                 Normal error-trapping
ON ERROR GOSUB proc
RESUME [NEXT]            Continue with next instruction
RESUME [label]           Continue at label

ERR                 Returns error number
ERR$(x)             Returns, as a string, GFA BASIC error message.
ERROR x             Generate error x.
FATAL                    TRUE if error generates an unknown address.

Interrupt Programming:

AFTER CONT          Allow AFTER-interrupt
AFTER STOP          Disable AFTER-interrupt
AFTER ticks GOSUB proc 
EVERY CONT          Allow EVERY-interrupt
EVERY STOP          Disable EVERY-interrupt
EVERY ticks GOSUB proc 

Other Commands:

REM x or 'n or <commands> !x
GOTO label
PAUSE x             suspend program execution for x/50 seconds
DELAY x             x specified in seconds with millisecond resolution. GEM.
END
EDIT                Terminates execution and returns to the editor
STOP
NEW
LOAD f$             Loads a GFA-BASIC program
SAVE f$
PSAVE f$            Protected save
LIST [f$]
LLIST [f$]     Lists to printer. In the program you can define things by
 the point commands:
 .ll xx         Max line length
 .pl xx         Max page length
 .ff xxx        Form feed character. (.ff 012 is default)
 .he head       Head to be put on the first line of each page
 .fo foot       Text to be put on the last line of each page
 .lr xx         Left margin
 .l-            Turn off printing for the following lines
 .l+            Turn on printing
 .n1 to .n9     Switch on line numbering with up to nine figures.
 .n0            Switch off line numbering
 .PA            Forces a form feed.
 .P-            the point commands are NOT listed
 .P+            the point command ARE listed, as usual.
 In the header and footer text the following can also be inserted:
 \xxx           The ASCII character xxx
 \d             Date
 \t             Time
 #              Page number
 (To print \ and #, use \\ and \# )
CHAIN f$            Loads a GFA BASIC program and starts it 
RUN [f$]            Eventually run a file
SYSTEM [n]          n:return value
QUIT [n]

Program Tracing:

TRON                Trace on
TRON #n             Trace to channel n
TROFF
TRON proc           proc is called before every instruction in the program.
TRACE$              the command which will processed next
DUMP [a$ [TO b$]]   The contents of variables can be displayed during a
 program run; or labels, procedures and functions listed.
DUMP      Returns all values of variables and the dimensioning of arrays
DUMP "a"  As above but only for variables beginning with 'a'. 
DUMP ":"  Lists all labels and specifies where each label is used (also ':b')
DUMP "@"  Lists all procedures and functions and specifies where each is found.
Also output to a file with [TO b$].

Chapter 8                GRAPHICS DEFINITION COMMANDS
                         ----------------------------
SETCOLOR register,red,green,blue
SETCOLOR register,composite   composite=red*256+green*16+blue*1
COLOR colour
VSETCOLOR colour,red,green,blue
VSETCOLOR colour,composite
DEFMOUSE symbol or bitpattern$        Symbol : 
 0 -> Arrow, 1 -> Double clip, 2 -> Bee, 3 -> Pointing hand, 4 -> Open hand, 5 -> Thin
 cross hairs, 6 -> Thick cross hairs, 7 -> Bordered cross hairs
Bitpattern$ :  MKI$(x-coord action point)+MKI$(y-coord action point)+
 MKI$(1)+ !normal -1=XOR!  +MKI$(mask colour)+MKI$(pointer colour)+mask$+cursor$
DEFMARK [colour],[type],[size]   Defines point for POLYMARK. Type :
 1 -> Full-stop, 2 -> Plus-sign, 3 -> Star, 4 -> Rectangle, 5 -> Cross, 6 -> Diamond
DEFFILL [colour],[style],[pattern] 
DEFFILL [colour],bitpattern$       32 byte string (16x16 pixels)
BOUNDARY n               Switches on and off border drawn with PBOX, PCIRCLE etc
DEFLINE [style],[thickness],[begin_s, end_s]   begin,end_symbols: 
 0 -> Square, 1 -> Arrow, 2 -> Round 
DEFTEXT [color],[attr],[angle],[height],[fontnr]
GRAPHMODE n    1-->replace, 2-->transparent, 3-->xor, 4-->reverse 
 transparent

General Graphic Commands:

CLIP x,y,w,h [OFFSET x0,y0]       \
CLIP x1,y1 TO x2,y2 [OFFSET x0,y0] |
CLIP #n [OFFSET x0,y0]              >  Limit graphic output
CLIP OFFSET x,y                    |
CLIP OFF                          /

PLOT x,y
LINE x1,y1,x2,y2
DRAW [x1,y1][TO x2,y2][TO x3,y3][TO...]
DRAW [TO][x,y] 
DRAW expression
 Commands:
 FD  n         ForwarD        Move pen n pixels forward
 BK  n         BacKward       Moves pen backward
 SX  x         Scale x        Scale pen movement for FD and BK
 SY  y         Scale y
 LT  a         Left Turn      Turn pen left by 'a' degrees
 RT  a         Right Turn     Turn pen right by 'a' degrees
 TT  a         Turn To        Turn pen to absolute angle
 MA  x,y       Move Absolute
 DA  x,y       Draw Absolute
 MR  xr,yr     Move Relative
 DR  xr,yr     Draw Relative
 CO  c         Colour
 PU            Pen up
 PD            Pen Down
 Additional variables:
 DRAW(0)       returns x-position
 DRAW(1)       returns y-position
 DRAW(2)       returns angle in degrees
 DRAW(3)       returns x-axis scale factor
 DRAW(4)       returns y-axis scale factor
 DRAW(5)       returns pen flag (-1=PD, 0=PU)
SETDRAW s,y,w  An abbreviation for the expression DRAW "MA",x,y,"TT",w
BOX x1,y1,x2,y2     Draw a rectangle
PBOX x1,y1,x2,y2    Filled rectangle
RBOX x1,y1,x2,y2    Draw a rectangle with round off corners
PRBOX x1,y1,x2,y2   draw a filled rectangle -    "       -
CIRCLE x,y,r[,w1,w2]     Draw circle at x,y with radius r. w1,w2 specifies
 start and end angle in 1/10th of a degree. (0 - 3600)
PCIRCLE             Filled circle
ELLIPSE x,y,rx,ry[,w1,w2] Draw an ellipse
PELLIPSE            Filled ellipse
CURVE x0,y0,x1,y2,x2,y2,x3,y3 Draws a curve with the best approximation
 between the point according to Bezier. It starts at x0,y0 and ends at
 x3,y3. The curve at x0,y0 is at a tangent with a line form x0,y1 to
 x1,y1; and at x3,y3 is at a tangent with a line between x3,y3 and x2,y2.
 This command exists only in GFA BASIC 3.07 and onwards.
POLYLINE n,x(),y()[OFFSET x_off,y_off]  Draw a polygon with n corners.
 The x and y -coordinate is in x() and y(), first in x(0) and last in x(n-1)
POLYMARK n,x(),y() [OFFSET x_off,y_off] Marks the corner points
POLYFILL n,x(),y()[OFFSET x_off,y_off]  Draw a filled polygon
POINT(x,y)          Returns colour of point x,y
FILL x,y[,f]        fill. Limiting edge in colour f.
CLS[#n]             Clear screen
TEXT x,y[,l],expression  Output text at x,y. L set length of text in
 pixels. If positive spaces are inserted. If negative the size of space 
 is changed.
SPRITE bit_pattern$[,x,y]  bit_patter$=MKI$(x-coord of action point)+
 MKI$(y-coord of a.p.)+MKI$(0:normal,-1:XOR)+MKI$(mask colour)+MKI$(spr col)+
 sprite$. Data in sprite$ is alternating by data and mask.

Grabbing sections of screen:

SGET screen$        Copy entire screen (32000 bytes) to screen$
SPUT screen$
GET x1,y1,x2,y2,section$ Put section of screen into section$
PUT x1,y1,section$[,mode] mode:3=replace,4=xor,7=transparent,13=inv.trans.
VSYNC               Wait for VSYNC
BITBLT s_mfdb%(),d_mfdb%(),par%()  Copies screen sections (advanced!)




Chapter 9 EVENT, MENU AND WINDOW MANAGEMENT:
          ---------------------------------

Event management:

ON MENU [t]    Before using it, the reaction should be specified with an
 ON MENU xxx GOSUB. ON MENU command is normally found in a loop.
 t contains the time in milliseconds before command is terminated.
MENU(x)        MENU(-2) to MENU(15) contain variables from an event
 MENU(-2) and MENU(-1)   address of message buffer.
 MENU(1) = 10       A Menu item was chosen:
     MENU(0)             Menu item index in the item list
     MENU(4)             Object number of the menu title
     MENU(5)             Object number of the chosen menu item
 MENU(1) = 20       A redraw of a rectangular window area is required:
     MENU(4)             Identification number (handle) of the window
     MENU(5),(6)         Top left coord
     MENU(7),(8)         Width and height
 MENU(1) = 21       A window was clicked (this normally means activate)
     MENU(4)             ID of clicked window
 MENU(1) = 22       The 'Close' box was clicked
     MENU(4)             ID of window
 MENU(1) = 23       The 'Full' box was clicked
     MENU(4)             ID of window
 MENU(1) = 24       One of the four arrow boxes or a slider bar area
     MENU(4)             ID of window
     MENU(5)             The area that was clicked:
                         0:   Above vertical slider
                         1:   Below vertical slider
                         2:   Up arrow
                         3:   Down arrow
                         4:   Left of horiz slider
                         5:   Right of horiz slider
                         6:   Left arrow
                         7:   Right arrow
 MENU(1) = 25       The horizontal slider was moved:
     MENU(4)             ID of window
     MENU(5)             Position of the moved slider (1-1000)
 MENU(1) = 26       The vertical slider was moved:
     MENU(4)             ID of window
     MENU(5)             Position of the moved slider (1-1000)
 MENU(1) = 27       The size of the window was changed with 'sizing' box
     MENU(4)             ID of window
     MENU(5),(6)         New x and y coordinates of top left corner
     MENU(7),(8)         New width and height of the window
 MENU(1) = 28       The position of a window was changed:
     MENU(4)             ID of window
     MENU(5),(6)         New x and y coordinates of top left corner
     MENU(7),(8)         New width and height of the window
 MENU(1) = 29       A new GEM window was activated
     MENU(4)             ID of window
 MENU(1) = 40       An accessory was selected
     MENU(5)             Menu ID of the accessory
 MENU(1) = 41       An accessory was closed
     MENU(5)             Menu ID of the accessory
 The variable MENU(9) contains bit information on which kind of event has
 occurred. If the bit for the appropriate event is set, the variables MENU(9)
 to MENU(15) and GINTOUT(0) to GINTOUT(7) will contain information as follows:
 MENU(9)  Bit 0 --> Keyboard
          Bit 1 --> Mouse button
          Bit 2 --> Mouse has entered/left rectangle 1
          Bit 3 --> Mouse has entered/left rectangle 2
          Bit 4 --> A message arrived in the message buffer
          Bit 5 --> Timer event
 MENU(10)           x-position of mouse when event terminated
 MENU(11)           y-position -         "         "        -
 MENU(12)           Mouse buttons pressed:
              0 --> None
              1 --> Left
              2 --> Right
              3 --> Both buttons
 MENU(13)           supplies the status of the keyboard 'shift' keys:
          Bit 0 --> Right shift
          Bit 1 --> Left shift
          Bit 2 --> Control
          Bit 3 --> Alternate
 MENU(14)           gives information about a pressed key.
 MENU(15)           returns the number of mouse clicks that cause the event.
ON MENU BUTTON clicks,but,state GOSUB proc
 clicks > number of clicks              button > 0:any?,1:Left,2:Right,3:Both
 state > event if 0:but. up,1:but. down proc > name of procedure
ON MENU KEY GOSUB proc  If a keys is pressed during and ON MENU command
ON MENU IBOX n,x,y,b,h GOSUB proc  If mouse enters area, jump to proc
ON MENU OBOX n,x,y,b,h GOSUB proc  If mouse leaves -    "     "     -
ON MENU MESSAGE GOSUB proc  If message arrive in message buffer (see MENU(x))
ON MENU GOSUB proc  If a menu item is selected, jump
MENU m$()           put menu in m$ on screen:
 m$(0)              Heading of first menu in which accessories can exist
 m$(1)              Name of first entry in the first menu
 m$(2)              A line of minus signs
 m$(3)-m$(8)        Reserved space (1 char) for accessories.
 m$(9)              an empty string which mark end of first menu
 Format of further menus:
 1. Heading of menu
 2. List of menu entries
 3. An empty string
MENU OFF            Returns a menu title to 'normal video'
MENU KILL           Deactivates a menu and turns off ON MENU GOSUB
MENU x,y            The x-th entry can be given attributes:
     y     Effect
     0 --> Tick to be removed, if present, from in front of a menu item.
     1 --> Tick to be installed in front of a menu item
     2 --> Menu item to be made non-selectable
     3 --> Menu item to be made selectable

Window Commands:

OPENW nr [,x_pos,y_pos]   Open window
OPENW #n,x,y,w,h,attr
CLOSEW nr
CLOSEW #n
W_HAND(#n)               Return GEM-handle of window n
W_INDEX(#hd)             Returns window nr for specified GEM handle
CLEARW[#]n               Clear window
TITLEW [#]n,title$       Set title to window
INFOW [#]n,info$         Set info title
TOPW #nr                 Activate window nr
FULLW [#]n               Make window large
WINDTAB                  Gives the address of Window Parameter table
WINDTAB(i,j)             i:window nr j:0=handle, 1=attributes, 2=x-coord, 
  3=y-coord, 4=width, 5=height
RC_INTERSECT(x1,y1,w1,h1,x2,y2,w2,h2)  Used to find whether two rectangles
overlap. If overlap, TRUE is returned, and x2,y2,w2,h2 contains the common area.
If not x2,y2,w2,h2 contains the rectangle which lies between the two specified
rectangles.
RC_COPY s_adr,sx,sy,w,h TO d_adr,dx,dw[,m]  Used to copy rectangular screen
sections between areas of memory.
ALERT symbol,text$,default,button$,choice   Create an alert box
FILESELECT #title$,path$,default$,name$     Create a File-Select box. title$ is
 only valid for TOS 1.4 else ignored.


Chapter 10               SYSTEM ROUTINES:
                         ----------------
GEMDOS(n[,n,y...])       Call GEMDOS with parameters
BIOS(n[,x,y...])         Call BIOS with parameters
XBIOS(n[,x,y...])        Call XBIOS with parameters
L:x                      Pass a numerical expression as a longword
W:x                      -           "        "       -   word

LINE-A Calls:

ACLIP flag,xmin,ymin,xmax,ymax     Define clipping rectangle for LINE-A
PSET x,y,f                         As PLOT f: colour
PTST(x,y)                          As POINT()
ALINE  x1,y1,x2,y2,colour,linestyle,mode     As LINE
HLINE x1,y,x2,f,m,addr,num_pattern           Similar to ALINE but only horiz
APOLY adr_pnt,num_pnt,y0 TO y1,colour,mode,addr,num_pattern   As POLYFILL
ARECT x1,y1,x2,y2,colour,mode,addr,num_pattern    As PBOX
BITBLT adr%                        Advanced, simulates blitter actions.
BITBLK x%()
ACHAR code,x,y,font,style,angle
ATEXT x,y,font,s$
L~A                           Returns base address of LINE-A variables

VDI Routines:

CONTRL                   address of the VDI control table
INITIN                   address of the VDI integer input table
PTSIN                    address of the VDI point coordinate input table
INTOUT                   address of the VDI integer output table
PTSOUT                   address of the VDI point coordinate output table
VDISYS [opcode[,c_int,c_pts[,subopc]]]  Call VDI-function
VDIBASE                  address of base for VDI
WORK_OUT(x)              get variables from VDI
GDOS?                    Check if GDOS is present
V~H                      Returns or sets the internal VDI handle
V_OPNWK(id)              Open workstation
V_OPNWK(id,1,1,1,1,1,1,1,1,1,2) Default values
V_CLSWK()                Close workstation
V_OPNVWK(id)             Open Virtual Workstation
V_OPNVWK(id,1,1,1,1,1,1,1,1,1,2) Default values
V_CLSVWK(id)             Close
V_CLRWK()                Clear workstation
V_UPDWK()                Sends buffered graphic instructions to device
VST_LOAD_FONTS(x)        Loads the additional character sets in ASSIGN.SYS
VST_UNLOAD_FONTS(x)      removes characters
VQT_EXTENT(text$[,x1,y1,x2,y2,x3,y3,x4,y4]) Returns corner coord of the
 rectangle surrounding text in text$. x1,y1 Top left, x2,y2 Top right
 x3,y3 Bottom right, x4,y4 Bottom left
VQT_NAME(i,font_name$)   Supplies the handle of the font with ID 'i'

Non-BASIC Routine Calls:

C:addr([x,y,...])        Calls a C or assembler subroutine  
MONITOR[x]               Call a debugger with 'illegal instruction vector'.
CALL addr([x,y,...])
RCALL addr,reg%          Data register d0 to d7 <--> reg%(0) to reg%(7)
                         Address reg   a0 to a7 <--> reg%(8) to reg%(14)
                         User SP       (a7)     <--> reg%(15) return only
EXEC mode,name,cmdline,envs  
 Mode :  0 -> Load and Start program.  1 -> Load program only.




 Chapter 11         AES LIBRARIES:
                    -------------
GCONTRL                  address of the AES Control block
ADDRIN                   address of the AES Input Block
ADDROUT                  address of the AES Output Block
GINTIN                   address of the AES Integer Input block
GINTOUT                  address of the AES Integer Output Block
GB                       address of the AES Parameter Block
GEMSYS n                 Calls an AES routine by routine number

Object Structure:

Offset    Contents  Type      Meaning
00        ob_next   word      pointer to the next object
02        ob_head   word      pointer to the first child
04        ob_tail   word      pointer to the last child
06        ob_type   word      type of object
08        ob_flags  word      object information (see below)
10        ob_state  word      status of the object (see below)
12        ob_spec   long      pointer to further information (see below)
16        ob_x      word      x-position of the object
18        ob_y      word      y-position of the object
20        ob_w      word      width of the object
22        ob_h      word      height of the object


OB_NEXT        points to the following object on the same level, or, if it
               is the last object on that level, to the parent object, or
               contains -1 if none.
OB_HEAD        points to the object's first child, or contains -1 if none.
OB_TAIL        points to the object's last child, or contains -1 if none.

Depending on value in OB_TYPE, OB_SPEC has the address of different data
structures as shown in the following table:
OB_TYPE                  OB_SPEC
------------------------------------------------------
20        G_BOX          BOX info, see below
21        G_TEXT         Pointer to TEDINFO graphic text
22        G_BOXTEXT      Pointer to TEDINFO text-in-a-box
23        G_IMAGE        Pointer to BITBLK bit image graphic
24        G_USERDEF      Pointer to USERBLK structure
25        G_IBOX         BOX info, see below
26        G_BUTTON       Pointer to centred C-string, to go in a box
27        G_BOXCHAR      BOX info, see below
28        G_STRING       Pointer to C-string menu item structure
29        G_FTEXT        Pointer to TEDINFO editable graphic text
30        G_FBOXTEXT     Pointer to TEDINFO editable text-in-a box
31        G_ICON         Pointer to ICONBLK structure
32        G_TITLE        Pointer to C-string menu title structure

BOX-info:

Bits 0-3: Colour of object interior (0 to 15), 
     4-6: Fill pattern (0 to 7),
       7: Text mode (0=transparent,1=overwritten), 
    8-11: Text colour (0 to 15),
   12-15: Border colour (0 to 15), 
   16-23: (0=no border, 1 to 128 = the border extends into the object for 
           between 1 and 128 pixels, -1 to -128 = the border extends for 
           between 1 and 128 pixels outside the object), 
   24-31: Only used in G_BOXCHAR for the ASCII code to appear in the box.

OB_FLAGS          Hex      Bit no.
---------------------------------
NORMAL            &H0000      -
SELECTABLE        &H0001      0
DEFAULT           &H0002      1
EXIT              &H0004      2
EDITABLE          &H0008      3
RBUTTON           &H0010      4
LASTOB            &H0020      5
TOUCHEXIT         &H0040      6
HIDETREE          &H0080      7
INDIRECT          &H0100      8

OB_STATE          Hex      Bit no.
----------------------------------
NORMAL            &H0000      -
SELECTED          &H0001      0
CROSSED           &H0002      1
CHECKED           &H0004      2
DISABLED          &H0008      3
OUTLINED          &H0010      4
SHADOWED          &H0020      5

The structures described are address in GFA BASIC 3 with the following 
syntax (for both reading and writing):
OB_NEXT(tree%,obj&)
OB_HEAD(tree%,obj&)
OB_TAIL(tree%,obj&)
OB_TYPE(tree%,obj&)
OB_FLAGS(tree%,obj&)
OB_STATE(tree%,obj&)
OB_SPEC(tree%,obj&)
OB_X(tree%,obj&)
OB_Y(tree%,obj&)
OB_W(tree%,obj&)
OB_H(tree%,obj&)

Text Data Structure (TEDINFO)

Offset    Contents       Type      Meaning
-------------------------------------------------
00        te_ptext       long      Pointer to text
04        te_ptmplt      long      Pointer to text mask
08        te_pvalid      long      Pointer to validation string for input
12        te_font        word      Font
14        te_resvd       word         -reserved-
16        te_just        word      Text justification
18        te_colour      word      Colour of the surrounding box
20        te_resvd2      word         -reserved-
22        te_thickness   word      Character thickness
24        te_txtlen      word      Text length
26        te_tmplen      word      Text mask length

Icon Data Structure (ICONBLK)

Offset    Contents       Type      Meaning
--------------------------------------------------
00        ib_pmask       long      Pointer to icon mask
04        ib_pdata       long      Pointer to icon data
08        ib_ptext       long      Pointer to icon text
12        ib_char        word      The single character within the icon
14        ib_xchar       word      x-position of the character
16        ib_ychar       word      y-position of the character
18        ib_xicon       word      x-position of the icon
20        ib_yicon       word      y-position of the icon
22        ib_wicon       word      Width of the icon
24        ib_hicon       word      Height of the icon
26        ib_xtext       word      x-position of the text
28        ib_ytext       word      y-position of the text
30        ib_wtext       word      Text width in pixels
32        ib_htext       word      Text height in pixels
34        ib_resvd       word      - reserved -

Bit Image Block Structure (BITBLK)

Offset    Contents       Type      Meaning
-------------------------------------------------
00        bi_pdata       long      Pointer to image data
04        bi_wb          word      Width of the image in bytes
06        bi_hl          word      Height of the image in pixels
08        bi_x           word      x-position of the image
10        bi_y           word      y-position of the image
12        bi_colour      word      Image colour

Application Block Structure (USERBLK):

Offset    Contents       Type      Meaning
-----------------------------------------------------
00        ub_code        long      Pointer to a user assembly language
                                   routine to draw the object
04        up_parm        long      Pointer to a PARMBLK structure

Parameter Block Structure (PARMBLK):

Offset    Contents       Type      Meaning
------------------------------------------------------
00        pb_tree        long      Pointer to object tree
04        pb_obj         word      Object number
06        pb_prevstate   word      Previous status
08        pb_currstate   word      Current status
10        pb_x           word      x-position of object
12        pb_y           word      y-position of object
14        pb_w           word      Width of object
16        pb_h           word      Height of object
18        pb_xc          word      x-position of clipping rectangle
20        pb_yc          word      y-position of clipping rectangle
22        pb_wc          word      Width of the clipping rectangle
24        pb_hc          word      Height of the clipping rectangle
28        pb_parm        long      Parameter from the USERBLK structure

Applications Library:

APPL_INIT()                   Initialize an application
APPL_READ(id,len,adr_buffer)  Read bytes from an event buffer
 id > ID of application from whose buffer reading is to be done.
 len > Number of bytes to be read  adr_buffer > Address of the buffer
APPL_WRITE(id,len,adr_buffer) Write bytes to an event buffer
 id > ID of application into whose buffer writing is to be done.
 len > Number of bytes to be written  adr_buffer > Address of the buffer
APPL_FIND(filename$)             Find application
 filename$ > 8-char file name (without extension) of the sought-after 
 application.
APPL_TPLAY(mem,num,speed)     Replays recorded events
 Functions only with newer ROM
APPL_TRECORD(mem,num)         Records events
 Functions only with newer ROM
APPL_EXIT()                   Return to previous program

Event Library:

EVNT_BUTTON(clicks,mask,state[,mx,my,button,k_state])  Waits for mouse clicks.
 clicks > Maximum allowable clicks    mask > Mask for key bit0=1 Left bit1=1 Right
 state > Desired status for terminate the event (bits same as for mask)
 mx < x-coord for mouse when event is terminated
 my < y-coord -       "        "        "      -
 button < State of mouse buttons (as for mask)
 k_stat < Condition of the keyboard 'shift' keys on event termination:
  Bit 0 = Right shift key
  Bit 1 = Left shift key
  Bit 2 = Control key
  Bit 3 = Alternate key
EVNT_CLICK(new,get_set)  Sets the speed for double-clicks of a mouse button.
 new > New speed (0 to 4)
 get_set > Determines whether the speed is to be set, or just read
EVNT_KEYBD()             Waits for a key to be pressed and returns a word-sized
value, with the low-order byte containing the ASCII code, and the high-order byte
containing the keyboard scan code.
EVNT_MESAG(adr_buffer)   Waits for the arrival of a message in the event buffer.
 addr_buffer > address of a 16-byte buffer for the message (MENU(1) to MENU(8)).
 If 0 is given for adr_buffer the system message buffer is used, i.e. MENU(1) to ...
EVNT_MOUSE(flag,mx,my,mw,mh,mcur_x,mcur_y,button,k_state)  
 flag > Presence inside (0) or outside (1) of the area is detected.
 mx,my > Coordinates of top left corner of rectangle.
 mw > Width of rectangle            mh > Height of rectangle
 mcur_x, mcur_y < x and y-coord of the mouse when event occurs
 button < Mouse key status when event: Bit 0 = Right but, Bit 1 = Left but. 
 k_state < State of keyboard 'shift' keys (see EVNT_BUTTON).

EVNT_MULTI(flags,clicks,mask,state,m1_flags,m1_x,m1_y,m1_w,m1_h,m2_flags,m2_x,
 m2_y,m2_w,m2_h,adr_buffer,count[,mcur_x,mcur_y,button,k_state,key,num_clicks])
Wait for occurrence of selected events. Return event in flag:
Bit 0     keyboard                 MU_KEYBD
Bit 1     mouse button             MU_BUTTON
Bit 2     first mouse event        MU_M1
Bit 3     second mouse event       MU_M2
Bit 4     report event             MU_MESAG
Bit 5     timer                    MU_TIMER  
Parameters described in EVNT_MOUSE, EVNT_KEYBD, EVENT_BUTTON and EVNT_MESAG.
However it should be noted that two different mouse events (m1 and m2) can 
be awaited.

EVNT_TIMER(count)        Waits for 'count' milliseconds.

Menu Library:

MENU_BAR(tree,flag)      Displays/erases a menu bar (from a RSC file)
 Compare MENU x$() and MENU KILL
 tree > Address of the menu object tree    flag > 1=Display 0=Erase
MENU_ICHECK(tree,item,flag) Deletes a tick against a menu item.
 Compare MENU x,0 and MENU x,1
 tree > Address of object tree     item > Object number of item
 flag > 1=Display tick  0=Delete tick
MENU_IENABLE(tree,item,flag)  Enable or disable menu items.
 Compare MENU x,2 and MENU x,3
 tree > Address of object tree     item > Object number of the menu entry
 flag > 0=Disabled  1=Enabled
MENU_TNORMAL(tree,title,flag) Menu title switches to inverse or normal video.
 Compare MENU OFF
 tree > Address of object tree     title > Object number of the menu title
 flag > 0=Inverse   1=Normal
MENU_TEXT(tree,item,new_text$)     Changes text of menu item.
 tree > Address of object tree     item > Object number of the item to be mod.
 new_text$ > A string with the new menu item.
MENU_REGISTER(ap_id,m_text$)       A Desk Accessory is inserted in the first 
 menu, provided there are not more than 6. Returns 0-5 or -1
 ap_id > Identification number of Acc   m_text$ > Name for Acc

Object Library:

OBJC_ADD(tree,parent,child)        An object is added to a object tree.
 tree > Address of tree            parent > Object nr of parent of which the new
 object is to be a child.          child > Object number of the child to be add.
OBJC_DELETE(tree,del_obj)          An object is deleted from a tree.
 tree > Address of tree            del_obj > Object nr of object to be deleted.
OBJC_DRAW(tree,start_obj,depth,cx,cy,cw,ch)  Draw whole object or parts.
 tree > Address of tree            start_obj > First object
 depth > How deep it is drawn      cx,cy > Coordinates top left corner
 cw,ch > Width and height of rectangle.
OBJC_FIND(tree,start_obj,depth,fx,fy)   Determines object with mouse.
 tree > Address of tree            start_obj > Start object for search
 depth > How deep we shall seek    fx,fy < Mouse coordinates
OBJC_OFFSET(tree,obj,x_abs,y_abs)  Computes absolute coordinates of object.
 tree > Address of tree            obj > Object number
 x_abs, y_abs < The computed coordinated
OBJC_ORDER(tree,obj,new_pos)       Repositions an object within a tree
 tree > Address of tree            obj > Object number
 new_pos > New level number: -1=One level higher 0=Bottom level
 1=Bottom level+1  2=Bottom level+2 etc
OBJC_EDIT(tree,obj,char,old_pos,flag,new_pos) Facilitates input an editing of
 text in G_TEXT and G_BOXTEXT object types.
 tree > Address of tree            obj > Object number
 char > Input character with scan  old_pos > Current position in inp string
 flag > Functions selection: 0 ED_START = -reserved-  1 ED_INT = String for-
 matted and cursor off  2 ED_CHAR = Character processed and string redisplayed.
 3 ED_END = Text cursor switched off    new_pos < New cursor position
OBJC_CHANGE(tree,obj,resvd,cx,cy,cw,ch,new_status,redraw) Changes status 
 of an object.
 tree > Address of tree            obj > Number of the changed object
 resvd > -reserved- (0)              cx,cy > Coord of top left clip rect.
 cw,ch > Width height of clip      new_status > New object status
 redraw > 1=redraw, 0=Don't redraw

Form Library:

FORM_ALERT(button,string$)    string$="[i][Message][Buttons]" 
FORM_BUTTON(tree,obj,clicks,new_obj)    Makes possible mouse inputs in a form.
 tree > Address of object tree       obj > Current object number
 clicks > Maximum nr of clicks      new_obj < Next object to be edited
FORM_CENTER(tree,fx,fy,fw,fh)      Centres a tree (i.e. a dialog box) on screen.
 tree > Address of object tree      fx,fy < Coord of top left corner
 fw,fh < Width and height of centred box.
FORM_DIAL(flag,mi_x,mi_y,mi_w,mi_h,ma_x,ma_y,ma_w,ma_h)
 flag > Function type : 0=FMD_START Reserves a display area  1=FMD_GROW Draws
 an expanding rectangle  2=FMD_SHRINK Draws a shrinking rectangle  3=FMD_FINISH
 Releases reserved display area again.
 mi_x,mi_y > Top left corner of rectangle at minimum size
 mi_w,mi_h > Width and height -         "         "     -
 ma_x,ma_y > Top left corner of -     "   -  maximum size
 ma_w,ma_h > Width and height -         "         "     -
FORM_DO(tree,start_obj)       Takes over the complete management of a Form object,
 until an object with EXIT or TOUCH_EXIT status is clicked.
 tree > Address of the object tree
 start_obj > Number of the first editable object where cursor positions.
FORM_ERROR(err)               Displays the warning box.
FORM_KEYBD(tree,obj,next_obj,char,new_obj,next_char)  Allows a Form to be filled  
 out via the keyboard.
 tree > Address of the object tree  obj > Number of the object to be edited.
 next_obj > Number of next EDITable char > Input character
 new_obj > Object to be edited on next call   next_char < Next character

Graphics Library:

GRAF_RUBBERBOX(lx,ly,min_w,min_h[,last_w,last_h)  This function draws an
 outline of a rectangle when left button is held down.Top left corner fixed.
 lx,ly > Coord of top left corner  min_w,min_h > Min width of rectangle
 min_h > Min height of rectangle   last_w,last_h < Width of rect when terminated.
GFA_DRAGBOX(iw,ih,ix,iy,rx,ry,rw,rh[,last_ix,last_iy]) Moves rectangle with mouse.
 iw,ih > Width height of moving rect    ix,iy > Top left corner of rect
 rx,ry > Coord of top left in limiting rect  rw,rh > width height of limit rect
 last_ix,last_iy < Coord of top left corner when button is released
GRAF_MOVEBOX(w,h,sx,sy,dx,dy) Draws a moving rectangle with constant height and width.
 w,h > Width and height of rect    sx,sy > Initial coord of top left corner
 dx,dy > Final coord of top left corner
GRAF_GROWBOX(sx,sy,sw,sh,dx,dy,dw,dh)    Draws an expanding rectangle
 sx,sy > Initial coord of t.l.c.   sw,sh > Initial width of rectangle
 dx,dy > Final coord of t.l.c.     dw,dh > Final width and height
GRAF_SHRINKBOX(sx,sy,sw,sh,dx,dy,dw,dh)   Draws an shrinking rectangle
 sx,sy > Final coord of t.l.c.     sw,sh > Final width and height
 dx,dy > Initial coord of t.l.c.   dw,dh > Initial width and height
GRAF_WATCHBOX(tree,obj,in_state,out_state) Monitors an object in a tree and
 checks whether mouse is inside or outside while button is pressed. 1=Inside.
 tree > Address of tree            obj > Object to be monitored
 in_state > OB_STATE of object if mouse is in it  out_state > OB_STATE if out.
GRAF_SLIDEBOX(tree,parent_obj,slider_obj,flag) Moves rectangular object horiz or
 vertically e.g. a slider in a window. Returns position relative to limiting:
 Horizontally:0=far left 1000=far right  Vertically:0=top  1000=bottom
 tree > Address of tree            parent_obj > Object number of limiting rect.
 slider_obj > Object number of moving rect. flag > Direction 0=Horiz 1=Vert
GRAF_HANDLE(char_w,char_h,box_w,box_h) Return number of current VDI workstation.
 char_w < Width of a character     char_h < Height of a character
 box_w < Width of character cell   box_h < Height of character cell
GRAF_MOUSE(m_form,pattern_adr)     Allows mouse shape to be changed
 (Use DEFMOUSE instead)
GRAF_MKSTATE(mx,my,m_state,k_state) Supplies mouse information
 mx,my < Current coord of mouse    m_state < Button status: Bit 0=left Bit 1=right
 k_state < Status of keyboard shift keys (same as EVENT_BUTTON)

Scrap Library:

SCRP_READ(path$)    Reads data from another program from a small internal buffer
 path$ < Data string or file specification
SCRP_WRITE(path$)   Opposite of SCRP_READ
 path$ > Data string or file specification

File Selector Library:

FSEL_INPUT(path$,name$,[button])  Invokes the Fileselect Box.
 On Entry: path$ > Initial directory path    name$ > Default filename
 On Exit : path$ < Final directory path      name$ < Chosen filename
           button < 1 if 'OK' 0 if 'Cancel'

Window Library:

WIND_CREATE(attr,wx,wy,ww,wh) Allocates a new window. Window handle is returned.
 attr > Window attributes as follows:               Bit no.
 &H0001        NAME      Title bar with name           0
 &H0002        CLOSE     Close box                     1
 &H0004        FULL      Full box                      2
 &H0008        MOVE      Move box                      3
 &H0010        INFO      Information line              4
 &H0020        SIZE      Size box                      5
 &H0040        UPARROW   Up arrow                      6
 &H0080        DNARROW   Down arrow                    7
 &H0100        VSLIDE    Vertical slider bar           8
 &H0200        LFARROW   Left arrow                    9
 &H0400        RTARROW   Right arrow                  10
 &H0800        HSLIDE    Horizontal slider bar        11
 wx,wy > Max position of t.l. edge      ww,wh > Max width height of window
WIND_OPEN(handle,wx,wy,ww,wh) Draws a window created with WIND_CREATE. Compare OPENW.
 handle > Identification number         wx,wy,ww,wh > Coordinates
WIND_CLOSE(handle)  Closes a window. Compare CLOSEW.
 handle > Identification number of the window
WIND_DELETE(handle) Deleted a window and frees the memory and number. Compare CLOSEW.
 handle > ID nr
WIND_GET(handle,code,w1,w2,w3,w4)  Supplies information about a window.
 handle > ID nr       code > Depending on code following info comes to w1,w2,w3,w4:
 4 WF_WORKXYWH size of window work area 
   w1,w2 < top left coord               w3,w4 < Width height
 5 WF_CURRXYWH total size of window including borders
   w1,w2 < top left coord               w3,w4 < Width height
 6 WF_PREVXYWH size of previous window
   w1,w2 < top left coord               w3,w4 < Width height
 7 WF_FULLXYWH total max size of window (set by WIND_CREATE)
   w1,w2 < top left coord               w3,w4 < Width height
 8 WF_HSLIDE   position of horizontal slider
   w1 < (1=far left, 1000=far right)
 9 WF_VSLIDE   position of vertical slider
   w1 < (1=top, 1000=bottom)
10 WF_TOP      identification number of the top (=active) window
   w1 < identification number
11 WF_FIRSTXYWH coord of first rectangle in the window's rectangle list
   w1,w2 < top left coord               w3,w4 < Width height
12 WF_NEXTXYWH  coord of next rectangle in window list
   w1,w2 < top left coord               w3,w4 < Width height
13 WF_RESVD     -reserved-
15 WF_HSLIZE   size of horizontal slider compared to its max possible size
   w1 < -1 = min size( 1 = small, 1000 = full width)
16 WF_VSLIZE   size of vertical slider bar compare to its max possible size.
   w1 < -1 = min size (1 = small, 1000 = full height)
WIND_SET(handle,code,w1,w2,w3,w4)  Changes part of window according to code
 handle > ID nr                          code > component to be changed:
 1 WF_KIND     sets new window components (as with WIND_CREATE)
   w1 > new window part
 2 WF_NAME     gives a window a new title:
   w1,w2 > High-word,low-word of address of title string (term with two 0 bytes)
 3 WF_INFO     specifies a new info line
   w1,w2 > As above   NOTE!! Use TITLEW and INFOW instead
 5 WF_CURRXYWH sets total window size:
   w1,w2 > top left coord               w3,w4 > Width, height
 8 WF_SLIDE    positions the horizontal slider
   w1 > 1 = far left, 1000 = far right
 9 WF_VSLIDE   positions the vertical slider
   w1 > 1 = top, 1000 = bottom
10 WF_TOP      sets the top (=active) window
14 WF_NEWDESK  sets a new desktop menu tree
   w1,w2 > Low word, high word of address of new tree
   NOTE! Opposite of normal order
   w3 > ID number of first object top be drawn
15 WF_HSLIZE   Sets size of horiz slider bar compare to max possible size
   w1 > -1 = min size (1 = small, 1000 = full width)
16 WF_VSLIZE  Sets size of vert slider bar compare to max possible size
   w1 > -1 = min size (1 = small, 1000 = full height)
WIND_FIND(fx,fy)         Returns ID nr of window which lies in fx,fy
WIND_UPDATE(flag)        Coordinates all functions involved with screen redraw.
 flag: 0 = END_UPDATE    Screen redraw completed
       1 = BEG_UPDATE    Screen redraw starting
       2 = END_MCTRL     application relinquishes mouse supervision
       3 = BEG_MCTRL     application take over mouse supervision
WIND_CALC(w_type,attr,ix,iy,iw,ih,ox,oy,ow,oh)    Computes the total size of 
 a window from size of work area or vice versa.
 w_type > 0 = Compute total size  1 = Compute work area size
 attr > Window components (see WIND_CREATE)
 ix,iy > Known top left coord           iw,ih > Known width and height
 ox,oy < Calculated top left coord      ow,oh < Calculated width and height

Resource Library:

RSRC_LOAD(name$)         Reserves memory and loads a resource file
 Return 0 if an error occurred.          name$ > File spec of RSC file
RSRC_FREE()              Releases the memory reserved by RSRC_LOAD
 Return 0 if an error occurred.
RSRC_GADDR(type,index,addr)   Determines the address of a resource structure
 type > Type of structure whose address is to be found:
 0   Object tree         the tree loaded with RSRC_LOAD
 1   OBJECT              object
 2   TEDINFO             text information
 3   ICONBLK             icon information
 4   BITBLK              bit-mapped graphic information
 5   STRING              text
 6   image data          bit-mapped graphic
 7   obspec              object specification
 8   te_ptext            string
 9   te_ptmplt           text template
 10  te_pvalid           text validation string
 11  ib_pmask            icon display mask
 12  ib_pdata            icon bit map
 13  ib_ptext            icon text
 14  bi_pdata            image data
 15  ad_frstr            address of pointer to free string
 16  ad_frimg            address of pointer to free image
 index > number of object whose address is required (not Object Number!)
 addr < the required address
RSRC_SADDR(type,index,addr)   Sets the address of an object
 type > (see RSRC_GADDR)           index > (see RSRC_GADDR)
 addr > the address
RSRC_OBFIX(tree,obj)     Convert an object coord from char coord to pixel coord.
 tree > address of tree            obj > object number

Shell Library:

SHEL_READ(cmd_string$,tail_string$) Identify the command by which is was invoked.
 cmd_string$ < String for command line  tail_string$ < String for name
SHEL_WRITE(prg,grf,gem,cmd$,name$)  informs AES the another application is
 to be started after the current one has terminated.
 prg > 0 = To desktop, 1 = Load prg     grf > 0 = TOS prg, 1 = Graph application
 gem > 0 = Not GEM appl., 1 = GEM appl. cmd$ > Command line
 name$ > Name of next application
SHEL_GET(num,x$)    Reads data from GEMDOS string buffer (into which DESKTOP.INF
 is read on start-up)
 num > Number of bytes to be read  x$ < String to contain data
SHEL_PUT(len,x$)    Writes data to GEMDOS string buffer
 x$ > String with data             len > Number of bytes
SHEL_FIND(path$)    Searches a file and returns full file spec.
 On entry: path$ > String containing the sought after filename
 On exit : path$ < Contains the full file spec if found, else unchanged
SHEL_ENVRN(addr,search$) Determines values of variables in GEM environment.
 search$ > String to be sought     addr < addr of spec string


GEMDOS Table:

~GEMDOS(0)               pterm0()
 Terminates program. Not for use in GFA BASIC.
r%=GEMDOS(1)             cconin() 
 Read character from keyboard and displays it on screen (see INP(2)).
 r%  Bit 0-7: ASCII Code, 16-23: Scan-code, 24-31: Shift keys
~GEMDOS(2,z%)            cconout()  
 Displays characters on the screen (see OUT 2,z%)
 z%  Bit 0-7: ASCII Code for character
r%=GEMDOS(3)             cauxin() 
 Reads a character from RS232 (see INP(1))
 r%  Code for the character
~GEMDOS(4,z%)            cauxout()
 Outputs a character to RS232 (see OUT 1,z%)
 z%  Code for character
~GEMDOS(5,z%)            cprnout()
 Outputs a character to printer (see OUT 0,z%)
 z% Code for character
r%=GEMDOS(6,z%)          crawio()  
 Writes character to screen or, if z%=255, executes INKEY. (See OUT
 2,z% as well as INKEY$)
 r%  with z%=255 a character from the keyboard
 z%  Code for character or 255 for INKEY
r%=GEMDOS(7)             crawcin()
 Read keyboard characters without echo (see INP(2)).
 r%  Code for character
r%=GEMDOS(8)             cnecin()  
 As GEMDOS(7) but control characters ignored.
 r%  Code for character
~GEMDOS(9,L:adr%)        cconws()   
 Display character string on screen
 adr%     Address of string, must end with a zero byte.
~GEMDOS(10,L:adr%)       cconrs()
 Read string from keyboard (CTRL-c crashed the system!).
 adr%     Buffer for string. First byte number of char, second is
 number of char to be read, then follows the string.
r!=GEMDOS(11)            cconis()
 Check if there is a character in keyboard buffer.
 r!       TRUE if character present, otherwise FALSE
~GEMDOS(14,d%)           dsetdrv()
 Sets current drive; 0=A, 1=B, ... (see CHDRIVE)
 d%       number of drive
r!=GEMDOS(16)            cconos()
 Checks if a character can be displayed on screen.
 r!       always TRUE if screen is connected
r!=GEMDOS(17)            cprnos()
 Checks if printer is ready to receive.
 r!       TRUE if ready to receive
r!=GEMDOS(18)            cauxis()
 Checks if character available on RS232
 r!       TRUE if char available
r!=GEMDOS(19)            cauxos()
 Checks output status of RS232
 r!       TRUE if char can be output
r%=GEMDOS(25)            dgetdrv()
 Gets ID of current drive.
 r%       ID of drive (A=0, B=1,...)
~GEMDOS(26,L:adr%)       fsetdta()
 Sets DTA address, normally BASEPAGE+128
 adr%     Address to be set
r%=GEMDOS(42)            tgetdate()
 Gets system date (see DATE$)
 r%       Date: Bit 0-4:Day, 5-8:Month, 9-15: Year minus 1980
~GEMDOS(43,d%)           tsetdate()
 Sets system date (see SETTIME)
 d%       The new date (format as GEMDOS(42)
r%=GEMDOS(44)            tgettime()
 Gets system time (see TIME$)
 r%       Time: Bit 0-4:Seconds, 5-10:Minutes, 11-15:Hours
~GEMDOS(45,t%)           tsettime()
 Sets system time (see SETTIME)
 t%       The new date (format as GEMDOS(44))
r%=GEMDOS(47)            fgetdta()
 Gets current DTA-address
 r%       Address returned
r%=GEMDOS(48)            sversion()
 Gets GEMDOS version number
 r%       Version number
~GEMDOS(49,L:b%,r%)      ptermres()
 Terminate program and reserve b% bytes in BASEPAGE (Not in GFA)
 b%       Bytes to be reserved
 r%       Value to calling program
r%=GEMDOS(54,L:adr%,d%)  dfree()
 Gets free disk space on drive d% (see DFREE)
 r%       -46 when wrong drive number
 adr%     Address to 4 longwords:
          Long 1: Number of free Clusters
          Long 2: Total number of the Cluster
          Long 3: Byte per sector
          Long 4: Sectors per Cluster
r%=GEMDOS(57,L:adr%)     dcreate()
 Creates new directory (see MKDIR)
 r%       -34 or -36 if error
 adr%     Address to directory name (ending with zero)
r%=GEMDOS(58,L:adr)      ddelete()
 Deletes directory (see RMDIR)
 r%       -34,-36 or -65 if error
 adr%     Address to directory name (ending with zero)
r%=GEMDOS(59,L:adr%)     dsetpath()
 Change directory
 r%       -34 if not found
 adr%     Address to directory name (ending with zero)
r%=GEMDOS(60,L:adr%,a%)  fcreate()
 Create file (see OPEN)
 r%       -34,-35 or -36 if error
 adr%     Address of file name (end with zero)
 a%       Bit 0 set:write protected file     Bit 1:hidden file
          Bit 2:System file (also hidden)    Bit 3:disk name
r%=GEMDOS(61,L:adr%,m%)  fopen()
 Open file (see OPEN)
 r%       -35 or -36 if error else r% -33
 adr%     Address of file name (end with zero)
 m%       0 for reading  1 for writing  2 for reading and writing
r%=GEMDOS(62,h%)         fclose()
 Close file with handle h% (see CLOSE)
 r%       -37 if error
 h%       file handle of file to be closed
r%=GEMDOS(63,h%,L:l%,L:adr%)       fread()
 Read l% bytes from file with handle h% (see BGET)
 r%       -37 if error else numbers read
 h%       handle
 l%       number of bytes to be read
 adr%     Address to which byte are written
r%=GEMDOS(64,h%,L:l%,L:adr%)       fwrite()
 Writes l% bytes to file with handle h% (see BPUT)
 r%       -36 or -37 if error else number written.
 h%       handle
 l%       number of bytes to be written
 adr%     Address from which byte are to be read.
r%=GEMDOS(65,L:adr%)               fdelete()
 Deletes file (see KILL)
 r%       -33 or -36 if error
 adr%     Address of file name (end with zero)
r%=GEMDOS(66,L:n%,h%,m%)           fseek()
 Reset pointer for file access (see SEEK, RELSEEK)
 r%       -32 or -37 if error
 n%       number of bytes to be jumped over
 h%       handle
 m%       0: starting from file beginning
          1: starting from current position
          2: starting from file end
r%=GEMDOS(67,L:adr%,m%,a%)         fattrib()
 Read or writes file attributes
 r%       -33 or -34 if error else file attributes
 adr%     Address of file name (end with zero)
 m%       0: file attr read        1: file attr write
 a%       File attributes
          Bit 0: Write protected   1: Hidden
              2: System file       3: Disk name
              4: Directory         5: Archive bit
r%=GEMDOS(69,h%)                   fdup()
 Produce second file handle
 r%       -35 or -37 if error else file handle
 h%       Original handle
r%=GEMDOS(70,h%,nh%)               fforce()
 Create new output handle for GEMDOS
 r%       -37 if error
 h%       handle of data channel to be diverted from
 nh%      handle of channel to which the outputs are to be diverted to
r%=GEMDOS(71,L:adr%,d%)            dgetpath()
 Gets current path of drive (see DIR$)
 r%       -46 if error
 adr%     Address to storage area
 d%       Drive ID
r%=GEMDOS(72,L:b%)                 malloc()
 Reserves memory (see MALLOC)
 r%       if b=-1 length of largest free area, else start address of area.
 b%       Number of bytes to be reserved, for b%=-1, get free memory.
r%=GEMDOS(73,L:adr%)               mfree()
 Releases memory (see MFREE)
 r%       -40 if error
 adr%     Address of area to be released
r%=GEMDOS(74,L:adr%,L:b%)          mshrink()
 Shortens reserved memory (see MSHRINK)
 r%       -40 or -67 if error
 adr%     Address of area to be shortened
 b%       New length of storage area
r%=GEMDOS(75,m%,L:p%,L:c%,L:e%)    pexec()
 Executes program as a subroutine, from disk (see EXEC)
 r%       -32,-33,-39 or -66 if error
 m%       0:Load and start, 3:Load, 4:Start, 5:Return basepage
 p%       Address of program name or at m%=4 of the Basepage
 c%       Address of command line (not at m%=4)
 e%       Address of env string (not at m%=4)
~GEMDOS(76,r%)                     pterm()
 Terminates current program (see QUIT, SYSTEM)
 r%       Return value
r%=GEMDOS(78,L:adr%,a%)            fsfirst()
 Searches for files. File name returned i DTA.
 r%       -33: File not found, -49: No further files
 adr%     Address of file name (Wildcards * and ? may be used)
 a%       File attributes:
          Bit 0: Write protected        1: Hidden
              2: System file            3: Disk name
              4: Directory              5: Archive bit.
r%=GEMDOS(79)                      fsnext()
 Continue search begun with GEMDOS(78)
 r%       -49 if no further files
r%=GEMDOS(86,L:o%,L:n%)            frename()
 Names a file (see NAME, RENAME)
 r%       -34 or -36 if error
 o%       Address of old file
 n%       Address of new file
~GEMDOS(87,L:adr%,h%,m%)           fdatime()
 Gets or sets time and date of file  (see TOUCH)
 adr%     Address of time info (4 byte)
 h%       File handle
 m%       0: Reading of file       1: To set file time

BIOS table:

~BIOS(0,L:adr%)                    getmpb()
 Init MEMORY parameter block.
 adr%     Address of new MPB.
r%=BIOS(1,d%)                      constat()
 Checks an input buffer (see INP?)
 r%       0: No character available, -1: Character available
 d%       0: Parallel interface    1: Serial interface
          2: Keyboard              3: MIDI interface
r%=BIOS(2,d%)                      bconin()
 Read char from an input buffer (see INP)
 r%       Char read in (8-bit)
 d%       0: Parallel interface    1: Serial interface
          2: Keyboard              3: MIDI interface
r%=BIOS(3,d%,b%)                   bconout()
 Outputs char to device (see OUT)
 d%       0: Parallel interface    1: Serial interface
          2: Keyboard              3: MIDI interface
          4: IKBD
 b%       The char to be output
r%=BIOS(4,f%,L:b%,n%,s%,d%)        rwabs()
 Reads and writes sectors to and from disk
 r%       0 if no error
 f%=0     Read n% sectors starting at sector s%, on drive d% to b%
 f%=1     Writes sectors to disk
 f%=2     As f%=0 but ignore media change
 f%=3     As f%=1 but ignore media change
 b%       Address of data storage area
 n%       Number of sectors
 s%       Number of start sector
 d%       Number of drive
r%=BIOS(5,n%,L:adr%)               set EXEC()
 Sets and reads the exception vector
 r%       For adr%=-1 the previous vector is returned
 n%       Number of exception vector
 adr%     New address of vector or -1
r%=BIOS(6)                         tickcal()
 Ask system timer
 r%       Number of milliseconds passed, resolution 20 ms
r%=BIOS(7,d%)                      getbpb()
 Get address of bit parameter block
 r%       Address of bpb
 d%       Number of drive
r!=BIOS(8,d%)                      bconstat()
 Get state of output device (see OUT?)
 r!       TRUE if able to transmit
 d%       0: Parallel interface    1: Serial interface
          2: Keyboard              3: MIDI interface
r%=BIOS(9,d%)                      mediach()
 Asks if disk was changed
 r%       0: Definitely not changed (Hard disk)
          1: Perhaps changed
          2: Definitely changed
 d%       Number of drive
r%=BIOS(10)                        drvmap()
 Check which drive are attached
 r%       Bit pattern where every bit corresponds to each drive
r%=BIOS(11,c%)                     kbshift()
 Gets or sets status of shift keys
 r%       For c%=-1 current status of shift key
 c%       New status
          Bit 0: Right Shift       1: Left Shift
              2: Control           3: Alternate
              4: Caps-Lock         5: Alt+Clr/Home (right mouse key)
              6: Alt+Insert (left mouse key)

XBIOS Table

~XBIOS(0,t%,L:p%,L:v%)             initmous()
 Initialise mouse handling (not compatible with GEM)
 t%       0: Switch off mouse
          1: Switch mouse into relative mode
          2: Switch mouse into absolute mode
          4: Mouse in keyboard mode
 p%       Address of an information structure
 v%       Address of the mouse handling routine
r%=XBIOS(2)                        physbase()
 Base address of screen memory
 r%       Address of physical screen memory
r%=XBIOS(3)                        logbase()
 Address of logical screen memory
 r%       Address of logical screen memory
r%=XBIOS(4)                        getrez()
 Returns current resolution
 r%       0: 320x200               1: 640x200
          2: 640x400               3: reserved for modified ST's
~XBIOS(5,L:l%,L:p%,r%)             setscreen()
 Change resolution (not in GEM). Address must start on 256 byte boundary.
 l%       New address of the logical screen memory
 p%       New address of the physical screen memory
 r%       New screen resolution
~XBIOS(6,L:adr%)                   setpalette()
 Allows all color registers to be reset at one time.
 adr%     Address of table containing 16 word with palette data
r%=XBIOS(7,n%,c%)                  setcolor()
 Sets or gets a colour register (see SETCOLOR)
 r%       For c%=-1 returns previous specified colour register
 n%       Number of colour register (0 to 15)
 c%       New colour, at c%=-1 see r%
r%=XBIOS(8,L:b%,L:f%,d%,sec%,t%,side%,n%)    floprd()
 Reads sectors from disk
 r%       0 if no error
 b%       Address of area where data should be written
 f%       Unused
 d%       Number of drive
 sec%     Number of start sector
 t%       Number of track
 side%    Disk side (0 or 1)
 n%       Number of sectors to be read (must lie on a track)
r%=XBIOS(9,L:b%,L:f%,d%,sec%,t%,side%,n%)    flopwr()
 Writes sectors to disk
 r%       0 if no error
 b%       Address of area where data is read
 f%       Unused
 d%       Number of drive
 sec%     Number of start sector
 t%       Number of track
 side%    Disk side (0 or 1)
 n%       Number of sectors to be written (all on one track)
r%=XBIOS(10,L:b%,L:f%,d%,sec%,t%,side%,i%,L:m%,v%)     flopfmt()
 Format disk
 r%       0 if no error
 b%       Address for intermediate memory (min 8 kB)
 f%       Unused
 d%       Number of drive
 sec%     Sectors per track (normally 9)
 t%       Number of track to be formatted
 side%    Disk side (0 or 1)
 i%       Interleave factor (normally 1)
 m%       Magic-Number &87654321
 v%       Value in sectors after formatting (normally &HE5E5)
~XBIOS(12,n%,L:adr%)                                   midiws()
 Output contents of a block to MIDI.
 n%       Number of bytes minus 1 to be output
 adr%     Address of source area
~XBIOS(13,n%,L:adr%)                                   mfpint()
 Sets MFP interrupt vector (not from GFA)
 n%       Number of interrupt (0 to 15)
 adr%     New address of interrupt
r%=XBIOS(14,d%)                                        iorec()
 Returns address of I/O-table used by serial interface
 r%       Address of the data buffer
 d%       0: RS232       1: IKBD        2: MIDI
~XBIOS(15,b%,h%,ucr%,rsr%,tsr%,scr%)                   rsconf()
 Configures serial interface. Parameters unchanged with -1.
 b%       Baud rate
 h%       Hand shake mode:
          0: without          1: XON/XOFF
          2: RTS/CTS          3: Both
 ucr%     USART control register of the MFP
 rsr%     Receiver status register of the MFP
 tsr%     Transmitter status register of the MFP
 scr%     Synchronous character register of MFP
r%=XBIOS(16,L:us%,L:sh%,L:caps%)                         keytbl()
 Changes keyboard translation tables
 r%       Address of KEYTAB structure
 us%      Address of table for keys without shift
 sh%      Address of table for keys with shift
 caps%      Address of table for keys with Caps-Lock
r%=XBIOS(17)                                           random()
 Returns a random number (see RAND, RANDOM)
 r%       Number returned with 24 bit accuracy (0 to 16777215)
~XBIOS(18,L:b%,L:s%,d%,f%)                             protobt()
 Creates a boot sector for the disk in memory
 b%       Address to a 512 byte buffer
 s%       Serial number that forms part of boot sector:
          -1:  previous serial number retained
          >24 bits: Random number returned
 d%       Disk type (tracks/sides)
          0:   40 Tracks, single sided (180 K)
          1:   40 Tracks, double sided (360 K, IBM)
          2:   80 Tracks, single sided (360 K, SF340)
          3:   80 Tracks, double sided (720 K, SF314)
 f%       0:   non.executable Bootsector
          1:   executable
         -1:   leave unchanged
r%=XBIOS(19,L:b%,L:f%,d%,sec%,t%,side%,n%)             flopver()
 Verifies disk contents
 r%       0 if no error
 b%       Address of area with which a comparison is made
 f%       Unused
 d%       Number of drive
 sec%     Number of start sector
 t%       Number of track
 side%    Disk side (0 or 1)
 n%       Number of sectors to be compared
~XBIOS(20)                                             scrdmp()
 Calls hardcopy routine (see HARDCOPY)
r%=XBIOS(21,c%,s%)                                     curscon()
 Configure cursor
 r%       When c%=5 the blink rate
 c%       0: Hide cursor                     1: Show cursors
          2: Blinking cursor                 3: Solid cursor
          4: Blink rate set to value in s%   5: see r%
 s%       When c%=4, blink rate
~XBIOS(22,L:t%)                                        bsettime()
 Sets date and time (see SETTIME)
 t%       Bit 0-4: Seconds, 5-10: Minutes, 11-15: Hours, 16-20: Day,
          21-24: Month, 25-31: Year minus 1980
r%=XBIOS(23)                                           bgettime()
 Returns date and time (see TIME$, DATE$)
 r%       For bit allocation see XBIOS(22)
~XBIOS(24)                                             bioskey()
 Reinstall original keyboard allocation (see XBIOS(16))
~XBIOS(25,n%,L:adr%)                                   ikbdws()
 Writes bytes from memory to keyboard processor (IKBD)
 n%       Number bytes minus 1, to be sent
 adr%     Address where data is stored
~XBIOS(26,i%)                                          jdisint()
 Disables an MFP interrupt
 i%       Number of interrupt (0-15) to be disabled
~XBIOS(27,i%)                                          jenabint()
 Enables an interrupt of the MFP.
 i%       Number of interrupt
r%=XBIOS(28,d%,reg%)                                   giaccess()
 Read and writes from sound chip registers
 r%       Returns register value when reading
 d%       The value to be written when writing (8 bit)
 r%       Register number (0 to 15), bit 7 defines write mode when set
~XBIOS(29,b%)                                          offgibit()
 Sets bit of port A on register of sound chip to zero
 b%       Bit pattern, which is AND:ed with existing contents
~XBIOS(30,b%)                                          ongibit()
 Sets the port A bit of the sound chip register to 1
 b%       Bit pattern which is OR:ed with the existing contents
XBIOS(31,t%,c%,d%,L:adr%)                              xbtimer()
 Set the MFP timers
 t%       Number of timer (0 to 3)
 c%       Control register
 d%       Data register
 adr%     Address of the time interrupt routine
~XBIOS(32,L:adr%)                                      dosound()
 Starts a sound sequence, which is processed in the interrupt
 adr%     Address of the storage area order
r%=XBIOS(33,c%)                                        setprt()
 Sets or read the printer parameters
 r%       Current configuration, when c%=-1
 c%       Bit not set/set
          0: Matrix printer/print wheel      1: Colour/Monochrome
          2: 1280/960 Points per line        3: Draft/NLQ
          4: parallel/serial                 5: Continuous form/sheet
r%=XBIOS(34)                                           kbdvbas()
 Returns address of table with vectors to keyboard and MIDI processor
 r%       Returned address
r%=XBIOS(35,a%,w%)                                     kbrate()
 Sets and reads keyboard repeat rate
 r%       Current data, bit 0-7: repeat rate, 8-15: Time of repeat delay
 a%       Repeat delay
 w%       Repeat rate
~XBIOS(36,L:adr%)                                      prtblk()
 Hardcopy routine, returns parameter block address
 adr%     Address of parameter block for hardcopy routine
~XBIOS(37)                                             vsync
 Waits for next VBL interrupt
~XBIOS(38,L:adr%)                                      supexec()
 Call an assembler routine in supervisor mode (without GEMDOS system calls)
 adr%     Address of the assembler routine
~XBIOS(39)                                             puntaes()
 Turn off AES if it is not in the ROM
r%=XBIOS(64,b%)                                        blitmode()
 Controls and interrogates the Blitter (only in the Blitter TOS)
 r%       Current blitter status if b%=-1, bit 1 Blitter there?
 b%       -1: see r% otherwise bit 0: set Blitter, otherwise Blitter out,
          bit 1-14:reserved (-1), bit 15:0


END OF COMMAND SUMMARY

Edition 1           89-09-15,89-09-17
Edition 2 (English) 89-09-25

***
