![Commodore Amiga A1000 Hardware Reference Manual Download Page 234](http://html1.mh-extra.com/html/commodore/amiga-a1000/amiga-a1000_hardware-reference-manual_2643377234.webp)
READING THE COUNTERS
The mouse/trackball counter contents can be accessed by reading register addresses
named JOY0DAT and JOY1DAT. These contains counts for ports 1 and 2 respectively.
The contents of each of these 16-bit registers are as follows:
Bits 15-8 Mouse/trackball vertical count
Bits 7-0 Mouse/trackball horizontal count
COUNTER LIMITATIONS
These counters will "wrap around" in either the positive or negative direction. If you wish
to use the mouse to control something that is happening on the screen, you must read the
counters at least once each vertical blanking period and save the previous contents of the
registers. Then you can subtract from the previous readings to determine direction of
movement and speed.
The mouse produces about 200 count pulses per inch of movement in either a horizontal
or vertical direction. Vertical blanking happens once each 1/60th of a second. If you read
the mouse once each vertical blanking period, you will most likely find a count difference
(from the previous count) of less than 127. Only if a user moves the mouse at a speed of
more than 38 inches per second will the counter values wrap. Fast-action games may
need to read the mouse register twice per frame to prevent counter overrun.
If you subtract the current count from the previous count, the absolute value of the
difference will represent the speed. The sign of the difference (positive or negative) lets
you determine which direction the mouse is travelling.
The easiest way to calculate mouse velocity is with 8-bit signed arithmetic. The new value
of a counter minus the previous value will represent the number of mouse counts since
the last check. The example shown in Table 8-2 presents an alternate method. It treats
both counts as unsigned values, ranging from 0 to 255. A count of 100 pulses is measured
in each case.
- Interface Hardware 225 -
Summary of Contents for Amiga A1000
Page 1: ...AMIGA HARDWARE REFERENCE MANUAL 1992 Commodore Business Machines Amiga 1200 PAL...
Page 20: ...Figure 1 1 Block Diagram for the Amiga Computer Family Introduction 11...
Page 21: ...12 Introduction...
Page 72: ...Figure 3 12 A dual Playfield display Playfield Hardware 63...
Page 87: ...Figure 3 24 Horizontal Scrolling 78 playfield hardware...
Page 101: ...92 Playfield Hardware...
Page 199: ...Figure 6 9 DMA time slot allocation 190 Blitter hardware...
Page 203: ...Figure 6 13 Blitter Block Diagram 194 Blitter Hardware...
Page 229: ...220 System Control Hardware...
Page 246: ...Figure 8 8 Chinon Timing diagram cont Interface Hardware 237...
Page 265: ...256 Interface Hardware...
Page 289: ...280 Appendix A...
Page 297: ...288 Appendix B...
Page 298: ...APPENDIX C CUSTOM CHIP PIN ALLOCATION LIST NOTE Means an active low signal Appendix C 289...
Page 302: ...APPENDIX D SYSTEM MEMORY MAP Appendix D 293...
Page 343: ...334 Appendix F...
Page 351: ...342 Appendix G...
Page 361: ...352 Appendix H...
Page 367: ...358 Appendix I...