I read somewhere that it's possible to connect an Amiga mouse directly
to a Kempston (joystick) interface.
So does it send signals on the "up","down","left","right"-lines when
the mouse is moved?
Does it send a continuous signal or a block-wave?
Now that I'm mentioning this, what is the most supported mouse
interface for the Spectrum?
Is there any 'widely'-supported mouse-interface that uses a serial
mouse?
And does anyone know if there is any diagram to convert signals from a
serial mouse to up/down/left/right signals like an Amiga mouse?
Greets,
Ben
>Hi,
>
>I read somewhere that it's possible to connect an Amiga mouse directly
>to a Kempston (joystick) interface.
>So does it send signals on the "up","down","left","right"-lines when
>the mouse is moved?
>Does it send a continuous signal or a block-wave?
>
Erm... now I am extremely rusty on my memory with this, but doesn't the mouse
work by the computer checking what signal is coming from the IN 31 command? Same
as the kempston joystick?
I know I'm probably wrong, but it has been over 15 years since I've even used
one!
--
**************The Starglider*************** Public E-Mail.
* http://www.starglider.dynu.com/radio * Ask for private
* Starglider Radio - listen and enjoy! * address.
* E-Mail:the_starg...@wibble.co.uk * _WW_
* CHANGE WIBBLE TO YAHOO TO REPLY * /_ _\
******************************************* | O O |
_____________________________________________________oOO_\/_OOo_____
>Hi,
>
>I read somewhere that it's possible to connect an Amiga mouse directly
>to a Kempston (joystick) interface.
>So does it send signals on the "up","down","left","right"-lines when
>the mouse is moved?
>Does it send a continuous signal or a block-wave?
It uses quadrature-encoded bit patterns when the mouse is moved; two
bits for the X axis, two bits for Y axis. And a bit for each of the
buttons.
There's a detailed description at
http://www.amigarealm.com/computing/knowledge/hardref/ch8.htm and also,
if you're interested in code, vbSpec emulates this mouse (look in the
inb() function in modSpectrum.bas, and the InitAmigaMouseTables()
function in modMain.bas).
I also have a vague recollection that Alvin's Sprite Pack for z88dk
supports various mouses and might have some z80 driver code in it for
you to look at.
--
Chris Cowley
--
Alex Taylor
> And does anyone know if there is any diagram to convert signals from a
> serial mouse to up/down/left/right signals like an Amiga mouse?
I'm sure there must be some kind of adapter around to allow the use of
USB or PS/2 mice with the Amiga. That's probably a question for an Amiga
newsgroup though, or you could check out the websites of places like
Eyetech or Power Computing.
--
Alex Taylor
The FAQ (Reference | Hardware Ports) would disagree with you. I make no
guarantees about its accuracy.
Cheers,
Phil
--
Philip Kendall <pa...@srcf.ucam.org>
http://www.srcf.ucam.org/~pak21/
Since a couple of people in this thread seem to be a bit confused:
Amiga mouse plugged into Kempston Joystick interface != Kempston Mouse
Yep. One thing I would say about the "Amiga mouse into Kempston joyport"
solution is that you need a fairly fast, tight loop to read the mouse
input in order to make it usable. For example, an interrupt routine that
reads the port is no good because the fastest speed that the mouse
pointer will then move would be 25 pixels/second (it takes two
successive reads of the port to determine which direction the mouse is
moving in) or just over 10 seconds to move from one side of the screen
to the other.
The kempston mouse interface is a lot nicer (and easier to use) because
it doesn't rely on the Speccy to decode the pulses from the mouse -- you
just get an X and a Y value so you only need to read the port as
frequently as you want to refresh the mouse pointer sprite. But it's
probably a lot harder to get hold of a Kempston Mouse interface than an
Amiga mouse!
--
Chris Cowley
>In article <mnp9g05m0hb8ud997...@4ax.com>,
>The Starglider <the_starg...@wibble.co.uk> wrote:
>>
>>Erm... now I am extremely rusty on my memory with this, but doesn't the mouse
>>work by the computer checking what signal is coming from the IN 31 command?
>
>The FAQ (Reference | Hardware Ports) would disagree with you. I make no
>guarantees about its accuracy.
>
Yeah, I am rusty. I do know that an IN port is required. The joystick is 31, the
mouse may be totally different.
> > And does anyone know if there is any diagram to convert signals from a
> > serial mouse to up/down/left/right signals like an Amiga mouse?
>
> I'm sure there must be some kind of adapter around to allow the use of
> USB or PS/2 mice with the Amiga.
There are certainly adapters for serial mice, but I can't remember
off-hand whether they then plug into the Amiga serial port or the
mouse port. You can also get PS/2 => Serial adapters.
...and after some research, Eyetech (http://www.eyetech.co.uk) sell
"EZMouse" that is a PS/2 => Amiga adapter.
Chris
--
+-------------------------------------------+
| Unsatisfactory Software - "because it is" |
| http://www.unsatisfactorysoftware.co.uk |
| Your Sinclair: A Celebration |
+- http://www.yoursinclair.co.uk -----------+
DISCLAIMER: I may be making all this stuff up again.
I myself tried the "amiga mouse in a kempston interface" trick many years
ago, mainly cos I was bored and had the two pieces of gear lying around. I
was about to measure full screen movement (in 2 pixel increments) by using
almost 50% (!) of the available CPU time in an IM2 routine.
It was quite shite really, but good for a half-hour fart about :)
Marko
I tried to read from port 31 on RealSpectrum with Kempston mouse
support enabled, but no change in bits on that port...
I will try vbSpec!
Also, I found a nice schematic with only one (!) part (a PIC
controller) to use an ordinary PS/2 mouse on an Amiga, so this should
also work on a Kempston interface. I'm a bit curious though that this
diagram doesn't include any clock circuitry...
Ben
>> ... vbSpec emulates this mouse (look in the
>> inb() function in modSpectrum.bas, and the InitAmigaMouseTables()
>> function in modMain.bas).
>
>I tried to read from port 31 on RealSpectrum with Kempston mouse
>support enabled, but no change in bits on that port...
>I will try vbSpec!
I'm guessing, but this is probably because the Kempston Mouse support in
RealSpectrum is an emulation of the Kempston *Mouse* Interface rather
than an Amiga Mouse in a Kempston *Joystick* Interface. As Matt said,
the two are completely different. You'll want to read ports 65503 and
64479 for the former, and port 31 for the latter.
vbSpec emulates both types. The Kempston Mouse Interface is far superior
if there is a choice in the program you want to use. There's a fair bit
of Russian and eastern European software out there that uses the Amiga
Mouse option though.
There's also an AMX mouse interface but I don't know anything about
that.
--
Chris Cowley
If you download sprite pack from
http://www.geocities.com/aralbrec/spritepack/splib2.zip
you will find z80 assembly to read the Kempston Mouse
in the file "input/SPMouseKempston.asm"
You will find code to read the AMX Mouse in
"input/SPMouseAMX.asm" with initialize code
in "input/SPMouseAMXInit.asm". I'll repeat
some of the documentation for the AMX mouse
here as I don't know if it appears in the
version downloadable from the site above:
; References:
; 1. http://www.breezer.demon.co.uk/spec/tech/hware.html
; Has an excerpt of the Z80 Emulator's documentation on the AMX Mouse.
; Information is incorrect about mouse buttons. Used the Spectaculator
; emulator as reference for button behaviour.
; 2. "Z80 Data Book," Mostek Microcomputer Corporation, August 1978.
; Technical documentation of the Z80 PIO Chip.
; AMX Mouse
;
; The AMX mouse is interfaced to the Spectrum using a Z80 PIO chip
; configured in input mode. Port A of the chip is associated
; with X movement and port B is associated with Y movement. The
; mouse interface will generate an interrupt on port A or port B
; each time it is moved a distance of "one mickey" in the X or
; Y direction respectively. It is the program's job to field
; these interrupts and update internal state representing the
; mouse's absolute position. Once an interrupt has occurred,
; reading the data port (A or B) will return 0 (positive) or
; 1 (negative) to indicate movement direction.
;
; Needless to say you must have interrupt mode 2 enabled to
; catch AMX mouse interrupts.
;
; Port Addresses:
;
; (Mapped to PIO chip)
; $1f Data Port A
; $3f Data Port B
; $5f Control Port A
; $7f Control Port B
;
; (Separate from PIO chip)
; $df State of three mouse buttons: bit 7 = left, bit 6 = right active,
; bit 5 = middle, active low. The mouse buttons are either or both
; not debounced or open collector. The former adds random transitions
; around a mouse press / depress and the latter adds random transitions
; when the mouse is left unpressed, caused by ULA attribute bytes on
; a floating bus. You must take this into consideration when getting
; a reliable read of the mouse buttons' state.
;
; Note that the AMX Mouse interface conflicts with the Kempston
; joystick interface ($1f), the Disciple disk interface ($1f) and
; the Multiface ($3f).
One thing that needs to be clarified is that there does
exist a Kempston Mouse Interface, which is not what you
are talking about. You're talking about plugging an Amiga
mouse into a Kempston Joystick port. The Amiga mouse
generates quadrature pulses for horizontal and vertical
movements, which your program must read and update an
internally stored mouse position with. The link Chris
gave explains this. The problem with this is that a
program must sit there and read the mouse all day long
in order to watch for single pixel movements. Stop
doing that and your mouse stops moving. Sprite Pack
does not contain any code for this kind of mouse.
The Kempston Mouse interface keeps track of the
mouse position for you. You read the contents of
two registers at any time to find out the horizontal
and vertical pixel position of the mouse. The range
is 256x192 I believe. This is very straightforward
to do, but the mouse area wraps: move right off the
edge of the screen and the mouse appears on the left.
The Kempston mouse code pointed at above stops this
from happening and can accommodate a 512x192 resolution
so it's a little bit more complicated than simply
reading a couple of ports. Chris gets some credit for
this as I based it on his Basic mouse driver code.
The AMX mouse is an IM2 interrupt peripheral. It
generates interrupts on two vectors, one for
horizontal movements and the other for vertical
movements. Your interrupt service routines
need to update a mouse x/y position variable
when these ints occur to track the mouse position.
The joystick mouse is fairly rare. More common
(though still rare) are the Kempston Mouse and
AMX mouse, with the AMX being most common, if you
can call it that.
Alvin
> Is there any 'widely'-supported mouse-interface that uses a serial
> mouse?
> And does anyone know if there is any diagram to convert signals from a
> serial mouse to up/down/left/right signals like an Amiga mouse?
Hi Ben,
Just recognized your name -- you must be doing some
hardware. I don't know for sure what mice the Kempston
and AMX interfaces supported, but I'd gamble they were
early serial mice (the Logitech standard? Been such
a long time since I've seen the mouse standard specs).
Anyway, for something new, forget about the Amiga mouse.
They are rare. Easiest and best for the Spectrum
would be to emulate a Kempston Mouse interface, one
where mouse coordinates are tracked by the hardware
watching serial transimissions from a standard PC mouse.
It would also be nice if you added configuration bits
that allows the mouse coordinates to wrap or not,
and to add a programmable range (0-1024, say) for
x and y coords. These should be easy to do on a
PLD of some sort. If you plan to do something like
this, let me know here as there is another hw project
in the works that will incorporate a mouse interface.
It would be nice if they were compatible.
Alvin
Well, as I said, I found a nice little schematic of an serial mouse to
Amiga port convertor.
So all I need is a schematic of a Kempston mouse interface... Who can
help me?
Ben
>I myself tried the "amiga mouse in a kempston interface" trick many years
>ago, mainly cos I was bored and had the two pieces of gear lying around. I
>was about to measure full screen movement (in 2 pixel increments) by using
>almost 50% (!) of the available CPU time in an IM2 routine.
>
>It was quite shite really, but good for a half-hour fart about :)
Yep, I agree it very hackish by today's hardware standards. I think I'd
have been well impressed if I'd have known about the technique back in
the mid 80's though (I didn't hear of it 'til maybe 2 or 3 years ago!).
Just realised that my calculations were wrong by a factor of 2 (reading
port 31 once per interrupt cycle actually = 50 pixels/second of
detectable mouse movement), which is still so slow that you to need to
read the mouse port multiple times in a loop (and therefore eat up more
CPU time). Definitely makes things a bit ropey if you actually want to
do anything useful while reading the mouse position!
--
Chris Cowley
This is getting weird, maybe there were two versions?
Brian
--
Brian Gaff....Note, this account does not accept Bcc: email.
graphics are great, but the blind can't hear them
Email: bri...@blueyonder.co.uk
____________________________________________________________________________
__________________________________
"Matthew Westcott" <gas...@raww.org> wrote in message
news:2mkpllF...@uni-berlin.de...
---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.726 / Virus Database: 481 - Release Date: 22/07/2004
On Wed, 28 Jul 2004 11:15:10 GMT, "Brian Gaff" <Bri...@blueyonder.co.uk> wrote:
>Hang on a moment, An Amiga mouse and a Kempston Joystick may work, I do not
>know, but I am almost certain the mouse port on the real' interfaces were
>not port 31, as you could use a joystick and mouse at the same time.
>
>This is getting weird, maybe there were two versions?
>
>Brian
--
> I don't know for sure what mice the Kempston
> and AMX interfaces supported,
My Kempston Mouse interface I bought from Datel used an Atari ST mouse.
I don't know about other versions of the interface.
I also had an AMX mouse interface; this oddly enough used an AMX mouse,
which has a plug which fits a BBC's User Port. As far as I know the AMX
mouse is a simple quadrature mouse, and many of them are crap.
--
Alex Taylor
>Is there any 'widely'-supported mouse-interface that uses a serial
>mouse?
>And does anyone know if there is any diagram to convert signals from a
>serial mouse to up/down/left/right signals like an Amiga mouse?
Okay... you asked for it - apologies if any of this is too simple/obvious;
The Kempston mouse interface has nothing in common with the Kempston joystick
interface other than being the same company and the same 9-pin D-type
connector. Datel produced a mouse package that featured two 9-pin ports, one
kempston mouse, one kempston joystick - helpfully neither was labelled.
The details of how the Kempston mouse interface communicated with the Speccy
hardware are documented in the Spectrum FAQ with the provisor that the IN
instructions are not quite complete if you want all the apps to work. You need
the additional second port number (technically, it would appear on many many
ports like most speccy hardware however these are the only known ones looked
for in software);
64223, 1751: Mouse buttons
64479, 4929: Mouse X position
65503, 1951: Mouse Y position
Effectively the joystick interface is keeping track of the mouse "pointer" from
0-255 horizontally on the X and 0-192 vertically on the Y making it easier to
write software to utilise. Mice themselves do not keep track of this and just
send movement information. (http://www.cs.net/lucid/mouse.htm for serial mouse
information)
There is no direct correlation between what mouse you need to generate a
"Kempston" compatible one at the other end however I believe my Datel device
used a serial mouse - I'd have to check to be 100% sure and it's at my parents
- so not any time soon :(
The AMX mouse on the other hand used a programmable Z80PIO and generated
interrupts and is hence less trivial... It was while looking at emulating a
Z80PIO I decided I wouldn't be adding AMX support to Spin ;-)
[)amien
'Kempston Mouse:
'Although better known for their Joystick interfaces, Kempston also
introduced
'many other devices. Their mouse is emulated by Spectaculator, vbSpec,
SPINand
'and others.
'The 2-button mouse can be accessed from either machine code or BASIC
using the
'following commands:
'Horizontal position: IN 64479
'Vertical postition: IN 65503
'Buttons: IN 64223 [ 255 = None ], [ 254 = Left ], [ 253 = Right ] and
[ 252 =
'Both ]
Alas no information about the hardware. What's in the interface?
Anyone got one and dares to open it?
>The FAQ sais:
I would hazard a guess on a PCB, some circuits and maybe a chip or two,
finishing up with a 9-pin atari style connector.
Of course, I could be wrong! :)
> Alas no information about the hardware. What's in the interface?
> Anyone got one and dares to open it?
The typical quadrature decoder circuit can be found
at <http://www.fpga4fun.com/QuadratureDecoder.html>
Scroll down to the second circuit, the one with the
extra flip-flops to avoid metastability. This is the
one you'll need. The 'clk' can be the Z80 clock.
The clock enable and count direction can go to
a standard TTL up/down counter part, again with
its clock attached to the Z80 clock.
The Y counter needs to have a comparator of some
sort to watch for a value of 255 (in which case,
the counter should be loaded with 191) and a value
of 192 (in which case the counter should be loaded
with 0). This duplicates the Kempston's Y-value
wrap.
To the output of the counter, a '541 buffer and the
corresponding logic to drive the bus when the right
port is read.
Multiply this by two, one for the X direction and
one for the Y direction and you probably have what
Kempston did. The button state can be driven
by another '541 on another port directly.
Of course I think you should forget about exactly
what Kempston did and concentrate on supporting
a PS/2 serial mouse :-) PS/2 mice are 5V, other
serial PC mice sometimes expect 12V from a typical
serial port.
Alvin
Well, again that's what I want, but... I also want to create a
compatible interface.
So, I use a convertor for serial -> Amiga mouse (Kempston mouse), and
then I need the best interface.
Also, I read about some software (was it Soundtracker?) which uses the
Amiga mouse on a Kempston Joystick port, and as I read in this thread,
normally that would take a lot of processor capacity.
Now I don't think that is a problem for my purpose, to integrate it
into the MB04 interface which has a DMA chip etc; could take much less
processor time when used.
But it still isn't very compatible, so the Kempston Mouse circuitry
would be nice...
www.benophetinternet.nl/hobby
- section: Kempston Mouse interface
Wow, I didn't think you would. There is no
quadrature decoder in this circuit, so it
only counts every four mouse ticks. I wonder
if users of the Kempston mouse found it less
sensitive than a typical Amiga/PC mouse?
If you select a PIC part with more i/o pins,
you may be able to move just about everything
into the PIC, except for address decoding and
bus driving.
Alvin
> www.benophetinternet.nl/hobby
> - section: Kempston Mouse interface
Hang on, the real Kempston confines Y coordinates
to 0-191 and wraps across that range. This circuit
doesn't do that. Or am I wrong about Kempston
behaviour?
Alvin
>Hang on, the real Kempston confines Y coordinates
>to 0-191 and wraps across that range. This circuit
>doesn't do that. Or am I wrong about Kempston
>behaviour?
Going from my (slightly dodgy) memory, I think the Kempston interface is
0-255 for both the X and Y coordinates. I'm sure I remember the odd
effect this created in my old mouse driver code before I stopped it
wrapping at the screen edges.
--
Chris Cowley
> On 30 Jul 2004 11:31:24 -0700, A9...@hotmail.com (Alvin) wrote:
>> Hang on, the real Kempston confines Y coordinates to 0-191 and wraps
>> across that range. This circuit doesn't do that. Or am I wrong about
>> Kempston behaviour?
> Going from my (slightly dodgy) memory, I think the Kempston interface is
> 0-255 for both the X and Y coordinates.
I'm currently playing with Kempston mouse emulation for Fuse. (Using Artist
II as my test program.)
I did consider 0..191 for the Y coordinate, but quickly decided that 0..255
for Y is the more sensible thing for the hardware to do: it doesn't have to
test for bits 6 and 7 being set, with the consequent lack of requirement to
add or subtract 64, and it's easier for software to handle since it doesn't
have to use the hardware coordinates as the initial display coordinates and
can use new_pos = old_pos + new_hw_pos - old_hw_pos, clipping to screen.
> I'm sure I remember the odd effect this created in my old mouse driver code
> before I stopped it wrapping at the screen edges.
Why? That kind of thing's fun ;-)
--
| Darren Salt | d youmustbejoking,demon,co,uk | nr. Ashington,
| RISC OS, | s zap,tartarus,org | Northumberland
| Linux | @ | Toon Army
| Let's keep the pound sterling
Daddy, what does "Formatting drive C:" mean?