== Description ==
The following project describes how to construct an AMX compatible PS/2 and USB Mouse adapter for the Amstrad CPC. I’ve never actually owned an AMX Mouse, in fact I’ve never even seen one other than in pictures. Back in the 80s I had no need for one, but with GUIs like FutureOS and SymbOS now available, I decided it was time to get my own…or at least build an equivalent. Like other projects that I’ve shared in the community, I’ve tried to keep this project as simple as possible to construct and as cheap as possible to build, otherwise it scares people from trying to build it for themselves. That said, you will need to be proficient at soldering and possibly need to produce your own PCB, if you wish for your end product to look like the one above. I have also supplied a single sided layout, to make it easier for those of us who like to produce our own PCBs. While designing the circuit, I realised that most modern mice have a scroll wheel which wasn’t available back then on the AMX. As the CPC has a few inputs spare on the port (Joy2), I decided to make them accessible by binding them to the Joy2 up and down signals. Although this isn’t strictly AMX compatible, I thought the people at SymbOS or FutureOS, might like to take advantage of them, so consider this adapter is AMX+ compatible.
== Warning / Disclaimer ==
Although I have taken the utmost care preparing this documentation, I do not guarantee that it is error free and I accept no responsibility for damage to anyone’s CPC, Mouse or other personal equipment or injury inflicted on you or others.
== The Circuit ==
== Parts List ==
As I mentioned above, one of my priorities is always to keep the price as low as possible, and according to my local supplier, the cost of the entire board should come in at under 7€. Here’s the Parts list and their approximate prices:
== The Firmware ==
The firmware is the clever bit, it is written in PIC assembler. Its more or less a PS/2 driver with a little bit added to convert every movement into signals the Amstrad can work with, its first job is to get the mouse to life, it sends the required initialisation sequence and sets up some variables available in the mouse. Among other things, I have slightly de-sensitised the mouse, so that a single twitch doesn’t send the arrow shooting across the screen. As well as this, it automatically recognises whether the mouse has a scroll wheel and turns it on if it does. After that, it just continuously asks the mouse if it has moved and collects the data the mouse sends back, this is then converted into the corresponding up/down/left/right and fire inputs that the CPC needs. I have also added plug and play detection, so if the mouse is unplugged at any time, the PIC recognises this and re-initialises the mouse when it has been re-connected. This also means that is is possible to swap between different mice (even between PS/2 and USB) during operation, without a re-start. The driver is purely a PS/2 driver, this means that even if a USB mouse is connected, it is being forced into PS/2 mode, so if the mouse does not support the PS/2 protocol it will not work with this device, but luckily all standard USB mice seem to still support PS/2. I haven’t published the source code here, but if anyone is interested, I may be willing to share it for educational purposes.
== Installing the Firmware ==
I have supplied a pre-compiled HEX file, so you don’t have to worry about installing additional assemblers or having to compile things yourself. You will however need to get the program onto the chip. If you don’t know how to program a PIC, I would suggest you do some research on the JDM programmer, an even smaller PCB that allows you to program the chip through an RS232 port using freeware such as PikLab if you’re a Linux user or ICProg if windows is your preferred PC OS. A quick warning: I'm told that the JDM doesn't work on Laptop Com-ports because they don't supply the required 12V, so keep this in mind if you build one. The total price to build a JDM programmer should be under 2€.
== Construction Tips ==
As with the original AMX Mouse, the only connections needed to the CPC are through the joystick port and to the 5V supply. I have kept the PCB size to a minimum, to allow the board to be connected directly to the joystick port without getting in the way too much or tearing the connector off the side. You may choose an alternative layout to mine, but remember that if it is too large, it may damage the joystick port and would be better with a fly-lead connection.
== Using The Mouse ==
There are two switches on the PCB, the inner one (beside the power socket), should in most cases be left in the OFF position. This is the Auto-detect position. The firmware will auto-detect which type of mouse is connected and initialise it as required, if however you have a mouse which is not being recognised correctly (Error lamp flashes or incorrect output), switching this switch ON will tell the PIC not to auto-detect and to assume a type 00 mouse (standard mouse with no scroll wheel or extra buttons) and may allow you to continue using the mouse. The position of this switch should be chosen before power is applied. In some cases, although you have chosen auto-detect, the PIC may recognise that the mouse is incompatible and dis-enable the scroll wheel although one is present, the mouse should however continue to work as a non-scroll wheel mouse.
== Testing The Mouse ==
In BASIC, moving the mouse should produce the arrows usually seen when a joystick is connected. Pressing the left button will produce an X and the right button produces a Z. The centre button will not show any visual feedback in Basic, but can be sensed using the Inkey(78) command.
== Compatibility ==
Like I mentioned above, I’ve never seen an AMX mouse, so I don’t know exactly how they react to movement, how fast they were or how they “felt”. Technically speaking, the mouse adapter described here is fully AMX compatible and works perfectly with AMX compatible packages. I have tuned the feel of the mouse to closely resemble a PC mouse, but if you build this and find that it’s not quite the “AMX feel”, let me know and I might be able to tune it back to the 80s. And remember, if you are used to only using a PC mouse, don't expect an 8-Bit mouse to have the same lightening response time, moving the mouse really fast will not have the same result as on a PC, the Amstrad can only read the Joystick port at a certain rate, so moving the mouse slower will give a much smoother and accurate result.
== Resources ==
[[File:PS2Mouse_Layout.pdf]] - PCB Track Layout
== Further Info ==
Version 1.0 of the Firmware is here. This version adds Plug & Play functionality, auto-detection for the type of mouse and includes some slight tuning to improve the mouse reaction time. The schematic and layout have not been changed.