GFA DATA MEDIA UK LTD Winnersh 1.2.93

This is GFA-BASIC MS-DOS 4.5

Your disk will include the following files:

File                Contents

GFABAS.EXE          GFA-BASIC  interpreter  for   80286/8086/8088 
                    processor but no 80287.

GFABAS3.EXE         GFA-BASIC interpreter for 80386 without using 
                    the 80387 Co-Processor

GFABAS7.EXE         GFA-BASIC interpreter for 80286/8086/8088 
                    with using the 80287 Co-Processor

GFABAS37.EXE        GFA-BASIC interpreter for 80386 using 
                    the 80387 Co-Processor

GFABASIC.CFG        Configuration file 

GFA2EXE.EXE         GFA-BASIC .GFA to .EXE compiler

GFABA500.OVL	if you have an	normal PC/AT
GFABA503.OVL	if you have a 386
GFABA570.OVL	if you have a PC/AT with a 8087 or 80287
GFABA573.OVL	if you have a 386 with 387 or a 486

If GFABASIC doesn't find the one it searches for, it then looks
for GFABASIC.OVL



DEMONSTRATION FILES:

To  demonstrate the power of GFA-BASIC some  small  demo-programs 
have been included.  Depending on whether they run in  CGA,  EGA, 
VGA,  HGC  or  MCGA mode,  they have been  sorted  into  separate 
folders.   



The compiled .EXE and .OVL files (NOT the interpreters !!) may be
given away for free with any software that you write with GFA-BASIC.

INSTALLATION

GFA-BASIC is not copy protected. You are authorised to make a 
single working copy of GFA-BASIC and store the originals in a 
secure place. Only work from your working copy. 

All files can be copied to your hard disk, or you may wish to
install just the files suitable for your computer:

			286	286/287	386	386/387/486

GFABAS.EXE		x				
GFABAS3.EXE				x	
GFABAS7.EXE			x
GFABAS37.EXE					x
GFABASIC.CFG		x	x	x	x		
GFA2EXE.EXE		x	x	x	x
GFABAS00.OVL		x
GFABAS03.OVL				x
GFABAS70.OVL		x	
GFABAS73.OVL					x
GFABASIC.CFG		x	x	x	x

CONFIGURATION FILE 

The configuration file GFABASIC.CFG  contains something like:

     CO 0e 1e 1b 5b 1b 5e
     // 70                    Text     white/black
     //    17                 Menu     blue/white
     //       0f              Block    black/white
     //          0e           HotK     black/yellow
     //             1e        HotM     black/yellow
     //                07     MenI     black/white
     //CO 0f 70 70 0f 7f 07   config for black/white adaptor

Editor switches in congiguration file:

     NU +                     // listing with line numbers
     FF +                     // form feed at page end
     PL 90                    // page length
     PW +                     // wait for key press after FF
     CN +                     // Check Name of variables selected
     NN C:\GFA\NONAME.GFA     // Changes default path and file
                              // in SAVE/LOAD Fileselector.
     LN +                     // Lower Name option selected
                              // All variables in lower case.

The   file  GFABASIC.CFG  will  configure  the  colour  of   your 
interpreter. The first line starts with the colour abreviation CO, 
followed by 6 hex numbers which refer to the TCOLOR command. This 
config  file  will  configure EGA and  VGA  resolutions  with  16 
colours.  If you use a CGA or HGC card with only two colours, you 
must  configure this file to so that you have an odd  number  for 
the background, and an even number for the foreground.  

GFA-BASIC  searches for the config file not only in  the  current 
directory  but also the directories which are set with  the  PATH 
command.


EXIT FROM GFA_BASIC

If in your program a graphic mode (e.g.  SCREEN 16 or SCREEN  18) 
has  been  selected,  you will stay in this mode even  after  you 
leave the GFA-BASIC interpreter.  To go back to normal operation, 
please type:

     MODE CO80

which  will return you back to normal DOS text  mode.  You  could 
create  a  batch  file in your  auto-folder  with  the  following 
contents:

     COPY CON CL.BAT <return>
     MODE CO80^Z     <return>  //^Z means press 'F6'-key.

Thus you can return to normal DOS display by just typing 'cl'


GFA-BASIC VERSION NUMBER

The actual version number of GFA-BASIC can be obtained from:

     PRINT ERR$(100)

alternatively the version number is also visible in the File 
Menu.


PSAVE.

If  you save a GFA program using PSAVE,  (from within the  direct 
mode)'  the program will run automatically when loaded  into  the 
run-only interpreter.


CHANGES TO THE MANUAL

Some  of  the commands are not described in the manual  and  some 
commands deviate from the description. To clarify this situation, 
please study the following lines:


LLIST

LLIST  is  not implemented.  To list a program,  use  the  'File' 
option 'PRINT' in the GFA-BASIC editor.

================================================================

Function:      _ADAP

               To  write  programs  independent form  the  graphic  
               adaptor,  we implemented the variable _ADAP.

Syntax:        a%=_ADAP
               a%: ivar

               PRINT _ADAP    
               prints 0, if a MDA graphic adaptor is in use
                      1, if a HGC(+) graphic adaptor is in use
                      2, if a CGA graphic adaptor is in use
                      3, if a EGA or VGA graphic adaptor is in use.
  
               The  horizontal  and  vertical resolution  of  the  
               corresponding  graphic  adaptor is  readable  from 
               the  GFA-BASIC variables _X  and _Y.  To find  the 
               number of displayable colours, use _C.

Example:       PRINT _ADAP    /* will   return    the    value 
               keyget a%      /* corresponding to the graphic  
                              /* adaptor fitted

==============================================================================

Function: _TS

               The  GFA-BASIC  variable _TS contains  the  start-               
               address   of the  text screen.    If  a   EGA   or  
               VGA  Adaptor  is   in   use,     PRINT   HEX$(_TS) 
               results in B800.

Syntax:        a%=_TS
               a%: ivar

Example:       PRINT HEX$(_TS)     /* gives B800 if VGA/EGA card
               keyget%

================================================================

The commands for using a mouse are not printed in the manual. The
commands you can use for handling a mouse on your PC are:

Command:       DEFMOUSE

Function:      Sets the mouse symbol

Syntax:        DEFMOUSE a%
               a% ivar

               Setting a special mouse symbol. You can use

                    a% = 0 -> ARROW
                    a% = 1 -> double BRACKETS
                    a% = 2 -> FLY
                    a% = 3 -> showing HAND
                    a% = 4 -> open HAND
                    a% = 5 -> thin CROSS
                    a% = 6 -> fat CROSS
                    a% = 7 -> bordered CROSS

Example:   

          SCREEN 16  // EGA-mode
          DO
               IF MOUSEX <=_X/2
                    IF MOUSEY <=_Y/2  /* left square
                         DEFMOUSE 1
                    ELSE              /* left down square
                         DEFMOUSE 3
                    ENDIF
               ELSE
                    IF MOUSEY <=_Y/2  /* right upper square
                         DEFMOUSE 2
                    ELSE              /* right down square
                         DEFMOUSE 5
                    ENDIF
               ENDIF
          LOOP

===============================================================

Command:       HIDEM

Function:      Set the mouse symbol off

Syntax:        HIDEM

Example:

               SCREEN 16
               border% = _Y >> 1
               hidden! = FALSE
               DO
                    MOUSE mx%,my%,mk%
                    IF my% > border%
                         HIDEM
                         hidden! = TRUE
                    ELSE IF (my% <= border%) && (hidden!)
                         SHOWM
                         hidden! = FALSE
                    ENDIF
               LOOP UNTIL mk%          
        
================================================================

Command:       SHOWM

Function:      Sets the mouse symbol to on

Example:       See the example for HIDEM

================================================================

Function:      MOUSEX

Function:      Returns the x-position of the mouse pointer

Syntax:        mx% = MOUSEX
               mx%: ivar  
     
Example:
               SCREEN 16                /* EGA Mode
               DO
                    IF MOUSEK

                         TEXT 8,16,MOUSEX   
                    ENDIF
               LOOP

==============================================================

Function:      MOUSEY

Function:      Returns the y-position of the mouse pointer

Syntax:        my% = MOUSEY
               my%: ivar  
     
Example:
               SCREEN 16                /* EGA Mode
               DO
                    IF MOUSEK
                         TEXT 8,16,MOUSEY  
                    ENDIF
               LOOP

==============================================================

Function:      MOUSEK

Function:      Returns the status of the mouse buttons

Syntax:        mk%=MOUSEK
               mk%: ivar

Example:
               SCREEN 16             /* ega mode
               DO
                    SWITCH MOUSEK
                    CASE 1
                         TEXT 8,16,"left button pressed"
                    CASE 2
                         TEXT 8,16,"right button pressed"
                    CASE 3
                         TEXT 8,16,"both buttons pressed"
                    ENDSWITCH
               LOOP

==============================================================

Command:       MOUSE

Function:      You  can  use  the  MOUSEX,   MOUSEY,   MOUSEK  in 
               combination.  Optionally you can use an additional 
               parameter (4. parameter), which returns the status 
               of the KB-SHIFT key.
 
Syntax:        MOUSE mx%,my%,mk%[,kb%]
               mx%,my%,mz%,mk%,kb%: ivar

               The  command MOUSE  has the combined  function  of 
               the individual commands MOUSEX, MOUSEY and MOUSEK.
Example:
               SCREEN 16             /* ega mode
               DO
                    ax%=mx%,ay%=my%,ak%=mk%,akb%=kb%
                    MOUSE mx%,my%,mk%,kb%
                    IF (ax%<>mx%)||(ay%<>my%)||(ak%<>mk%)||
                                                (akb%<>kb%) 
                         TEXT 8,16,SPACE$(999)
                         a$=STR$(mx%,4,0) + STR$(my%,4,0)
                         a$=a$+STR$(mk%,8,0) + STR$(kb%,8,0)
                         TEXT 8,16,a$
                    ENDIF
               LOOP

===============================================================

Debugging:     TTEXT and MON:

Starting  from  Version  4.31 you have the  possibility  to  use, 
additional  to an EGA/VGA adaptor,  a monochrome display  adaptor 
for the output of debugging information or for Printing text   on 
the second monitor.  To use this facility,  open a file with  the 
name  MON:.  Printing  to  this file displays  the  text  on  the 
monochrome monitor.

=================================================================

Command:       MON:           

Function:      Displays  debugging  information to  a  monochrome 
               monitor.

Example:       OPEN "o",#99,"MON:"
               TRON #99

               /*  This  example  prints  the TRACE   information  
               /*  on  the  connected monochrome monitor.

=================================================================

Command:       TTEXT

Function:      TTEXT  X,Y,S  allows  you  to  write  text  at   a  
               special position of the monochrome monitor.

Syntax:        TTEXT x%,y%,a$
               x%,y%: ivar
               a$:    sexp

               The  parameters x% and y% define the  position  of 
               the  string  (1<=x%<=80;1<=y%  <=25).  s$  is  the 
               output string.  So you can work with screen masks. 
               With the y-Parameter you can set a text  attribute 
               (like TCOLOR). 

Example:
               TTEXT 5,6|$70<<8,"Hello"

               prints  at the position 5,6 in inverse the  string 
               'Hello'.

================================================================

Command:       BOUNDARY

Function:      Defines  a  boundary for  the  commands  POLYFILL,  
               PELLIPSE, PCIRCLE.

Syntax:        BOUNDARY i%,c1%,c2%
               i%,c1%,c2%: iexp

               For the parameters i%,c1%,c2%:

               i% = 0    Border not drawn (default)
               i% = 1    Border drawn
               
               c1%       Defines the foreground colour of border
               c2%       Defines the background colour of border

Example:
               SCREEN 18                /* vga mode
               COLOR 7,7                /* Fill colour
               DEFLINE 3
               BOUNDARY 1,14,1          /* Border on!
               PCIRCLE 400,100,100
               KEYGET a%

================================================================

Command:       SOUND

Function:      Outputs a sound with tone and duration.

Syntax:        SOUND f%,d%
               f%,d%: iexp

               f%  gives the frequency of sound in Hz   and   d%                
               the duration in Ticks (1/18 second).

Example:
               f%=300
               DO
                    f% ++
                    d% = RAND(10)
                    SOUND f%,d%
               LOOP UNTIL f% = 700

               /* Outputs a sound with variable duration and 
               /* increasing frequency 

================================================================

CURSOR POSITIONING

A correction to the reference manual:

     LOCATE x,y          Positions cursor at x,y
     PRINT AT(x,y)       Positions cursor at x,y

NEW

     LOCAXY x,y          Positions cursor at x,y 
     LOCAYX y,x          Positions cursor at y,xy

     PRINT ATXY(x,y)     Positions cursor at x,y
     PRINT ATYX(,xy)     Positions cursor at y,x

================================================================

I/O Handling

Function:      _FILE(n)

Action:        Returns the MS-DOS File Handle of open files #n
               If  no  file  #n is  open,  a  negative  value  is 
               returned. n% must be between 1 and 99.      

Syntax:        _FILE(n%)
               n%: iexp

Example:       OPEN "o", #1,"con:"
               OPEN "o", #2,"lpt1:"
               OPEN "o", #3,"com1"
               OPEN "o", #4,"test1"
               OPEN "o", #5,"test2"
               FOR i% = 1 TO 5
                    PRINT _FILE(i%)
                    CLOSE #1
               NEXT i%
               KEYGET a%

               // -1,-3,-7 and then the  MS-DOS file  handles  (5 
               // and 6)

================================================================

STACK HANDLING

Function       P:

Action:        Changes the stack order for the parameters.

Syntax:        P:(addr%)[x,y,....]
               addr%:    ivar; address
               x,y,...   parameter list

Explanation:   Changes  the order in which parameters are  placed 
               on the stack to that of the Pascal standard.

Example:       C:(addr%)(1,2,L:3)       P:(addr%)(1,2,L:3)

               0    (HI Word)           1
               3    (LO Word)           2
               2                        0
               1                        3
               Segment                  Segment
               Offset                   Offset

================================================================

Command:       STACKSIZE

Action:        GFA-BASIC has a default stack size of 16384 Bytes.
               This can be changed.

Syntax:        STACKSIZE n%
               n%: iexp

Example:       STACKSIZE 60000


================================================================
       
Command:       DEFTEXT

Action:        Changes text between Bold and thin styles.

Syntax:        DEFTEXT ,n%
               n%: ivar

Example:       
               SCREEN 18
               DEFTEXT ,1
               COLOR 0,15
               TEXT 10,16," Hello GFA"
               DEFTEXT ,0
               COLOR 0,15
               TEXT 200,16," Hello GFA"
               KEYGET a%

================================================================

Command:       WINDSET

Action:        Defines  the window parameters.  WINDSET  14  when 
               used  with a VGA or EGA card can change  the  font 
               size.

Syntax:        WINDSET 14,n%
               n%:  iexp

               where:

               WINDSET 14,8   :     8*8 Font 
               WINDSET 14,14  :     14*8
               WINDSET 14,16  :     16*8
               WINDSET 14,0   :     Default  Font

Example:       SCREEN 18
               WINDSET 14,0
               TEXT 20,20, "Hello GFA"
               WINDSET 14,8
               TEXT 100,20, "Hello GFA"
               WINDSET 14,14
               TEXT 200,20, "Hello GFA"
               KEYGET a%

               // gives: Hello GFA in 3 fonts

               SCREEN 18                                                
               DIM a|(256*16-1)                                         
               a%={$43*4}                                                             
               b|=$55                                               
               FOR f%=0 TO 256*16-1                                     
                  a|=BYTE{a%+f%}                                                          
                  a|(f%)=a| AND b|                                       
                  b|=ROL|(b|,1)                                         
               NEXT f%                                                  
               WINDSET 14,16                                            
               WINDSET 15,V:a|(0)                                       
               TEXT 100,100,"Hello GFA"                                 
               WINDSET 15,0                                             
               TEXT 100,120,"Hello GFA"

               This would print "Hello GFA"  in 2 fonts
               
               If you placed after the first TEXT line:
               
               BSAVE "MYFONT.DEG",V:a|(0),256*16

               The  current font can be saved and later  recalled 
               using:

               SCREEN 18 
               LOADFONT "MYFONT.DEG"
               TEXT 100,100, "Hello GFA"
               FREEFONT
               TEXT 100, 120, "Hello GFA"
               KEYGET a%

===============================================================
Function:      POPUP(a$,x,y,i)


The parameter i means:

          0 :  the  upper  left  corner of the  pop-up  menu   is  
               specified by the variables x and y
          
          1 :  the   middle  of  the pop-up menu   is   specified  
               by  the variables x and y

          2 :  the pop-up menu is centred to the screen

          3 :  the   upper  left  corner of the  pop-up  menu  is  
               specified by  the  variables  x and y.  The pop-up  
               menu  may  be quit  by pressing the left or  right 
               cursor   button.    In  this   case  the  function 
               POPUP() returns  the  following  values:

 
                 2 :     if  the  left mouse-button  was  pressed 
                         outside the pop-up menu
                 3 :     if the pop-up menu was quitted by  pres-
                         sing the left cursor key
                 4 :     if the pop-up menu was quitted by  pres-
                         sing the right cursor key

     Note, that the pop-up menu works only in a graphics mode!.

=================================================================

Command:       DEFLINE

Syntax:        DEFLINE lm&,ld&,lv&,le&

               lm&,ld&,lv&,le;     iexp

The parameter list of the command DEFLINE is specified by:
 
               lm&       (linestyle)  defines the style of  lines 
                         with width 1 in the way described in the 
                         manual

               ld&       (linewidth)  if  a  linewidth  >  3   is 
                         selected  the lines are  filled  by  the 
                         pattern specified by the DEFFILL command.

               lv&       (linejoin)      
                         lv& = 0   means closed lines
                         lv& = 1   means join miter
                         lv& = 2   means lines joined rounded

               le&       (linecaps)
                         le& = 0 means no caps
                         le& = 1 means caps projected square
                         le& = 2 means caps rounded

===============================================================

EDITOR

<Ctrl> K or <Ctrl> Q will bring up an additional menu from  which 
you can select further options.

     ^KB       Mark block start
     ^KK       Mark block end
     ^KC       Copy block to cursor position
     ^KV       Move block to cursor position
     ^KW       Write block to disk in ASCII format
     ^KP       Print block to printer
     ^KH       Hide block  
     ^KY       Delete Block
     ^KR       Read block
     ^KM       Block move (same as ^KV)
     ^KS       Save (same as F1-S or ALT-F-S)
     ^KQ       Quit Editor. (same as F1-X)
     ^KD       Save and then Quit Editor
     ^KO       Set Marker 0
     ^Kn       Set Marker n (0 to 9)
     ^K9       Set Marker 9
     
     ^QF       Find (same as F2-F or ALT-L)
     ^QA       Find and Replace (same as F2-E or ALT-E) 
     ^QY       Delete to End of Line (Same as ^P)
     ^QO       Output to End of Line
     ^QL       Restore Line
     ^QB       Go to block start
     ^QK       Go to block end
     ^QO       Go to Marker 0
     ^Qn       Go to Marker n (n=0 to 9)
     ^Q9       Go to Marker 9

Where ^ = <Ctrl> key.

Additional new key functions available on AT keyboard:

     F11       Fold Procedure (same as ALT-Q)
     F12       Fold all Procedure from cursor (same as ALT-W)
     ALT-INS   Inserts line in buffer to screen (same as ^U) 
     ALT-DEL   Copies line into buffer 
     ALT-Bsp   UNDO (same as ALT-U)
     ^DEL      Delete line with cursor (same as ^Y)
     ^INS      UNDO line delete (same as ^U)

 

================================================================

FILESELECTOR

If  your program runs in a graphical mode,  you can use the  GFA-
BASIC fileselector and pop-up menu.

The various components of the fileselector box are:
 
          # - button :        drive selector
          . - button :        back to the next upper directory
          \ - button :        back to root directory
          upper input box :   input of the selection mask
          cursor area     :   select  files,  directories  and 
                              drives
          lower input box :   input of the file name
          O.K. - button   :   confirms the selection
          Abort button    :   back to the program

To shift between the different buttons and boxes,  use the  'TAB' 
and/or the 'Shift + TAB' keys.

The  'RETURN'-key  executes  the function  corresponding  to  the 
selected button or area

Use  of  the mouse-cursor and the left mouse  button  and/or  the 
hotkeys leads to direct execution of the selected function.

Use following hotkeys for the different buttons and boxes:

 
                #  for the         # - button
                .  for the         . - button
                / or \ for the     \ - button
                *  for the         upper input box
                space              cursor area
                cusor              cursor area
                f or F for the     lower input box
                o or O for the     O.K. button
                a or A for the     Abort button

================================================================

CHAR{BASEPAGE+129}

Unlike  the ATARI ST the MS-DOS version does not write  a   zero-
BYTE at the end of a commandline,   instead  MS-DOS writes a  CR.  
From Ver.4.30 GFA-BASIC overwrites this CR with a zero.

PRIORITIES

There exists an AND,  for bit comparing,  with a higher  priority 
than simple & for normal compares.

============================================================================

TRY / CATCH	(local error handling)

In the latest Version of GFA-BASIC for MS-DOS (4.50) and GFA-BASIC for
Windows (4.20) a new pair of Commands replaces the old ON ERROR GOSUB
and RESUME commands.

The old method worked globally, that is it was not usable for a structured
program: a catch all error routine was very hard to write and to maintain.

TRY and CATCH appears always as a pair inside a procedure or function.
The statements after TRY are executed as usual, and the CATCH acts as the
standart RETURN (or ENDFUNC). But if an error occurs, execution is
transfered to the CATCH.

Example:
test
PROCEDURE test
	LOCAL i
	TRY
		FOR i = -9 TO 9
			PRINT @Rezip(i);", ";
		NEXT i
	CATCH
	PRINT "There is an error occured in PROCEDURE test"
	PRINT ERR$(ERR)
	KEYGET a%
RETURN
FUNCTION Rezip(x)
	RETURN 1/x
ENDFUNC

The above program will print
-0.11.., -0.125, -0.14.., -0.16..,-0.2,-0.25,-0.33..,-0.5,-1,
and then it will print the message and the error text, wait for a keystroke
and return.

A simple change in the function, using TRY/CATCH again, permits to supply
a error value (1/0 is not defined, but one divided by very small numbers
gives a very high result, now lets supply one,catching overflows as well).

FUNCTION Rezip(x)
TRY
	RETURN 1/x
CATCH
RETURN 1E99
ENDFUNC

This changed program will continue after -1 with 1E+99,1,0.5,0.3.. ...

And because the TRY/CATCH does work locally, other errors in test would be
handled there.

A second example is a procedure reading a configuration value from a file

@ReadValue("CONFIG.CFG",1000,Anzahl&)
PROCEDURE ReadValue(File$,Def&, VAR Ret&)
	TRY 
		OPEN "I",#1,File$
		INPUT #1,Ret&
		CLOSE #1
	CATCH
	CLOSE #1		//in case file opened ok, but input failed
	Ret& = Def&	// Return default value
RETURN

A third example, just displaying a graph of the function sin(x)/x.
This function is everywhere defined and gives nice results, except for
zero, giving no result at all there. Very small numbers, positive and
negative, approach 1.0, so lets put this value there
(sin(0.0)/0.0 = 0.0/0.0 could give 1.0?).

SCREEN 18			// Screen for DOS
OPENW #1,0,0,_X,_Y,0		//Window for Windows
y0&=_Y/2,ys&=_Y/2
COLOR 8
FOR  i&=0 TO _X STEP 2
	ix = (i&-_X/2)/20
	PLOT i&,y0& - @sinx-by-x(ix) * ys&
NEXT i&
KEYGET a%
FUNCTION sinx_by_x(x)
	TRY
		RETURN SIN(x)/x
	CATCH
	RETURN 1
ENDFUNC

This modified program does display a simple three d view.
SCREEN 18			//Screen for DOS
OPENW #1,0,0,_X,_Y,0		//Window for Windows
y0&=_Y/2,ys&=_Y/2
COLOR 0
FOR j&=0 TO _Y STEP 4
	jx = (j&-_Y/2)/20,	jx2 = jx*jx
	FOR i&=0 TO _X STEP 2
		ix = (i&-_X/2)/20, f = SQR(ix^2 + jx2)
		z& = y0& - @sinx_by_x(f)*ys&
		PSET i&,z&,15
		LINE i&,z&+1,i&,_Y
	NEXT i&
	y0&++
NEXT j&
KEYGET a%
FUNCTION sinx_by_x(x)
	TRY
		RETURN SIN(x)/x
	CATCH
	RETURN 1
ENDFUNC

Another benefit from using TRY/CATCH instead of the old ON ERROR - RESUME
is for the compiler. With RESUME it would need to do a TRY-CATCH around
every single statement in the program or many compileroptions spread
everywhere in the program (roughlyequivalent to TRY-CATCH, but with quite
a bit more problems), thus requiring extensive work on the program after
it's running in the interpreter to make it compileable without using up
much of it's speed and increasing the chances of an eventual error.

============================================================================
GW BASIC Compatability

As an aid to read old GWBASIC Files containing binary floating point
numbers - written with GWBASICs MKS$() or MKD$() - in the Microsoft Binary
Float (MBF),  format there are now the Functions corresponding to CVS()
and CVD().

x = CVSMBF(x$)	converts a number from a four byte string in MBF-Single
format.(it has about 6 accurate digits, rest random).

x = CVDMBF(x$)	same, only eight byte und MBF-Double (In GWBASIC the four
additional Bytes are only filled with zero, i. e. the same 6 digits)

The reverse functions are also available::

x$ = MKSMBF$(x)
x$ = MKDMBF$(x)



EOF

GWBASIC has, (as  other very old programs, created before MS-DOS), the habit
of appending a control z CHR$(26) at the end of files. To aid in reading
such files, the EOF() function has changed. It now returns -1 at the end
of a file AND when there is only on byte CHR$(26) left.

============================================================================


MEMORY MAP

The  following  program will provide you with a  Memory  Map.  By 
using  MALLOC  or DIM,  or executing string  functions,  or  just 
editing a program,  you may ask for more memory in this  system., 
or  free  it  with  MFREE,   ERASE,   NEW  etc.   Due  to  memory 
organisation,  there may be used blocks between free memory.  MS-
DOS does its best to prevent fragmentation.


//Gives Detailed Memory Map
CLS
DspMem()
DIM a%(999)
DspMem()
ERASE a%()
DspMem()
PROCEDURE DspMem
     PRINT "Free String Memory ";FRE(0)
     link%=0
     linkp%=*link%
     n%=0,total%=0
     DO
          size%=MALLOC(-1)
          EXIT IF size%=0
          adr%=MALLOC(size%)
          PRINT "Memory AT ";HEX$(adr%,8);" Size ";size%
          { linkp%}=adr%       //Use malloced memory to store 
                               //linked                   
          linkp%=adr%          //list of memory blocks
          n%++,total%+=size%
     LOOP
     PRINT "Total Available Memory is ";total%;" in ";n%;" Blocks"
 
     PRINT "Freeing Memory"
     { adr%}=0                 //Mark end of list
     linkp%=*link%
     DO
          adr%=linkp%
          EXIT IF !adr%        //End of list
          linkp%={adr%}        //Next block
          ~MFREE(adr%)
     LOOP
     ~FRE(0)
RETURN

================================================================

BREAK PROGRAM

Stopping a running program is possible with combination of SHIFT 
+ ALT + CTRL (left).


===============================================================

CURSOR IN TEXT MODE

To disable the cursor in text modes use  
               
                    ~INTR($10,_AH=1,_CX=-1), 
to   re-enable   the   cursor   use   

                    ~INTR($10,_AH=1,_CX=$0708). 

Generally, cursor start and end rows are given in _CL and _CH.

==============================================================

OPTION,1

This OPTION,1 command will set the first record od a randam I/O file to 1. The default first record is 0


==============================================================

NEW EDITOR COMMANDS

CHECK NAMES

If this switch is active, you get an alert for every new name for 
variables  or procedures.  With the alert box you can control  if 
the name you typed, really is a new variable or maybe a mistake.

FONT

With this option you can switch between 25 and 43/50 lines on  an 
EGA and VGA adaptor.

==============================================================

ERROR CODES

Errors which can occur from the operating system

1       "Function no wrong"
        Internal DOS call with a wrong function number
2       "File not found"
        CHDIR wrong or wrong access path with OPEN
3       "Path not found"
        The search path during access to a file could not be found.
4       "Too many open files"
        Too many files were opened for access.
        Check your program for the number of simultaneously opened files.
        If specified, increase the number of FILES in the CONFIG.SYS
5       "No Permission"
        No access allowed
6       "File handle error"
        Either an attempt was made to open a file with a number higher 
        that the DOS limit (normally 16), or you have tried to execute 
        a command on an unopened file.
7       "MDB destroyed -- crashing"
        MDB segment was destroyed.
8       "Out of memory"
        This message can be caused by all commands which allocate 
        additional memory, for example for creation of large arrays.
9       "Address wrong"
        Wrong address of a memory block
10      "Environment wrong"
        Environment was destroyed.
11      "Format error"
        Wrong file format
12      "Access Code error"
13      "Invalid data"
        Data on disk unreadable
15      "Device wrong"
16      "RMDIR error"
        An attempt was made with the RMDIR command to close a 
        subdirectory which was not empty.
17      "No rename across drives"
18      "File table full"
        There is no more place in the directory where the file is to be 
        written.
19      "Argument error"
20      "Argument list too long"
21      "Exec format"
22      "Cross-device link"
33      "Math argument"
34      "Range error"
35      "File exists"
        A file name cannot be used since a file with the same name already 
        exists in the same directory.

GFA-BASIC interpreter error messages

1       "Divide by zero"
        A division by zero occurred during an arithmetic operation.
2       "Overflow"
        The result of a calculation overflows the allowed value 
        range of the used format.
2       "Not integer"
        An integer value was expected from an operation.
3       "Range error"
        The maximum value range of variable in a function 
        (for example ASIN) was exceeded.
4       "Negative square root"
        An attempt was made to get a square root from a negative 
        number.
5       "SINGLE{} overflow"
        Range error when using the IEEE Single format.
7       "Redimension"
        The program attempted to dimension an array several times.
8       "Array not one dimension"
        An attempt was made at multi dimensional access of a single 
        dimensional array.
9       "Array index too big"
        An index used for reading from/writing to an array is 
        bigger than the value given during dimensioning.
10      "Dim too big"
        Overflow of the range value during dimensioning of an array.
11      "Number of dimensions wrong"
        An attempt was made to access an array in a dimension other 
        than in which it was defined.
13      "String too long"
        The string is more than 32 KB long. The error can occur 
        when for example the screen contents are saved in a string 
        using GET.
14      "Expression too complex"
        An arithmetic expression contains too many operators/operands, 
        to be interpreted correctly. Brake the expression up in 
        simplest parts.
20      "Array too small"
        The used array is too small (for example when using the XLATE$
        command).
21      "Wrong file#"
        An illegal file number (#>100 or #<0) was used when opening a 
        file.
22      "File already opened"
        An attempt was made to open an already opened file.
23      "Open mode illegal"
        An unknown or illegal file mode was used when opening a file.
24      "File not opened"
        An attempt was made to execute a command on an unopened file.
29      "Polygon too complex"
        Too many points (more than 1024) were specified when using 
        POLYFILL or POLYLINE.
30      "Array Type Error"
        Usage of wrong array type
31      "Type redefinition"
        An attempt was made to define a variable in a TYPE structure 
        more than once.
32      "Type undefined"
        An attempt was made to access an undefined TYPE structure.
33      "Type mismatch"
        An error occurred when accessing a variable structure which was 
        defined with the TYPE command (for example a typing error when 
        selecting a TYPE variable).
34      "Element redefinition"
        An attempt was made, to define a variable repeatedly in several 
        TYPE structures.
35      "Array too big"
40      "Procedure undefined"
        A procedure executed from a program does not exist or was 
        called using a wrong name (typing error).
41      "Parameter mismatch"
        An error occurred when passing parameters to a procedure or 
        function. This can for example be the passing of a wrong 
        variable.
42      "Too many parameters"
        Too many parameters were specified when passing parameters to a 
        procedure or function.
43      "Missing parameters"
        Too few parameters were specified when passing parameters to a 
        procedure or function.
44      "MatrixErr"
        An error occurred when using a matrix command, for example using 
        matrices with arrays with to big an index.
45      "Bound error"
        The allowed range was exceeded when using the BOUND command.
46      "Out of DATA"
        During the reading of DATA fields in a loop the end of DATA was 
        reached before the end of the loop.
47      "Data not numeric"
        During the reading of variables using the READ command an 
        incorrect variable type was read in.
48      "Wrong window no"
        An illegal window number was used with a window command 
        (OPENW #, TITLE #...).
49      "Window not open"
        An attempt was made to perform a graphic operation in a window 
        which was not previously opened.
50      "WinNotTopped"
        An attempt was made to perform a graphic operation in a window 
        which is overlapped by another window.
52      "Matrix not square"
        A matrix command was used on a matrix which must be square 
        (for example MATINV).
53      "Matrix product undefined"
        Multiplying two matrices whose dimensions do not correspond.
56      "Not in proc or for"
        The command CLEAR or STACKSIZE was used in a procedure or a FOR 
        NEXT loop.
57      "LPT error"
        The printer does not react. This error can occur if there is 
        no paper in the printer, the printer is not ON LINE or is 
        not turned on or no printer connected.
58      "COM error"
        A TIMEOUT occurred during access to a serial port.
59      "Illegal drive"
        An attempt was made to write to a nonexistent drive.
60      "PUT string error"
        The string used for the PUT command does not have the correct 
        string format.
61      "Screen error"
        SCREEN mode not supported by the graphic card was selected during 
        graphic output.
62      "End of file"
        An end of file was reached during reading of a file before the 
        end of the reading loop.
88      "BSAVE/BLOAD error"
        An error occurred while using BSAVE or BLOAD.
89      "GOTO error"
        The GOTO command was used in an illegal manner (for example to 
        jump in out of a FOR NEXT loop).
90      "Random I/O-Error"
        Error while using GET, PUT or RECORD.
99      "Stack Overflow"
        Stack overflow during a program run. This can happen when nesting 
        is too deep.
100     "GFA-BASIC PC 4.30|(c) 1990 GFA Systemtechnik"
        Output of the GFA-BASIC version by using PRINT ERR$(100)
122     "Proc/Func too big"
        A procedure or a function is bigger than 32 KB.
123     "FUNCTION undefined"
        An attempt was made within a program to invoke a nonexistent 
        function. This error can for example occur by mistyping a 
        function name.
124     "ENDFUNC executed"
        An attempt was made to execute the end of a function as a command 
        (erroneous Return).
125     "Math Err 2"
        An error occurred during an arithmetic operation which involves a 
        coprocessor.
126     "Load Error"
        An error occurred during loading of a file.
127     "Math Err 1"
        An error occurred during an arithmetic operation which involves a 
        coprocessor.
128     "Stopped"
        The program was interrupted (for example by pressing Ctrl-Break).

Errors which can occur when using EMS memory

15      "EMS full"
        An attempt was made to write a file to EMS memory using EMSPUT. 
        However, no EMS memory is available, or the data overflows 
        available EMS memory.
16      "EPopReDim"
17      "EMSInitFail"
        An error occurred trying to initialise EMS memory.
18      "EPushNotDim"
19      "EMSAccFail"
25      "EMSempty"
        An attempt was made to read a file from EMS memory using EMSGET 
        but EMS memory contains no file.
26      "EMSTypeMismatch"
27      "EMSMemBlk2Large"
        The EMS block to be read is too big.
28      "EMSMemBlk2Small"
        The EMS area where the file is to be stored is too small.
36      "FMSAccFail"
37      "EMSCfgAccFail"
38      "EMSNameNotFound"
        The EMS identification was not found.
39	"EMSMemBlk0"



=============================================================================
GFA2EXE - version 1.01

To convert an GFA-BASIC (MS-DOS) GFA-File to an EXE-File:

GFA2EXE xxx yyy
    Reads  XXX.GFA
    Writes YYY.EXE

GFA2EXE xxx
    Reads  XXX.GFA
    Writes XXX.EXE

No checks are made to save old .EXE!!!


The resulting EXE-File needs GFABASIC.OVL in the current directory or
somewhere in the PATH (z.B. C:\DOS\GFABASIC.OVL). It doesn't work with
DOS 2.xx.

First the EXE-File does search the PATH for

    GFABAS00.OVL	if you have an	normal PC/AT
    GFABAS03.OVL	if you have a 386
    GFABAS70.OVL	if you have a PC/AT with a 8087 or 80287
    GFABAS73.OVL	if you have a 386 with 387 or a 486

If it doesn't find the one it searches for, it looks for
    GFABASIC.OVL

To install GFA2EXE you should copy the files somewhere into the PATH
(i.e.: C:\DOS or similar)

    GFABAS??.OVL
    GFA2EXE.EXE

To give away some EXEs you later need all the GFABAS??.OVL-Files or just
the GFABAS00.OVL renamed to GFABASIC.OVL.


The resulting EXE is shorter - and faster - than the GFA-File.

Example:
    XXX.GFA	76K	(SAVE)
    XXX.GFA	40K	(PSAVE)
    XXX.EXE	29K	(GFA2EXE)


Changed Working of TRON/TROFF

Before any command-lines are executed, a small routine is executed,
which checkes for STOP (Ctrl-Break or Shift-Alt-Ctrl) and save some
information for a later RESUME. This does increase program size by
two bytes for (almost) every program line. With the TROFF-command
you can disable this routine, and switch it back on with something
like TRON #97 (you should use a not used file number to speed up the
execution in the interpreter).

    You can use:
    IF 0 THEN TRON #97
    TROFF

for a check stop once. The IF 0 is intendet to save some time in the
interpreter, which it would otherwise spend to execute some unneeded
instructions at every statement (It does cost a few bytes).



DEBUG Option

If you precede the GFA-File-Name with a minus sign (-TEST.GFA) the GFA2EXE
does print out line numbers it's working on.
If you have a problem when generating the exe-file, you should retry it with
the minus and then try getting a couple of Lines (a procedure or function)
to compile seperately and so give us a reproducable error.
New Products: 

GFA-BASIC - dBase Interface

GFA-BASIC for MS-DOS is now able to access dBase III and dBase IV files
with the GFA-dBase Interface. This optional module will enable you to 
manipulate your dBase files. 
=============================================================================


DOCUMENT END
