[vcf-midatlantic] GW-BASIC joystick programming

Glenn Roberts glenn.f.roberts at gmail.com
Sun Feb 18 13:47:54 EST 2018


Is this it?

STICK Function

Purpose:
To return the x and y coordinates of two joysticks.

Syntax:
	x=STICK(n)

Comments:
x is a numeric variable for storing the result.
n is a valid numeric expression within the range of 0 to 3.

Value of n 	Coordinate Returned
0 		x coordinate of joystick A. Stores the x and y values for both joysticks for the
		Following three function calls.
1 		y coordinate of joystick A.
2 		x coordinate of joystick B.
3 		y coordinate of joystick B.

> -----Original Message-----
> From: vcf-midatlantic [mailto:vcf-midatlantic-
> bounces at lists.vintagecomputerfederation.org] On Behalf Of Evan Koblentz
> via vcf-midatlantic
> Sent: Sunday, February 18, 2018 1:45 PM
> To: vcf-midatlantic <vcf-midatlantic at lists.vintagecomputerfederation.org>
> Cc: Evan Koblentz <evan at vcfed.org>
> Subject: [vcf-midatlantic] GW-BASIC joystick programming
> 
> How do I program joystick input in GW-BASIC?
> 
> It's insanely easy in Applesoft: you use the PDL(0) and PDL(1) commands to
> determine where the stick is located along X/Y (0-255 on each scale) and then
> tell it what do based on those locations.
> 
> For example, in Applesoft, my Lego robot navigation code looks like this:
> 
> 3000 REM NEVIGATION
> 3010 FB=PDL (1):LR=PDL (0)
> 3020 IF FB < 75 THEN M=5
> 3030 IF FB > 180 THEN M=10
> 3040 IF LR < 75 THEN M=9
> 3050 IF LR > 180 THEN M=6
> 3060 POKE L,M: REM SEND COMMANDS
> 
> (The variable L is the address of the interface card to the control box.
> The variable M gets translated into binary to turn the relevant bits on/off at
> the control box, which runs the motors, sensors, and lights.)
> 
> How do I do this in GW?




More information about the vcf-midatlantic mailing list