3.
If
both values are the same, mask off the upper
15
bits of the 32-bit word and
compare
it
with the hex value of $10500
(V
=261).
4.
If
the VPOSR value is greater than $10500, the light pen has not triggered since
the last top-of-screen.
If
the value is less, the light pen has triggered and the
value read is the screen position of the light pen.
A somewhat simplified method of determining the
truth
of the light pen value involves
instructing the system software
to
read the register only during the internal vertical
blanking period of 0
< V
20:
1. Read (long) VPOSR once, during the period of 0 < V
20.
2.
Mask off the upper
15
bits of the 32-bit word and compare it with the hex value
of $10500 (V
=261).
3.
If
the VPOSR value is greater than $10500, the light pen has not triggered since
the last top-of-screen. If the value is less, the light pen has triggered and the
value read
is
the screen position of the light pen.
Adapting
to
Special
Controllers
The
Amiga can read and interpret controllers other than the standard joystick or pro-
portional controller by using the control lines built into the
POTGO
register (address
DFF034)
to
redefine the functions of some of the controller port pins.
Table 8-5 is a copy of
part
of the
POTGO
register bit description, paraphrased from
appendix A of this manual.
POTGO
(DFF034)
is
the write-only address for the pot con-
trol register.
POTGOR
(DFF016) is the read-only address for the pot control register.
The
pot-control register controls a four-bit bidirectional
I/O
port
that
shares the same
four pins as the four
pot
inputs.
226
Interface Hardware