[img] BBC Mice and Mouse Drivers
MDFS::Info.Comp.BBC.Mouse (L) link to LIST BASIC files   Search

Mice
suitable for BBCs [61K]A quadrature mouse (such as an Archimedes mouse) can be plugged into the BBC user port. It should be wired up as shown below. You can simply put a 20pin IDE head on the end of the mouse cable, but it is useful to put a 9-pin D socket (female, no pins) on mice using the standard Amiga pinouts, or Master Compact pinouts. I prefer to use Amiga pinouts as mice are easier to come by already wired up with an Amiga plug on the end. Note that Atari mice have exactly the same pinout as the Amiga mouse, except that pins 1 and 4 are swapped with each other. Some mice come with a switch to do this.
                    BBC/   Compact/
                    AMX    Marconi
 +5v  1 | 2   CB1 - Xaxis  Xaxis              / |                    / |                    / |
      3 | 4   CB2 - Yaxis  Yaxis             / 1| Xdir              / 1| Yaxis             / 1| Xdir
  0v  5 | 6   D0  - Xdir   Left        Left |6  |             Left |6  |             Left |6  |
      7 | 8   D1           Middle           |  2| Right            |  2| Xaxis            |  2| Xaxis
      9 | 10  D2  - Ydir   Right        +5v |7  |              +5v |7  |              +5v |7  |
     11 | 12  D3           Xdir             |  3| Middle           |  3| Ydir             |  3| Ydir
     13 | 14  D4           Ydir          0v |8  |               0v |8  |               0v |8  |
     15 | 16  D5  - Left                    |  4| Ydir             |  4| Xdir             |  4| Yaxis
     17 | 18  D6  - Middle            Yaxis |9  |            Right |9  |            Right |9  |
     19 | 20  D7  - Right                    \ 5| Xaxis             \ 5| Middle            \ 5| Middle
    USER PORT                                 \ |                    \ |                    \ |
                                            COMPACT                 AMIGA                  ATARI
                                          MOUSE PORT              MOUSE PORT             MOUSE PORT
Mouse
adapter leads [57K]A short adapter with a 20-pin IDC header and a 9-pin D plug (male, pins) makes the user port accessible for plugging in the mouse and lets mice be interchangeable between Compacts and non-Compacts.

Mouse Driver

Mouse.zip contains a *MOUSE command which provides a mouse driver, and a relocatable sideways ROM that provides a *MOUSE command.

DFS224+Mse and DFS229+Mse are DFS ROM images for the Master and Master Compact that include a mouse driver in the spare ROM space using ROMMouse.src (L).

Once the mouse driver has been turned on with *MOUSE ON, then the mouse position and button state can be read using OSBYTE or OSWORD. The OSBYTE routines are accessible using the INKEY and ADVAL calls.

ADVAL(7) OSBYTE &80,&07,&00 Mouse X position
ADVAL(8) OSBYTE &80,&08,&00 Mouse Y position
ADVAL(9) OSBYTE &80,&09,&00 Mouse buttons %rml, set if pressed
INKEY-10 OSBYTE &81,&F6,&FF Mouse left button
INKEY-11 OSBYTE &81,&F5,&FF Mouse middle button
INKEY-12 OSBYTE &81,&F4,&FF Mouse right button

The mouse driver also responds to the AMX OSWORD 64 call. On exit:

XY+0, XY+1Mouse X position
XY+2, XY+3Mouse Y position
XY+4 Text X position
XY+5 Text Y position
XY+6 Mouse buttons %rmlxxxxx, clear if button pressed

MouseTest (L) is a short BASIC program that tests the mouse calls and displays their return values.
mousepins: some notes.


Best viewed with Any Browser Valid HTML 4.0! Authored by J.G.Harston
Last update: 09-Jan-2006