This mouse was produded around 1986 by:
Softpoint Electronic, GmbHSoftware issues
CRU map
Mouse driver
Text mode
The hardware consists in a small 6-chip adapter board that is plugged in the side port of the console, in between the console and the PE-Box cable connector. This design serves two functions: first the board can draw its power supply from the side port. Second, it can access the LOAD* line to issue non-maskable interrupts when the mouse is moved. An easily accessible switch allows the user to open this connection and to prevent interrupt from being sent when the mouse driver is not installed.
In addition, the board has a 9-wire connection cable to the joystick port. This enables the software to read the status of the two mouse buttons, and of the two motion detectors (left/right and up/down). The circuitery on board provides an extra signal that the software can use to determine whether the latest detected motion (that triggered the interrupt) was vertical or horizontal. These signals can be accessed by reading keyboard column 7, i.e. joystick 2.
Reading keyboard column 6 (joystick 1) temporarily prevents the emission of LOAD* interrupts. This avoids the re-entrancy problems due to two interrupts issued too close from each other (see my page on interrupts for more details). It also resets the vertical/horizontal flip-flop.
The mouse itself is a "no name" device made in Taiwan. It has a long cable with a 9-hole plug at the end, just like the joystick port. A corresponding male socket is provided on the adapter board.
74LS121 74LS74 M3 74LS123 |
A rising edge on mouse connections M3 (vertical motion) and M1 (horizontal motion) triggers a short pulse in their respective half of the 74LS123 one-shot. The two Q* outputs are combined via an AND gate so that, if at least one pulse is occuring, the LOAD* line will be low. The second AND gate is used to mask out this signal: when joystick 1 is accessed, it triggers a longer pulse on the 74LS121 one-shot. The resulting low signal on the Q* output prevents the LOAD* line from going low, no matter what happened to the mouse.
Accessing joystick 2 enables the 74LS373 tri-state buffer and allows
for reading the four mouse signals through the joystick return lines.
The
fifth line is connected to the Q output of a 74LS74 flip-flop: it is
used
to determine whether a vertical motion was detected or not. A rising
edge
on M3 brings the Q output high, it can only be reset by accessing
joystick
1.
The mouse came with a companion disk containing completely useless demo software and very meager explanations on how to write a mouse driver. I had to experiment quite a bit in order to figure out how to access the mouse!
R12 address | Bit | Meaning |
---|---|---|
>0006 | 3 | Left button. 0: down 1: up |
>0008 | 4 | Right button. 0: down 1: up |
>000A | 5 | Vertical motion. 0: down 1:up |
>000C | 6 | Motion detector. 0: horizontal 1: vertical |
>000E | 7 | Horizontal motion. 0: right 1: left |
>0024 >0026 >0028 |
18 19 20 |
1 1 1: read mouse values in bits 3-7 0 1 1: temporarily disable LOAD* interrupts and reset bit 6. |
The software must hook the non-maskable interrupt vector at >FFFC-FFFF to trap any interrupt generated by the mouse. The interrupt service routine can then read CRU bits 4-6 to determine what kind of motion caused the interrupt and update the vertical and horizontal position buffers.
The value of these counters can then be used by the program to display a mouse cursor on screen. A good way to do this is to hook the VDP interrupts that occur 60 times per second (50 in Europe) and update the position of a sprite according to the moves of the mouse.
*====================================================================== |
Things are more complicated in text mode, as no sprite can be displayed. We must therefore superimpose the mouse cursor to the pattern of the characters it overlaps. This implies to
*===================================================================== * This routine reads a 2x2 character box at the cursor position * This routine displays the cursor pattern on screen * This routine erases the cursor displayed by the above SCPOS DATA 0 current screen address of the cursor SPCH BYTE 26,28,27,29 characters that make up the cursor |