GFA BASIC TIPS & TRICKS by Richard Karsmakers
Originally published in ST NEWS Volume 1 Issue 4, launched on
September 7th, 1986.
In this time's issue of ST NEWS we will be able to reveal some
quite stunning hints & tips for use with GfA Basic. We've also
come accross some GfA Basic specifications and a list of GfA Basic
commands(thanks RFJ, whomever you may be!). I think we will hereby
give you a very useful tip: all GfA Basic programs can be quit
while running if you press SHIFT, CONTROL and ALTERNATE
simultaneously. Useful, isn't it?
Hereby we supply you with a list of GfA Basic commands, after
which we will systematically review some commands (also in
upcoming issues of ST NEWS).
KEY WORDS AND FUNCTIONS
ABS(Y)
ADD Y,N
ALERT picture,msg$,buts,but$,ret_var
ARRAYFILL field(),n
ARRPTR(var$)
ASC(x$)
ATN(x)
BIN$(x)
BLOAD "name" [,address ]
BSAVE "name",address,len
BOX x1,y1,x2,y2
x = C:var( parameterlist )
CALL var( parameterlist )
CHAIN "filespec"
CHDIR "path"
CHDRIVE n
CHR$(x)
CIRCLE x,y,r [ ,phi0,phi1 ]
CLEAR
CLEARW n
CLOSE [[#]n]
CLOSEW n
CLS [#i]
COLOR c
CONT
COS(x)
CVI(x$)
CVL(x$)
CVS(x$)
CVF(x$)
CVD(x$)
DATA [const[,const]...]
DATE$
DEC var
DEFFILL [color],[style],[patern]
DEFFILL [color],patern$
DEFFN name[ (varlist) ]=expression
DEFLINE [ style ],[ width ],[ begin ],[ end ]
DEFLIST x
DEFMARK [ color ],[ type ], [ height ]
DEFMOUSE n
DEFMOUSE A$
DEFTEXT [ color ], [ style ], [ rotation ], [ height ]
DFREE(n)
DIM var( indices ) [,var( indices ),...]
DIM?( array() )
DIR [ "Filespec" [TO "file"]]
DIR$(n)
DIV var,n
DO/LOOP
DRAW [ TO ] x0,y0 [ TO x1,y1, .... TO Xn,Yn ]
EDIT
ELLIPSE x,y,rx,ry [,phi0,phi1 ]
END
EOF( [#]n )
ERASE array()
ERR
ERROR n
EXIST( "Filespec " )
EXIT IF
EXP(x)
FATAL
FIELD [#]n, expr. AS var$
FILES ["filespec" [TO "file"]]
FILESELECT "filespec","filename",ret$
FILL x,y
FIX(x)
FOR var=expr [DOWN]TO expr [ STEP s ] / NEXT var
FRAC(x)
FRE(x)
FULLW n
GET x0,y0,x1,y1,str$
GET [#]n [,i]
GOSUB procedurename
GOTO label
GRAPHMODE n
HARDCOPY
HEX$(x)
IF expr [THEN]
block
[ELSE]
block
ENDIF
INC var
INFOW n,"info line"
INKEY$
INP(x)
INP(#n)
INPUT ["text" ; (or) , ] var[,var...]
INPUT #n,var[,var]
INPUT$( x[,#n] )
INSTR( [n,] a$,b$ )
INSTR( a$,b$[,n] )
INT(x)
KILL "filespec"
LEFT$( a$[,n] )
LEN( x$ )
LET var = expr
LINE x0,y0,x1,y1
LINE INPUT
LIST "filename"
LLIST
LOAD "filespec"
LOC( [#]n )
LOCAL var[,var,...]
LOF( [#]n )
LOG(x)
LOG10(x)
LPOS(n)
LPRINT ...
LSET a$=b$
MAX ( expr[ ,expr, ... ] )
MENU array$()
MENU KILL
MENU OFF
MENU( n )
MID$( a$,a[,n] )
MIN ( expr[ ,expr, ... ] )
MKDIR "new_path"
MKI$(n)
MKL$(n)
MKS$(n)
MKF$(n)
MKD$(n)
MOUSE x,y,key
MOUSEX
MOUSEY
MOUSEK
MUL var,n
NAME "oldname" AS "newname"
NEW
OCT$(x)
ON expr GOSUB proc.list
ON BREAK
ON BREAK CONT
ON BREAK GOSUB name
ON ERROR
ON ERROR GOSUB name
ON MENU GOSUB proc_name
ON MENU KEY GOSUB proc_name
ON MENU MESSAGE GOSUB proc_name
ON MENU IBOX n,x,y,w,h GOSUB proc_name
ON MENU OBOX n,x,y,w,h GOSUB proc_name
ON MENU
OPEN O/I/A/U/R, [#]n, "filename" [,len ]
OPENW n[ ,w,h ]
OUT x,a
OUT #n,a
PAUSE x
PBOX x0,y0,x1,y1
PCIRCLE x,y,r [,phi0,phi1 ]
PELLIPSE x,y,rx,ry [,phi0,phi1 ]
PRBOX x0,y0,x1,y1
PEEK(x)
DPEEK(x)
LPEEK(x)
PI
PLOT x,y
POINT( x,y )
POKE x,n
DPOKE x,n
LPOKE x,n
POLYLINE n,X(),Y() [ OFFSET x0,y0 ]
POLYFILL n,X(),Y() [ OFFSET x0,y0 ]
POLYMARK n,X(),Y() [ OFFSET x0,y0 ]
POS(n)
PRINT [ AT( col,row ) ][;][ expr[,][;][']]
?
PRINT #n [,expr [,][;][']
PRINT USING "format",list[;]
PRINT #n,USING "format",list[;]
PROCEDURE name[ ( var.list ) ]
PUT x0,y0,a$ [ ,writing_mode ]
PUT [#]n [,i]
QUIT
RANDOM(x)
RBOX x0,y0,x1,y1
READ var[,var, ... ]
RELSEEK [#]n,x
REM or '
REPEAT / UNTIL cond.expr
RESTORE [ label ]
RESUME
RESUME NEXT
RESUME label
RETURN
RIGHT$
RMDIR "path"
RND[ (x) ]
RSET a$=b$
RUN
SAVE "filename"
PSAVE "filename" ( auto execute after loading..)
SEEK [#]n,x
SETCOLOR i,r,g,b
SETCOLOR i,n
SETTIME timestring,datestring
SGN(x)
SIN(x)
SOUND voice,ampl,note,octave [,dur ]
SOUND voice,ampl, #period
SPACE$(x)
SPC(n)
SPOKE x,n ( Poke in Supervisor mode )
SDPOKE x,n
SLPOKE x,n
SPRITE A$ [,x,y ]
SQR(x)
STOP
STR$(x)
STRING$(n,string$)
STRING$(n,c)
SUB var,n
SWAP var1,var2
SYSTEM
TAB(n)
TAN(x)
TEXT x,y,[ justification length, ] string$
TIME$
TIMER
TITLEW n,"window title "
TRUNC(x)
UPPER$( string$ )
VAL( x$)
VAL?(X$)
VARPTR( var )
WAVE voice,env,form,dur,speed
WHILE cond.expr / WHEND
WRITE [ expr ][;]
WRITE #n [,expr ][;]
Let's have a more in-deep look at some GfA Basic commands, now.
Here, I will have a look at some commands that are very versatile
or useful, and that are not very common on other basic dialects.
The first command I will explain is a follows:
DEFFILL c,a,b or DEFFILL c,a$
This command determines fill patterns, or can even let you define
your own fill patterns! The value of c determines the color, so
you can just leave that away on monochrome (that way, the command
will have the format: DEFFILL ,a,b or DEFFILL a$). With the
variable a you can determine the fill style, ranging from 0 to 4.
These can have the following meanings:
0 empty fill
1 completely filled
2 points fill
3 striped fill
4 self defined fill
With b, you can choose the special fill types: 24 different fill
patterns for points fill and 12 different fill patterns for
striped fill.
You can use own fill patterns, by using the command MKI$ of GfA
Basic. This command changes values into bit patterns. As you might
know, each fill pattern is 16x16 bits, so you have to define 16
"words" (a word is 16 bits=2 bytes). A solid row of 16 set bits
would be 65535, so a solid horizontal line in a fill pattern would
be MKI$(65535) for example. To define a solid black fill patern,
the following program is enough:
For X=1 to 16
A$=A$+Mki$(65535)
Next X
You see, it opens a wide range of possibilities. Through this way,
you can also turn on software Sprites in GfA Basic. But we won't
cover sprites in this issue; therefore you'll have to wait some
time untill the next issue of ST NEWS arrives!
Another command that also allows own editing through the "A$-
principle", is DEFMOUSE, which has the following format:
DEFMOUSE x or DEFMOUSE a$
The value of x can vary between 0 and 7, which have the following
meanings:
0 Arrow
1 Stretched rounded X
2 Bee
3 Pointing hand
4 Open hand
5 Cross
6 Fat cross
7 Outlined cross
The action point is the point on which all mouse operations are
performed.
In the case of DEFMOUSE, A$ must exist of the following parts:
mki$(x coordinate of the action point)
mki$(y coordinate of the action point)
mki$(1)
mki$(mask color, most of the time this is 0)
mki$(cursor color, most of the time this is 1)
m$ (bit pattern of the mask)
c$ (bit pattern of the cursor)
The cursor is the part that is usually displayed on the screen,
but the mask of the mousepointer it displayed when it is pointed
on reverse colored background (black on normal monochrome video).
Another command I never heard of was DFREE x. This command gives
the available space on a disk drive (the x is the device number,
ranging from 0-15, but normally 1 or 2). Quite handy! When you
give 0 as a parameter, the active device is examined.
That's it for this time, folks! Next time I will explain the
following commands: Graphmode, Menu (also On Menu Gosub, etc.) and
Mouse, while I will be looking at Pause, Settime, Sprite and
Upper$ the issues after that (so that will be issue 6). We hope
you will find the information that we offer you very useful. We
encourage anyone who doesn't have GfA Basic to buy it immediately:
it's one of those programs that everybody should have! For
information, write to GfA Systemtechnik, Computer Division, Am
Hochofen 108, D-4000 Düsseldorf 11, West Germany. The program is
available for about 160-170 guilders, and is accompanied by a
thorough user manual, that explains all the commands very well. A
Dutch version of that manual, so I've heard, is being worked at at
this very moment!
Now, let' see about the GfA Basic specifications (about variable
organisation). Normal variables are 6 byte values, in which
exponents up to 154 are allowed. Integer variables use up 4 bytes
and can have a value between -214783648 and 2147483647. String
variables can have a maximal length of 32767 characters....
Disclaimer
The text of the articles is identical to the originals like they appeared
in old ST NEWS issues. Please take into consideration that the author(s)
was (were) a lot younger and less responsible back then. So bad jokes,
bad English, youthful arrogance, insults, bravura, over-crediting and
tastelessness should be taken with at least a grain of salt. Any contact
and/or payment information, as well as deadlines/release dates of any
kind should be regarded as outdated. Due to the fact that these pages are
not actually contained in an Atari executable here, references to scroll
texts, featured demo screens and hidden articles may also be irrelevant.