Skip to main content
? Deekay

 "Saving is a very fine thing.  Especially when your parents have
done it for you."
                                                Winston Churchill


                YOUR SECOND GFA BASIC 3.XX MANUAL
                             - or -
        HOW I LEARNED TO STOP WORRYING AND LOVE GFA-BASIC
                             PART 16
                   CHAPTER FIFTEEN - JOYSTICK
                          by Han Kempen

STRIG and STICK

 Here  is  an  example  of the use of STRIG  and  STICK  if  your
joystick is connected to Port 1 (your mouse is connected to  Port
0):

     STICK 1                  ! joystick-mode (mouse is now dead)
     REPEAT
       IF STRIG(1)
         joy&=3               ! fire
       ELSE
         joy&=STICK(1)        ! joystick movement (0 = not moved)
       ENDIF
       ON joy& GOSUB n,s,fire,w,nw,sw,dummy,e,ne,se
       PAUSE 5
       (...)
     UNTIL condition!
     STICK 0                  ! back to mouse-mode

 You need eight Procedures for the eight possible directions (see
below) and one Procedure for the fire-button.  By the way, if you
press  the  fire-button,  MOUSEK will return  '2'.  The  value  7
('dummy')  never occurs.  If you don't touch  the  joystick,  the
value  of  joy& will be 0,  and this means no Procedure  will  be
called.  A short pause (PAUSE 5) is advisable,  because GFA-Basic
is too fast.

                  NW  N  NE 
                    5 1 9
                     \|/
Directions:      W  4-0-8  E       In other words: North = bit 0
                     /|\                           South = bit 1
                    6 2 10                         West  = bit 2
                  SW  S  SE                        East  = bit 3

 If  you  desperately  need  an  active  mouse  while  using  the
joystick,  you could try the following 'dirty' method which  uses
XBIOS 34 (Kbdvbase) to find the joystick-data:

     joy.adr%=ADD(XBIOS(34),61)
     REPEAT
       IF BTST(BYTE{SUB(joy.adr%,11)},0)
         joy&=3                            ! fire
       ELSE
         joy&=BYTE{joy.adr%}               ! stick; 0 = no moves
       ENDIF
       ON joy& GOSUB n,s,fire,w,nw,sw,dummy,e,ne,se
       PAUSE 5
       (...)
     UNTIL condition!

                     Functions (CHAPTER.15)

Joystick                                                 JOYSTICK
Returns status of joystick (usually Port 1):
     STICK 1                  ! joystick-mode (mouse is now dead)
     REPEAT
       ON @joystick(1) GOSUB n,s,fire,w,nw,sw,dummy,e,ne,se
       PAUSE 5
       (...)
     UNTIL condition!
     STICK 0                  ! back to mouse-mode

Joystick_1                                               JOYSTCK1
 Illegal  method  to  get joystick-status while  mouse  is  still
active:
     REPEAT
       ON @joystick_1 GOSUB n,s,fire,w,nw,sw,dummy,e,ne,se
       PAUSE 5
       (...)
     UNTIL condition! 

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.