GFA BASIC TIPS & TRICKS by Richard Karsmakers
Finally, the first reaction came flowing in to my offer to help
people with problems they had when programming in GfA Basic (both
for the Stichting ST and our own reader's service). Thanks to
these people, I am now also able to offer you some more tips &
tricks (I also learn a lot from them). Let's start right away,
with some hints & tips that were supplied to me by Robert
Heessels of the Strike-a-Light group.
To make the screen black on a monochrome monitor, you should do
the following:
SETCOLOR 0,0
You can read the joysticks when you have TOS in ROM with the
following routine (last year, we published a way to achieve this,
which unfortunately only worked with TOS on DISK).
At the start of your program, you should type:
OUT 4,20
To actually read the joystick positions, you should use:
A=PEEK(3593)
128 = fire
8 = right
4 = left
2 = down
1 = up
The keyboard buffer can be emptied by:
WHILE INP?(2)
A=INP(2)
WEND
If you want to put a box on the screen with PBOX or PRBOX, but
without that annoying line around it, you can do this by typing
in the following:
DPOKE INTIN,0 (1=on, 0=off)
VDISYS 104
To set the right colors:
for use in: DEFFILL C, DEFTEXT C, COLOR C
C: SETCOLOR:
0 0
1 15
2 1
3 2
4 4
5 6
6 3
7 5
8 7
9 8
10 9
11 10
12 12
13 14
14 11
15 13
E.g.:
SETCOLOR 15,7,7,7
DEFFILL 1,,, will use 7,7,7 as the color!!!
You can give textwidth with the TEXT command:
TEXT X,Y,WIDE,"text"
From Mr. de Winter I learned that there was a bug in a program in
the GfA Nasic usermanual (version 2.0 extension) where the
BASEPAGE command is explained. It took quite some thinking to
find out what was wrong, but here is the bug-less example program
version, that reads the volume label of a disk (provided there is
one).
Void Gemdos(&H1A,Basepage+128)
P$="*.*"+Chr$(0)
Stat=Gemdos(&H4E,L:Varptr(P$),8)
D.name$=""
If Stat=0
I%=Basepage+158
While Peek(I%)
D.name$=D.name$+Chr$(Peek(I%))
Inc I%
Wend
Print D.name$
Endif
The '8' with Gemdos function $4E is used to specify a volume
label. If this value is changed other files (with other
attributes) are sought for, according to this table:
0 Normal file (read/write)
1 Normal file (read only)
2 Hidden file
4 System file (hidden also)
8 Volume label (disk name)
16 Subdirectory (folder)
32 Archive bit (written to and closed; harddisk only)
Please also refer to last issue's GfA Basic Tips & Tricks in
which Paul Kolenbrander had developed a routine to read the
directory of a disk.
The buffer from which the volume name is fetched, is built up as
follows:
0-20 Reserved for GEMDOS use
21 File attribute
22-23 Time of Day
24-25 Date
26-29 Size (lowbyte first, then highbyte)
30-43 Name and file extender (this explains the value of 158 as
used in the program, which is 128+30)
If a file not found error occurs, Stat is given the value -33.
Mr. P. van Mertsch further found a failsafe way to make sure that
you return at a specified part of the listing after the program
is run. This is simply done by defining a block (with Block Start
and Block End); the program returns there after execution.
Next time, I hope to offer more GfA Basic tips & tricks!
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.