|
Vintage Computers Any vintage computer systems, calculators, video games etc., but with an emphasis on 1980s and earlier equipment. |
|
Thread Tools |
26th Sep 2011, 11:19 pm | #1 |
Dekatron
Join Date: Aug 2011
Location: Newcastle, Tyne and Wear, UK.
Posts: 11,482
|
ZX Spectrum AMX mouse comms format?
This query seems obscure even to me, but I've been amazed by some of the detailed responses I've seen to other unimaginably obscure queries on these forums, so here goes:
Once upon a time, AMX made a mouse peripheral for the ZX Spectrum called the 'AMX mouse' - I'd like to make one of these, or a modern circuit which exactly emulates one, and I've got the diagram for the original interface (which used a Z80-PIO), but not for the mouse itself. One surprise (to me) is that the interface does not contain any intelligence or eprom, so the onus was upon the supporting software (software such as the 'OCP Art Studio') to do all the reading / polling / interpretation / interrupt handling. The sketchy information I have says that the AMX mouse communicated via IM2 (interrupt mode 2) interrupts, (ie, whenever there was a mouse movement it caused an IM2 interrupt) and that the value placed on the data bus at the time conveyed the mouse movement vectors. The three mouse buttons appear to have their own I/O mapped circuitry done in a similar way to some joystick interfaces of the time - this circuitry is independent of the PIO, which only uses ASTB and PA0 of port A to handle the X axis and BSTB and PB0 of port B to handle the mouse Y axis. The other PIO port pins are used to support a parallel printer port and / or general I/O. From the terminology used for the mouse signals (XA, XB, YA, YB) it sounds like an unmodified Amiga or ST mouse could possibly be pressed into service with the original interface circuit - (except that those mice only have two buttons). The alternative would be to use a microprocessor to interface a PC serial or PS2 mouse to the Spectrum, but then I'd need information about the traffic which originally passed between the PIO and the Spectrum in order to emulate it. Has anyone done this already? |
27th Sep 2011, 2:23 am | #2 |
Dekatron
Join Date: May 2008
Location: Derby, UK.
Posts: 7,735
|
Re: ZX Spectrum AMX mouse comms format?
The AMX mouse for the BBC plugged into the User Port, and used the computer to process the raw signals from the opto-sensors. The outputs were X direction, X step, Y direction and Y step. Each step caused an interrupt and depending on the direction at the moment, increased or decreased a count.
The ZX Spectrum version almost certainly uses a very similar arrangement, with an I/O port for reading the sensors.
__________________
If I have seen further than others, it is because I was standing on a pile of failed experiments. |
27th Sep 2011, 8:52 am | #3 |
Nonode
Join Date: Oct 2008
Location: Warsaw, Poland and Cambridge, UK
Posts: 2,669
|
Re: ZX Spectrum AMX mouse comms format?
A quick look at the Z80-PIO data sheet:
http://www.datasheetcatalog.org/data.../285929_DS.pdf shows that it's capable of working in a similar way to the 6522 PIA in the BBC Micro, which the Beeb's AMX mouse depended on, as AJS says. Of the two quadrature signals from each axis's shaft encoder, one acts as 'step' and the other as 'direction'. If you get them the wrong way round, the movement is just reversed. To wire up an Amiga or ST mouse, or even a BBC AMX mouse, you'd have to connect XA to nASTB, XB to PA0, YA to nBSTB, YB to PB0. If the movements are wrong way round, swap XA/XB and YA/YB. The relevant signals are available inside any PC 3-button mouse - just ignore the controller chip and take them straight from the shaft encoders. Implementing the interface is probably easiest with an actual Z80-PIO, if you can find one, though emulating enough of it in programmable logic would be an interesting project. I had a quick look at opencores.org to see if there was a Z80-PIO core but couldn't see one. There might be one for the more common 8255, which seems pretty similar to the Z80-PIO and could be used as a starting point, but it might be quicker just to implement the bare minimum from scratch - the Z80-PIO has loads of features the mouse interface will simply never use. |
27th Sep 2011, 6:38 pm | #4 |
Dekatron
Join Date: Aug 2011
Location: Newcastle, Tyne and Wear, UK.
Posts: 11,482
|
Re: ZX Spectrum AMX mouse comms format?
Thanks for the replies, gents - it has always been a strange habit of mine to buy interesting looking junked microprocessor boards whenever I see them at radio rallies and so on, and so I have acquired a little collection of classic 80s microprocessors and their associated support chips, including, fortunately, at least one genuine Z80-PIO.
The dilemma I originally had in mind was whether to just build the original dumb PIO interface and find or create a suitable mouse (option 1) or use a PC serial / PS2 mouse and try to make a microprocessor based interface which imitated the AMX mouse interface, (option 2). Thanks for the info that the same basic signals are available inside any PC three button mouse - if that's the case then it's looking increasingly like building a copy of the original interface is the better (and certainly the more satisfyingly retro) way to go. Thanks also for the description of the operation of the BBC AMX mouse as well. I am 90+ percent certain the mouse itself would have been absolutely identical to the one supplied for the Spectrum (it should only be the interface which would be different). Incidentally, using another similar device (ie, 8255) is not an option here - the aim is to use this project with -existing- AMX mouse compatible software which will undoubtedly send Z80-PIO specific setup information (Port pin direction setup, port interrupt enable, and so on) to the interface before starting to read the mouse. Last edited by SiriusHardware; 27th Sep 2011 at 6:54 pm. |
28th Sep 2011, 7:40 am | #5 |
Retired Dormant Member
Join Date: Aug 2008
Location: London, UK.
Posts: 47
|
Re: ZX Spectrum AMX mouse comms format?
|
28th Sep 2011, 8:58 am | #6 |
Nonode
Join Date: Oct 2008
Location: Warsaw, Poland and Cambridge, UK
Posts: 2,669
|
Re: ZX Spectrum AMX mouse comms format?
The mouse in that link looks to have the same 20-pin connector on it as the BBC Micro mouse (of which I still own one), and the pinout in the schematic looks pleasingly compatible with the Beeb's user port, which is a good sign that the mouse itself is identical to the Beeb one.
By the way, when I mentioned starting with an 8255, I meant a *model* of the 8255 in VHDL or Verilog as a starting point for developing a Z80-PIO model which would be compatible enough with the existing software. I appreciate the originality of using the original parts, but re-creating something functionally identical using modern technology also appeals to me |
28th Sep 2011, 9:51 pm | #7 | |
Dekatron
Join Date: Aug 2011
Location: Newcastle, Tyne and Wear, UK.
Posts: 11,482
|
Re: ZX Spectrum AMX mouse comms format?
Quote:
I have a lot of admiration for what people seem to be able to do with them though - there's a guy who has built a modern version of Sinclair's original home computer (the MK14) and most of it seems to be a large programmable device used to replace most/all of the original separate logic. Still, the best solution for me seems to be replication of the original Spectrum AMX mouse interface. |
|
28th Sep 2011, 9:55 pm | #8 | |
Dekatron
Join Date: Aug 2011
Location: Newcastle, Tyne and Wear, UK.
Posts: 11,482
|
Re: ZX Spectrum AMX mouse comms format?
Quote:
Oh, wait, I've just noticed something interesting. There's no WR (write connection) between the Spectrum and the PIO. Surely that's impossible? Without it, the Spectrum won't be able to set up the data direction registers, won't be able to turn the port interrupts on, and certainly won't be able to send anything to the PIO-Connector. Must be an error? Last edited by SiriusHardware; 28th Sep 2011 at 10:03 pm. |
|
11th Apr 2013, 4:36 pm | #9 |
Retired Dormant Member
Join Date: Apr 2013
Location: Newport, Gwent, UK.
Posts: 1
|
Re: ZX Spectrum AMX mouse comms format?
Hi, I am the original designer of the AMX Mouse for the ZX Spectrum.
The original mouse used on the prototype was one from an Apple Macintosh of the day. The PIO was mapped into the Spectrum's IO space and used the interrupts from two 8 bit ports to generate an X or Y trigger. Two bits of IO, one for each port were used to determine the direction of the movement. The other bits in the PIO were used to create a Centronics parallel printer port. If you want to emulate the thing I don't suppose you really need to emulate the entire PIO. Bob. |
12th Apr 2013, 6:54 pm | #10 |
Dekatron
Join Date: Aug 2011
Location: Newcastle, Tyne and Wear, UK.
Posts: 11,482
|
Re: ZX Spectrum AMX mouse comms format?
Hello Bob! A genuine spectrum era celebrity! . Thanks for the info about the origins of the mouse. There are bound to be a few of those around, I'm sure.
I started this thread a long time ago, my interest in the AMX mouse came about because I wanted to try using my favourite Spectrum art / drawing utility ("The OCP Art Studio") with a mouse, something I never had the luxury of at the time. As mentioned earlier, I do have a genuine Z80-PIO in my collection of antique 80s-era ICs, so emulation isn't really required - in theory, I can just build a replica of the real thing. However, the version of art studio that I still have is the 128K specific version and I have a vague memory of having read that either the AMX mouse was not supported in that version, or the AMX mouse was incompatible with 128K hardware. Can you stretch your mind back that far and possibly remember whether there was any issue in that respect? |
13th Apr 2013, 12:03 am | #11 |
Dekatron
Join Date: May 2008
Location: Derby, UK.
Posts: 7,735
|
Re: ZX Spectrum AMX mouse comms format?
It's very possible there may have been an address clash between the AMX mouse and the 128K Spectrum hardware extensions. Even if so, you could always build your mouse interface to sit on different addresses and patch the software to suit. I used to be able to look at a column of hex numbers and see the instructions in my mind's eye, back in the days .....
For extra hacker cred points, use a PIC microcontroller to talk to a modern PS/2 or USB mouse (a USB mouse may be able to speak PS/2 if it decides it is not plugged into a proper USB port, even if no adaptor was supplied with it; they probably all use the same ICs internally) and output the same XA, XB, YA and YB signals as an original AMX mouse!
__________________
If I have seen further than others, it is because I was standing on a pile of failed experiments. |
15th Apr 2013, 9:56 am | #12 |
Heptode
Join Date: Jul 2008
Location: Selby, North Yorkshire, UK.
Posts: 979
|
Re: ZX Spectrum AMX mouse comms format?
If it helps, I've got a full boxed copy of the 48K OCP Art Studio, complete with nasty Lenslok device.
Alternatively, you could just download the TAP or TZX image from www.worldofspectrum.org. There are utilities to convert these to audio so they can be recorded back to cassette for loading on real hardware. |
15th Apr 2013, 6:18 pm | #13 | |
Dekatron
Join Date: Aug 2011
Location: Newcastle, Tyne and Wear, UK.
Posts: 11,482
|
Re: ZX Spectrum AMX mouse comms format?
Quote:
Both versions are indeed available on World Of Spectrum but the image files are so perfectly original that they still feature the dreadful Lenslok protection - there is a Lenslok emulator available which creates a transparent window which can be moved around the screen - you hover it over the lenslok query screen on your spectrum emulator and it unscrambles the two letter code just as badly as the real thing. I haven't yet resolved the question of whether the 128K version of OCP is / is not compatible with the AMX mouse. I'm hoping Bob Powell may be able to enlighten me on this point. |
|
15th Apr 2013, 6:42 pm | #14 | |
Dekatron
Join Date: Aug 2011
Location: Newcastle, Tyne and Wear, UK.
Posts: 11,482
|
Re: ZX Spectrum AMX mouse comms format?
Quote:
USB, aggh, you must be joking. I'm staying away from that for as long as I possibly can, but I agree that many USB keyboards and mice can talk to PS/2 ports on PCs when connected only via a simple physical converter with no form of interface or intelligence in it, so they must have a PS/2 'fallback' mode. If I did involve a microcontroller then it would make sense to replace the PIO with that and use it to mimic the behaviour of the Z80-PIO on the Spectrum bus. I believe some of the larger PICs do have a special 'parallel peripheral' mode, typically on PORT D, which enables the PIC to be connected directly to an 8-bit microprocessor system bus and to appear to be a dedicated peripheral IC complete with read / write / chip enable pins, etc. It's up to the person programming the PIC to decide what it will do when the host system accesses it. |
|
15th Apr 2013, 8:27 pm | #15 | |
Guest
Posts: n/a
|
Re: ZX Spectrum AMX mouse comms format?
Quote:
|
|