EasyManua.ls Logo

Commodore Amiga A2000 - Page 242

Commodore Amiga A2000
380 pages
Print Icon
To Next Page IconTo Next Page
To Next Page IconTo Next Page
To Previous Page IconTo Previous Page
To Previous Page IconTo Previous Page
Loading...
READING THE LIGHT PEN REGISTERS
The light pen register is at the same address as the beam counters. The bits are as
follows:
VPOSR: Bit 15 Long frame/short frame. 0=short frame
Bits 14-1 Chip ID code. Do not depend on value!
Bit 0 V8 (most significant bit of vertical position)
VHPOSR: Bits 15-8 V7-V0 (vertical position)
Bits 7-0 H8-H1 (horizontal position)
The software can refer to this register set as a long word whose address is VPOSR.
The positional resolution of these registers is as follows:
Vertical
1 scan line in non-interlaced mode
2 scan lines in interlaced mode (However, if you know which interlaced frame is under
display, you can determine the correct position)
Horizontal
2 low-resolution pixels in either high- or low-resolution
The quality of the light pen will determine the amount of short-term jitter. For most
applications, you should average several readings together.
To enable the light pen input, write a 1 into bit 3 of BPLCON0. Once the light pen input is
enabled and the light pen issues a trigger signal, the value in VPOSR is frozen. If no
trigger is seen, the counters latch at the end of the display field. It is impossible to read
the current beam location while the VPOSR register is latched. This freeze is released at
the end of internal vertical blanking (vertical position 20). There is no single bit in the
system that indicates a light pen trigger. To determine if a trigger has occurred, use one
of these methods:
1. Read (long) VPOSR twice.
2. If both values are not the same, the light pen has not triggered since the last top-of-
screen (V = 20).
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.
- Interface Hardware 233 -

Table of Contents

Other manuals for Commodore Amiga A2000

Related product manuals