Home PageDownloadBeginner's ZoneAmateur's ZoneExpert's ZoneTips PageProgramming LinksE-Mail Me
The Basics of BASIC | Getting Started with the GFA Enviroment | Beginners to Windows

GFA Beginners
Differences from other BASICs

GFA Basic is a powerful BASIC, the most powerful Basic I know. Here's a quick run-down of GFA Basic's main differences from other BASICs:

A big plus for GFA Basic is that you don't have to declare variables or functions. Declaring is a process in which code is put in the program to tell the language what variables or functions are going to be used and what type they are. GFA Basic declares all the variables internally. This process means that it's a lot easier to start a program as you don't need to set-up many things before you can get right into the coding. Don't worry if you don't understand this I will explain more below.

So I'll just mention a few more things before I show you some code.

Variables - Variables are at the base of any programming language, they are what programming is all about. Variables are places in memory that hold a number or numbers, the more memory given to a variable the higher the number it can handle (for an introduction to variables look at The Basics of BASIC). GFA Basic uses suffixes to tell you what sort of variable it is:

Suffix Name Memory Used Range
! Boolean 1 Bit 0 or -1
| Byte 1 Byte (8 Bits) 0 to 255
& Word 2 Bytes (16 Bits) -32768 to 32767
% Long 4 Bytes (32 Bits) -2147483648 to 2147483647
# Floating Point 8 Bytes (64 Bits) Huge. Can have decimal places.
$ String Depends on content Used to store characters eg. I$="Hello"

If you don't put any suffix then it will be taken as a floating point, unless you specify differently.

Right then, let's try a simple program. This will open a window and then draw a character moving across it (you can copy this from this page directly into the GFA Basic editor if you like):

OPENW #1 
'Opens a window
x&=0
ex!=0
REPEAT
  PRINT AT(x&,5);"M";
  'Puts the letter M at the screen position x&,5
  t%=TIMER
  REPEAT
    PEEKEVENT 
    'Allows Windows to continue functioning
    IF MENU(1)=4
      'this checks for the close box being pressed...
      ex! = -1
      'and if it is it sets the exit flag to -1
    ENDIF
  UNTIL TIMER-t%>500 
  'This will wait half a second before continuing
  '(it counts in 1000ths of a second)
  PRINT AT(x&,5);"     "; 
  'Deletes the M by putting 5 spaces over it
  INC x&
  'INCreases x& by 1
UNTIL ex! = -1
'This means that the loop will end when the value of ex! is -1
CLOSEW #1
'Closes the window

If you don't understand any of the program then have a look in the help file. In fact that's good advice for anyone, always check the help file for answers, more often than not you can find out what you need. For this program TIMER, MENU() and PEEKEVENT should be able to answer most questions. I hope this has helped a bit in starting you off with programming in GFA Basic. Believe me, it is worth sticking with, programming isn't only fun it's also a very good line of work to get into and once you know programming, everything else computer-related becomes a lot easier. For me GFA Basic was the perfect way to start, hopefully you will find the same.

The Basics of BASIC | Getting Started with the GFA Enviroment | Beginners to Windows
Home PageDownloadBeginner's ZoneAmateur's ZoneExpert's ZoneTips PageProgramming LinksE-Mail Me