Kempston mouse
ZXNet echo conference «code.zx»
From Kirill Frolov → To All 2 December 2001
Press RESET immediately, Konstantin!
30 Nov 01 20:46, Konstantin Lebedev wrote to All:
KL> Gentlemen lamer ;), teach me how to work with a subject (I want to
KL> in your player, and in general, support the rat in the withdrawal procedure
KL> this device). Everything is in soap.
2KL:
Why in soap? What I write here maybe someone else will read it.
And you can read what I write in the soap yourself in ZX-FORMAT.
ZX-Spectrum and mouse.
On the topic of connecting a mouse to the Spectrum
it was said on the pages of the magazine. These were
advertising articles from St. Petersburg
manufacturers and sellers of mouse inter-
faces. I won't argue with any of them
them, I just want to offer those who can
hold a soldering iron in your hands and assemble this
device yourself.
First you need to answer the question:
what exactly is Kempston Mouse Interface for?
After all, some craftsmen manage to solder
move the mouse to the Kempston joystick socket,
others use AY-mouse. Why Kempston?
Is Mouse Interface better?
First of all, it should be noted that any
torture of connecting the mouse to the socket
joysticks are a mockery
with the mouse. The mouse has one remarkable thing
quality - in addition to the direction of movement
it also reacts to the speed of this sa-
possible movement, so the cursor on the screen
does not move in proportion to the movement of theneck of the hand, i.e. when you move the mouse
slowly, the cursor moves also slowly,
when you move the mouse quickly, the cursor
moves quickly. Thanks to this we can work
a mouse is incomparably more convenient than a joystick
com.
The joystick is not able to react to
movement speed, it only takes into account
direction Therefore, in case of connection
mouse into the joystick socket, regardless of
depends on the speed at which you move
move the mouse, the cursor will move with
constant speed. And to move
cursor from one edge of the screen to the other
you may not have enough table space.
Apparently, this drawback is absent in
Option AY-mouse. But under AY-mouse it is adapted
There are not enough programs.
So why are we campaigning so hard?
you for Kempston Mouse Interface? Answer
banal: it's a matter of standardness. This
the device was invented quite a long time ago,
it is the same standard as
Kempston Joystick or Sinclair Joystick and
it is supported by proprietary programs, such
some like Art Studio or Artist
II. So why invent a bicycle and
produce a lot of your own standards, if you
it is better and more logical to use what is already
invented, especially since for this variation
ant there is already software support.
Largest distribution Kempston
Mouse Interface received in St. Petersburg, this and
understandable, because it was made in St. Petersburgits Russian analogue. Along with already named-
new Art Studio and Artist II branded
Kempston Mouse support was found in
Victory Road, Battle Command, Carrier
Command.
We quickly adapted to
Kempston Mouse Interface programs
F Commander v4.01, Instrument v2.01,
DCU 2.32, etc...
New programs began to be written taking into account
the fact of the birth of Kempston Mouse
Interface and mouse support are also available
meet in FUT v2.01, ZXWORD v2.5m,
ZxZip/ZxUnzip v1.02, Instrument v3.01,
FPM v3.5, and others.
Adapted for Kempston Mouse Interface
and games, for example:
Hero Quest, Dragon Spirit, Space Crusade,
A New Whole Ball Game, The A Team 1 & 2,
Operation Wolf, Operation Thunderbolt,
World Cup Challenge, Gunsmoke, R-Type,
Gemini Wing, 1943 The Battle Begin,
Zombie, Armageddon Man, etc...
New electronic magazine ZX-Format, which
you are reading from the very first issue
supports Kempston Mouse Interface.
Having felt the wishes of friends, Slava
Mednonogov inserted mouse support into his
the new game UFO II, and after trying to play
I dragged myself into it with the mouse immeasurably.
What I'm talking about seems clear. Coli-
The quality of mouse programs has steadily increased
It turns out that almost all new St. Petersburg
author's programs have mouse support
ki. Branded programs in which control
mouse control would also be logical to adaptare typed under Kempston Mouse Interface.
What other arguments are needed for this particular
device? It seems like there are enough arguments.
Just try to sit in the mouse once -
Noah Art Studio, after this you are unlikely to
drag you back. You'll be mad
looking at how the arrow crawls for so long
ka, controlled by a joystick or buttons.
While with the mouse everything is just fluttering...
et. And you will be amazed to realize how much
time you spent on simple movement
according to the menus.
So, almost all St. Petersburg programs
mists support the Kempston Mou standard -
se Interface. Therefore, we call on everyone
users to solder this device to themselves, and all
programmers - to support it,
so that users don’t have to do it too often
heat up the soldering iron when something appears
like Sinclair Joystick Mouse or say
ZX Lprint III Mouse... :-)
This concludes the introductory part -
Okay, let's go directly to the diagram.
The author of the scheme is Michael Kondraty-
ev, the circuit was developed after studying
drivers for Art Studio and Artist programs.
The original version contained 11 housings
owls, this was due to the fact that the author
used the most available microcircuits
from those that were at hand. In the future
the number of chips was reduced to
8'mi. For some time the scheme was commercial
a commercial product, the rights were not hers
transferred to Sergei Zonov. Last yearSergey Zonov allowed its distribution,
after which the Kempston Mouse Interface circuit
was published on the Fi-electronic network
doNet.
Most often as a manipulator
ordinary gray passive is used
mouse from Search. At the minimum price it
works quite well. Although those who wish
can also use branded passive
mice. In the complete absence of vision in the area
Most passive mice can be used
and active ones, however, they will have to be a little
Let's dig deeper (see notes to the diagram).
So, stock up on a pencil or a printer
rom and look carefully:
=========================================================
Kempston Mouse Interface Schematic:
DD1 DD5
5┌──┬──┬─┐ 6 2┌──┬──┬─┐18 D0║
┌────oCa│CT│0├────────┤D1│|>│1├─────╢
Xb ─┴─ 15├──┤ │ │11 4│ │ │ │16 D1║
──┬──────/C │ │1├────────┤D2│ │2├─────╢
Xa│ 10│ │ │ │14 6│ │ │ │14 D2║
───┬─────┤U/D │2├────────┤D3│ │3├─────╢
││ 9├──┤ │ │ 2 8│ │ │ │12 D3║
││ ┌───┤R │ │3├────────┤D4│ │4├─────╢
││ │ 1│ │ │ │ 11│ │ │ │ 9 D4║
││ ├───┤S │ │ │ ┌─────┤D5│ │5├─────╢
││─┴─ 4│ │ │ │ │ 13│ │ │ │ 7 D5║
││ ──┤0 │ │ │ │┌────┤D6│ │6├─────╢
││ 12│ │ │ │ ││ 15│ │ │ │ 5 D6║
││ ──┤1 │ │ │ ││┌───┤D7│ │7├─────╢
││ 13│ │ │ │ │││ 17│ │ │ │ 3 D7║
││ ──┤2 │ │ │ │││┌──┤D8│ │8├─────╢ ││ 3│ │ ├─┤ 7││││19├──┤ │ │ ║
││ ──┤3 │ │Co─┐││││┌─oE2│ │ │ ║
││ └──┴──┴─┘ ││││││1│ │ │ │ ║
││ ┌────────────┘││││├─oE1│ │ │ ║
││ │ DD2 │││││ └──┴──┴─┘ ║
││ │ 5┌──┬──┬─┐ 6│││││ /XCS ║
││ └──oCa│CT│0├──┘│││└──── ║
││ 15├──┤ │ │11 │││ ║
└──────/C │ │1├───┘││ ║
│ 10│ │ │ │14 ││ ║
└─────┤U/D │2├────┘│ ║
9├──┤ │ │ 2 │ ║
┌───┤R │ │3├─────┘ ║
│ 1│ │ │ │ ║
├───┤S │ │ │ ║
─┴─ 4│ │ │ │ ║
──┤0 │ │ │ ║
12│ │ │ │ ║
──┤1 │ │ │ ║
13│ │ │ │ ║
──┤2 │ │ │ ║
3│ │ ├─┤ 7 ║
──┤3 │ │Co── ║
└──┴──┴─┘ ║
║
DD3 DD6 ║
5┌──┬──┬─┐ 6 2┌──┬──┬─┐18 D0║
┌────oCa│CT│0├────────┤D1│|>│1├─────╢
Ya ─┴─ 15├──┤ │ │11 4│ │ │ │16 D1║
──┬──────/C │ │1├────────┤D2│ │2├─────╢
Yb│ 10│ │ │ │14 6│ │ │ │14 D2║
───┬─────┤U/D │2├────────┤D3│ │3├─────╢
││ 9├──┤ │ │ 2 8│ │ │ │12 D3║
││ ┌───┤R │ │3├────────┤D4│ │4├─────╢
││ │ 1│ │ │ │ 11│ │ │ │ 9 D4║
││ ├───┤S │ │ │ ┌─────┤D5│ │5├─────╢
││─┴─ 4│ │ │ │ │ 13│ │ │ │ 7 D5║
││ ──┤0 │ │ │ │┌────┤D6│ │6├─────╢
││ 12│ │ │ │ ││ 15│ │ │ │ 5 D6║
││ ──┤1 │ │ │ ││┌───┤D7│ │7├─────╢
││ 13│ │ │ │ │││ 17│ │ │ │ 3 D7║
││ ──┤2 │ │ │ │││┌──┤D8│ │8├─────╢
││ 3│ │ ├─┤ 7││││19├──┤ │ │ ║
││ ──┤3 │ │Co─┐││││┌─oE2│ │ │ ║
││ └──┴──┴─┘ ││││││1│ │ │ │ ║
││ ┌─────────────┘││││├─oE1│ │ │ ║
││ │ DD4 │││││ └──┴──┴─┘ ║
││ │ 5┌──┬──┬─┐ 6│││││ /YCS ║
││ └───oCa│CT│0├──┘│││└────── ║
││ 15├──┤ │ │11 │││ ║
└──────/C │ │1├───┘││ ╔══════════════╝
│ 10│ │ │ │14 ││ ║
└─────┤U/D │2├────┘│ ║
9├──┤ │ │ 2 │ ║
┌───┤R │ │3├─────┘ ║
│ 1│ │ │ │ ║
├───┤S │ │ │ ║
─┴─ 4│ │ │ │ ║
──┤0 │ │ │ ║
12│ │ │ │ ║
──┤1 │ │ │ ║
13│ │ │ │ ║
──┤2 │ │ │ ║
3│ │ ├─┤ 7 ║
──┤3 │ │Co── ║
└──┴──┴─┘ ║
╔════╝
DD7.2 ║ DD8
RIGHB 5┌─┬──┐6 D0║A10 1┌─┬──┬─┐15
─────────┤D│|>├─────╫─────┤1│DC│0o──
4│ │ │ ║A8 2│ │ │ │14
┌──oE│ │ ╟─────┤2│ │1o──
│ └─┴──┘ ║A7 3│ │ │ │13
│ DD7.3 ╟─────┤4│ │2o──
LEFTB │ 9┌─┬──┐8 D1║/RD 5├─┤ │ │12
─────────┤D│|>├─────╫─────o&│ │3o──
│10│ │ │ ║A0 6│ │ │ │11 /BCS
├──oE│ │ ╟─────┤ │ │4o───────
│ └─┴──┘ ║ 4│ │ │ │10
│ DD7.4 ║ ┌──oS│ │5o──
MIDLB │12┌─┬──┐11 D2║ │ │ │ │ │ 9 /XCS
─────────┤D│|>├─────╢ │ │ │ │6o───────
│13│ │ │ ║ │ │ │ │ │ 7 /YCS
├──oE│ │ ║ │ │ │ │7o───────
│ └─┴──┘ ║ │ └─┴──┴─┘
│ ║ └────────────┐
│ /BCS ║ DD7.1 │
└──────── ║/IORQ 2┌─┬──┐3 │
╟───────┤D│|>├──┘
DD1..DD4 - К561ИЕ11 ║A5 1│ │ │
DD5, DD6 - К555АП5 ╟───────oE│ │
DD7 - К155ЛП8 ║ └─┴──┘
DD8 - К555ИД7
(c) 1994 Michael Kondratyev
=========================================
Пpимечания:
- жиpной линией обозначена шина Spectrum;
- на мышь идут следующие сигналы: Xa, Xb,
Ya, Yb, RIGHTB, MIDLB, LEFTB, +5V, GND;
- /BCS, /XCS, /YCS - внутpенние сигналы
схемы, соединяются с одноименными паp-
ными на схеме;
- схема пpиведена для мыши пасивного типа
(мышь для "Поиска" ММП-9B), для дpугих
необходимо вывести сигналы Xa, Xb и
Ya, Yb, котоpые беpутся с оптопаp после
цепочки тpанзистоp-тpиггеp Шмидта;
- в компьютеpе тpебуется обеспечить бло-
киpовку поpта 0DFh;- it is possible to replace the decryption scheme
(DD7.1, DD8) on the type
556PT4(PT11), remaining free connection
move can be used for blocking
ports
=========================================================
If you have any suggestions/complaints, please
dew/ideas, then you can contact auto-
rom Michael Kondratyev's scheme:
2:5030/362.1@FidoNet
[...to be continued...to be...]
From Kirill Frolov → To All 2 December 2001
Press RESET immediately, Konstantin!
30 Nov 01 20:46, Konstantin Lebedev wrote to All:
[...continued...about...Kempston...mouse...]
So, now let’s explain how it works
use Kempston Mouse Interface program
mistu. Nothing difficult to understand
expected, since the interface is quite
simple and clear. There are three ports, here
their addresses: #FADF, #FBDF, #FFDF;
The width of each is 8 bits, i.e. byte.
#FADF - port of buttons with symbols in it
are the least significant three bits:
0 bit - state of the right button;
1 bit - left button state;
2 bits - state of the middle button.
When the buttons are not pressed, all bits are `1'.
When you press the button, the corresponding bit
is set to `0'.
According to ancient tradition, the left button is used
uses as a choice (Fire), the right one - as
Cancel. Middle button accepted
use for additional functions.
#FBDF - X-coordinate port;
#FFDF - Y-coordinate port.
As the mouse moves
the values in the ports change, and also
and cyclically, i.e. when #FF is reached and
further increase they become again
zero and grow further, again to #FF. When
moving in the other direction the picture is similar
gical, only changes occur in the environment
in the opposite direction. Present this case
This picture will help:
y^.
│.
│.
│2
│1
│012...
┼──────────>
x
Thus, it is necessary to read the signport values, and the difference between the current
and the previous value is determined by
Mouse movement control.
If very precise manipulation is necessary,
tion driver is written with this in mind, and
moving the arrow to one point produces
indicated when the value changes, read-
go from the port for 2, 3, 5, or more units.
Recently, smarter has become fashionable
driver, which at the beginning waits for a click on
button, and the first button pressed on the mouse
becomes (for the driver) left. This is from-
is carried only to the two outer buttons,
The middle button is also the middle button in Africa.
This is useful for people who are accustomed to holding
mouse in the left hand, or in case if
whether someone often stepped on your mouse and
one of her buttons works worse than
the rest. Such a driver is considered good
in a quiet tone. And if you noticed, that's exactly it
The ZX-Format driver arrives.
Check the operation of the newly assembled
interface can be done directly from Basic by doing
PRINT IN from ports:
64479 - X, 65503 - Y - when moving
mouse values should change cyclically
ki. When reading from port 64423 - Fire
the three lowest bits should click when
pressing buttons.
And finally - an example of the Kempston driver
Mouse used in ZX-Format:
;MOUSE DRIVER WITH FIRE BUTTON AUTOCONFIG
;(C) Andrey Rachkin'95
JR MDRV
DIRECTZ DEFB 0 ;FIRE
DEFB 0 ;UP
DEFB 0 ;DOWN
DEFB 0 ;RIGHT DEFB 0 ;LEFT
DEFB 0 ;CANCEL
MCOORD DEFW 0 ;LAST CURSOR COORDS
;IN PIXELZ
MPORTS DEFW 0 ;LAST READED MAUSY COORDS
NONDEF AND 3 ;HERE COMEZ BUTTONZ
;CONTROL IF FIRE BUTON
;NOT DEFINED
JR Z,MDRV4 ;IF NONE BUTTON
;PUSHED
CP 1
JR Z,NONDEF_
XOR A
LD (MDRV3+2),A
LD A,5
LD (MDRV2+2),A
NONDEF_ LD HL,0
LD (MDRV1),HL
POP IX
; ***** MAIN PROC OF MOUSEDRIVER *****
MDRV PUSH IX
LD HL,DIRECTZ
PUSH HL
POP IX
XOR A
LD (HL),A ;CLEARING
INC HL ;OF
LD (HL),A ;DIRECTZ
INC HL ;BUFER
LD (HL),A
INC HL
LD (HL),A
INC HL
LD (HL),A
INC HL
LD (HL),A
INC HL
LD BC,#FADF ;BUTTONZ CONTROL
IN A,(C) ;READING FROM PORT
;OF BUTTONS
CPL
MDRV1 JR NONDEF ;JR UNTIL FIRE
;BUTTON NOT DEFINED
RRA
MDRV2 RL (IX+0) ;FIRE
RRA
MDRV3 RL (IX+5) ;CANCEL
; ***** COORDS CONTROL *****
MDRV4 LD HL,(MCOORD) ;FORM LAST
;CURSOR COORDS
LD DE,(MPORTS) ;FROM LAST
;READED MOUSE
;COORDS
LD BC,#FBDF
IN A,(C) ;READING FROM
;PORT X-COORD (0-#FF)
LD (MPORTS),A
SUB E
JR Z,MDRV9
JP P,MDRV6
LD (IX+4),1 ;MOVE LEFT
ADD A,L
JR C,MDRV5
XOR A ;MIN X-COORD
MDRV5 LD L,A
JR MDRV9
MDRV6 ADD A,L
LD (IX+3),1 ;MOVE RIGHT
JR C,MDRV7
CP #FE ;MAX X-COORD
JR C,MDRV8
MDRV7 LD A,#FE ;MAX X-COORD
MDRV8 LD L,A
MDRV9 LD B,#FF
IN A,(C) ;READING FROM
;PORT Y-COORD (0-#FF)
LD (MPORTS+1),A
SUB D
JR Z,MDRV14
NEG
JP P,MDRV11
LD (IX+1),1 ;MOVE UP
ADD A,H
JR C,MDRV10
XOR A ;MIN Y-COORD
MDRV10 LD H,A
JR MDRV14
MDRV11 ADD A,H
LD (IX+2),1 ;MOVE DOWN
JR C,MDRV12
CP #BF ;MAX Y-COORD
JR C,MDRV13
MDRV12 LD A,#BF ;MAX Y-COORD
MDRV13 LD H,A
MDRV14 LD (MCOORD),HL ;NEW CURSOR
;POSITION
;IN PIXELZ
POP IX
RET
; ***** DRIVER END *****