Date : Mon, 26 Apr 2004 18:19:47 +0100 (BST)
From : Pete Turnbull <pete@...>
Subject: Re: Analogue Port Fire Buttons
On Apr 26, 8:29, Joel D. Snape wrote:
>
> Can anybody out there help a 14 year old newcomer to the field? I
> would like to know how you check to see if the fire buttons are
> pressed on a Joystick connected to the Analogue port for a plotter
> program I am trying to write.
In BASIC, ADVAL(0) returns the state of the fire buttons and the ADC
channels. ADVAL(0) DIV 256 tells you which ADC channel last finished a
conversion. ADVAL(0) AND 3 gives the state of the buttons; bit 0 is
set (odd numbers) if the left fire button is pressed, and bit 1 is set
(result is 2 or 3) if the right-hand button is pressed.
In assembly language, OSBYTE &80 provides the equivalent of ADVAL. On
entry, if X=0 then it reads the buttons and channel status; on exit the
bottom two bits of X contain the button data and Y contains the channel
number (or zero if no channel has completed a conversion).
--
Pete Peter Turnbull
Network Manager
University of York