This mouse is supported by [[The OCP Art Studio]], [[The Advanced OCP Art Studio]] and [[Carrier Command]].
It is emulated in [[Arnold (Emulator)|Arnold]], [[ACE_(Emulator)|ACE]] and [[ACE-DL]].
== Pictures ==
The schematics and PCB are 90% the same as the Spectrum's. They differ in the port decoding.
NOTE:
* Counters are reset to 0 at power on.
* Counters are NOT reset to 0 when using bus reset (reset switch)
=== I/O decoding ===
I/O port for X position is decoded as xxxx 1011 xxx0 xxx0 Decoding seems to be (FBEE is normally used) I/O port for Y position is decoded as xxxx 1011 xxx0 xxx1 (FBEF is normally used) I/O port for Buttons is decoded as xxxx 1010 xxx0 xxxx (FAEF is normally usedsome testing to confirm this):
In Spectrum interface A10 chooses I/O port for X,position is decoded as xxxx x0x1 xxx0 xxx0 (FBEE is normally used) I/O port for Y. On CPC interface A0 chooses X,Y.position is decoded as xxxx x0x1 xxx0 xxx1 (FBEF is normally used)In Spectrum interface A8 chooses buttons or directions. On CPC interface A8 also chooses this. I/O port for Buttons is decoded as xxxx x0x0 xxx0 xxxx (FAEF is normally used)For CPC Confirmed connected:A10, A0, A4 must be 0, A11 must be 1 and A9 must be 1A8.
==== Movement ====
Here is the algorithm in pseudo-code:
// # initMouse initializes variables and centers the mouse pointer on screen function def initMouse() {: maxX = 639; maxY = 399; // # centering the mouse pointer on the screen virtualX = maxX >> 1; // virtualX = # maxX/2 virtualY = maxY >> 1; // virtualY = # maxY/2 // # store raw mouse values oldX = inp(&FBEE); oldY = inp(&FBEF); // # get mouse pointer position refreshMouse(); }def refreshMouse(): # get raw mouse values rawX = inp(&FBEE) rawY = inp(&FBEF) # get the relative mouse displacement since last call deltaX = rawX - oldX deltaY = rawY - oldY # store raw mouse values oldX = rawX oldY = rawY # calculate new unclipped virtual position virtualX = virtualX + deltaX virtualY = virtualY - deltaY # Kempston mouse Y-axis is inverted compared to screen coordinates! # perform clipping if virtualX < 0: virtualX = 0 elif virtualX > maxX: virtualX = maxX if virtualY < 0: virtualY = 0 elif virtualY > maxY: virtualY = maxY # now we translate position from the virtual screen to the current CPC screen mode mouseX = virtualX if graphicsMode == 2 else (virtualX >> 1 if graphicsMode == 1 else virtualX >> 2) mouseY = virtualY >> 1 == Manual == * Any manual exists? == Downloads == * Any kempston example or driver software exists?
// refreshMouse has to be called before you redraw the mouse pointer (and ideally on every frame)
function refreshMouse() {
// get raw mouse values
rawX = inp(&FBEE);
rawY = inp(&FBEF);
// get the relative mouse displacement since last call
deltaX = rawX - oldX;
deltaY = rawY - oldY;
// store raw mouse values
oldX = rawX;
oldY = rawY;
// calculate new unclipped virtual position
virtualX = virtualX + deltaX;
virtualY = virtualY - deltaY; // Kempston mouse Y-axis is inverted compared to screen coordinates!
// perform clipping
if (virtualX < 0) then virtualX = 0;
else if (virtualX > maxX) then virtualX = maxX;
if (virtualY < 0) then virtualY = 0;
else if (virtualY > maxY) then virtualY = maxY;
// now we translate position from the virtual screen to the current CPC screen mode
mouseY = virtualY >> 1; // mouseY = virtualY/2
if (mode2) then mouseX = virtualX;
else if (mode1) then mouseX = virtualX >> 1; // mouseX = virtualX/2
else if (mode0) then mouseX = virtualX >> 2; // mouseX = virtualX/4
}
[[Category:Peripherals]][[Category:Input Device]]