Alive
News Team Current issue History Online Support Download Forum @Pouet

01 - 02 - SE - 03 - 04 - 05 - 06 - 07 - 08 - 09 - 10 - 11 - 12 - 13 - 14

Alive 11
'                   _____________     __________________________
'                 _\____  ;\    |____\   ;|    \   ;|______  ;/\
'=============== |    ,    |    \   ;|____|    |    |    /____| \ ==============
'                |_________|_________|____|_________/_________|\|
'                \         \         \    \         \         \ |
'                 \_al!ve___\_________\____\_________\_____ltk_\|
'
'=================[m]   [a]   [g]   [a]   [z]   [i]   [n]   [e] ===============
'
'        GFA BASIC function to read the jagpad on computers with STE 
'        joystick ports by Simon Sunnyboy / Paradize.

FUNCTION jagpad_a

 LOCAL vec%,pad%

 '

 '  returns the state of Jagpad A as a vector

 ' Bits 0-3  standard joystick directions (compatible with IKBD)

 ' Bit 4  Options button

 ' Bit 5  Button C

 ' Bit 6  Button B

 ' Bit 7  Button A

 ' directions

vec%=0

 SDPOKE &HFF9202,&HFFFE

pad%=NOT (DPEEK(&HFF9202) AND &HF00)

 IF pad%AND 2048          ! right

   vec%=vec% OR 8

 ENDIF

 IF pad%AND 1024          ! left

   vec%=vec%OR 4

 ENDIF

 IF pad%AND 512           ! down

   vec%=vec% OR 2

 ENDIF

 IF pad% AND 256           ! up

   vec%=vec%OR 1

 ENDIF

 '
 SDPOKE &HFF9202,&HFFFE

pad%=NOT (DPEEK(&HFF9200) AND &HF)

 IF pad%AND 2

   vec%=vec%OR 128           ! button A

 ENDIF

 SDPOKE &HFF9202,&HFFFD

pad%=NOT (DPEEK(&HFF9200) AND &HF)

 IF pad%AND 2

   vec%=vec%OR 64           ! button B

 ENDIF

 SDPOKE &HFF9202,&HFFFB

 pad%=NOT (DPEEK(&HFF9200) AND &HF)

 IF pad%AND 2

   vec%=vec%OR 32           ! button C

 ENDIF

 '

 SDPOKE &HFF9202,&HFFF7

pad%=NOT (DPEEK(&HFF9200) AND &HF)

 IF pad%AND 2

   vec%=vec%OR 16           ! Options

 ENDIF

 '

 RETURN vec%

ENDFUNC

Alive 11