At last... a big welcome back to my GFA Basic page - by popular demand!... Well a couple of people e-mailed me to ask where it had gone, and that's good enough for me!
I only got rid of it because I didn't seem to be getting any response from it. I thought no-one else was using DOS GFA Basic because they had switched to the Windows version or some other language through lack of support. But, when I zapped it, people complained. Anyway it's here again so what am I going to put on here?
Well, before that, who am I and what do I know about GFA Basic anyway? Well let's start with a potted history...
With it, Andy and I wrote a range of commercially available programs for the ST under the name of AB Software, including AB Animator, Picstrip, Mastermat, and a range of educational titles featuring a character called 'Uncle Oscar' - Add With Oscar, Spell With Oscar and Oscar's Paintbox being the most popular. ST owners from back then with good memories may remember that I re-wrote AB Animator and it appeared as 'Animaster' on the coverdisk of ST Format - a magazine in which I was for a long time the 'resident' GFA Basic agony aunt.
The first thing we noticed when we ran into problems writing these programs was that GFA support was a little thin on the ground, so we decided to create some for the few users out there at that time. We decided on a monthly magazine, and that's how GFA User Magazine was born. Without a UK distributor, initially we were handling readers problems by dealing directly with GFA in Germany and with a thousand subscribers, it lasted some four years until I found myself with not enough time on my hands to be the editor and hold down a job at the same time, so sadly it was wound down. I'm sure that anyone who subscribed to it found the information it contained, well worth the subscription fee and despite taking up every waking moment I had, it was an enjoyable experience...
During the life of the magazine, we saw the first UK publisher of GFA Basic - Glentop - appear and later relinquish control to Les Player, formally one of the top men at Atari, when GFA UK was formed and our close links with both, resulted in us writing the English versions of a number of GFA product manuals for the ST. I'm also proud to say that had I not plucked the German version of GFA Raytrace out of the bin during a visit to Glentop, GFA's second biggest selling ST product here in the UK would not even have been released!
Also while we were working on the magazine, versions 2 and 3 of the ST interpreter were released, as were the Amiga and eventually the MSDOS PC version, (the Windows version followed later). The Amiga version died a death I guess because of a mixture of piracy and the fact that the machine itself was crap for anything other than games, (yes, I did actually own one).
We tried in the magazine to cover all platforms, but after a bit of 'reader debate' we junked the Amiga and integrated the PC support with the ST. To maintain the support, Andy decided to concentrate on the Windows PC version, while I stuck to the MSDOS version - something we have kept to, long since GFA User Magazine disappeared.
So, maybe I'm partly responsible for some of you GFA programmers out there having heard of GFA here in the UK at least - especially old ST users moving up to PC's and wanting to continue GFA progging. I suppose had Andy and I not bothered with GFA User, then the PC version may not have happened here in the UK and GFA may never have been heard of. There again, maybe not...
Finally, before I start, can I make it quite clear that I ONLY use the MSDOS version of GFA Basic. I have NEVER used the Windows version, so please, please, please don't e-mail me with your Windows problems - I can't help! The DOS version however, is different.
As it is a programming aid, SPRITED is a compiled .EXE file, so you don't get the source code to it. You do however, get to use it and report back on bugs and suggest new features for it. And... if you write a game with it like 'Apples' below, send it to me and I'll put it on here for others to download. Maybe we can build up a little collection...
Download SPRITED.EXE (55K ZIP) - The GFA DOS Sprite Editor
Apart from being a vehicle for the sprites created by SPRITED, it also has another feature which may be of interest to GFA DOS programmers - 'inline sprites'. Well that's what I call them anyway!
Download APPLES.EXE (41K ZIP) - DOS Game With Example Sprites
Download SPR2DATA.EXE (ZIP) - Sprite To GFA Code Converter
GFA gives you the PAUSE and DELAY commands, but these tend to slow down your program too much. For example, DELAY(1) is a one second delay - much too long for say animation loops and values less than one aren't too successful. An alternative is to use a FOR...NEXT loop in your program, but if it's an empty loop, when you compile it the compiler will completely remove it in the name of optimization! What you need is the following routine which uses the PC's timer routine to give you precise timing control down to millisecond precision.
PROCEDURE wait(v%)
With this procedure in your program, delays can be reated by simply entering @wait(value) where value is the number of milliseconds delay you want. In the program APPLES, the initial delay variable 'speed%' is set to 200. This value is steadily reduced as apples are eaten - the effect being to speed up the catterpillar.
t%=TIMER
RETURN
REPEAT
UNTIL TIMER-t%>=v%
Try entering in the following routine (leave the // on the third line for now):
SCREEN 18
You should have got a pretty spirally dot pattern. If you did, take out the // rem from the a$=INKEY$ line and run it again.
FOR n%=1 TO 4000
// a$=INKEY$
NEXT n%
PLOT SIN(d)*d+_X/2,COS(d)*d+_Y/2
ADD d,.1
On some machines, the dot pattern is produced at a drastically reduced speed - speeding up if you hit a key. If this happens on your PC then the work-around below, which emulates the INKEY$ command using DOS interrupt calls, may be of help. Use it instead of INKEY$ and bingo, the flashing graphics disappear.
PROCEDURE scankeys
What the above routine does is call the keyboard interrupt $16 subfunction 1, (non-wait keyboard poll), and then checks the zero bit of the flag register. If this is set to 0 then a key has been pressed, otherwise it will be 1. As soon as a 0 is detected, the ASCII code is dumped into i% from return register _AH and the IO buffer is cleared. The variable i%, (or whatever you use) contains the same value as if you had done:
~INTR($16,_AH=$1)
RETURN
IF MID$(BIN$(_FL),8,1)="0"
i%=_AH
ENDIF
~INTR($21,_AH=$c,_AL=0) // clear buffer
a$=INKEY$
Well that's it for now. Please e-mail me if you have any specific problems or requirements for routines. I'll add to these as and when I can and continue to update the programming tools as often as I can.
IF LEN(a$)=2
i%=ASC(RIGHT$(a$,1)
ENDIF