<< Home | About Forth | About TurboForth | Download | Language Reference | Resources | Tutorials | YouTube >>


JOYST Search:

In Console I/O Words in TurboForth Kernal

Word Name: JOYST
Type: Standard word
Data Stack Signature: unit# -- value
Return Stack Signature: --
Availability: V1.0  V1.1  V1.2
Description:

Scans the selected joystick.

Example:

none

Comment:

For joystick #1 use a unit# of 0. For joystick 2 use a unit# of 1.

The returned value value is a bit code which can be decoded as follows:

  • 1=Fire
  • 2=Left
  • 4=Right
  • 8=Down
  • 16=Up

Since each direction has its own bit, combinations are possible: for example, UP+LEFT+FIRE returns a value of 19.

Note: The version of JOYST shipped in version 1.0 returns different values for up, down, left, right & fire.

Note: The version of JOYST shipped in version 1.1 has a bug which can return un-predictable results or cause TurboForth to crash in some circumstances. An alternative version of JOYST can be installed in a block and used when required, as presented below:

HEX CODE: JOYST C054 0221 0006 06C1 020C 0024 30C1 020C 0006 3541 06C1 0541 0241 001F C501 020C 8328 C80C 83D6 0300 0002 0300 0000 ;CODE DECIMAL

See Also: KEY  KEY? 

<< Home | About Forth | About TurboForth | Download | Language Reference | Resources | Tutorials | YouTube >>