Difference between revisions of "Kempston Mouse"
(→Technical) |
|||
(48 intermediate revisions by 5 users not shown) | |||
Line 1: | Line 1: | ||
− | This mouse is supported by [[The Advanced OCP Art Studio]]. | + | 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 == | ||
+ | |||
+ | <gallery caption="Kempston Mouse Interface"> | ||
+ | Image:KempstonMouseInterfaceTop.jpg|Back (showing mouse connector) - faces away from CPC | ||
+ | Image:KempstonMouseInterfaceBottom.jpg|Front (showing edge connector) - faces CPC | ||
+ | Image:KempstonMouseInterfaceSide1.jpg|Side | ||
+ | Image:KempstonMouseInterfaceSide2.jpg|Other side | ||
+ | Image:KempstonMouseInterfaceAbove.jpg|From above | ||
+ | Image:KempstonMouseInterfaceUnder.jpg|From below | ||
+ | Image:KempstonMousePCBTop.jpg|PCB (joystick connector side) | ||
+ | Image:KempstonMousePCBUnder.jpg|PCB (edge connector side) | ||
+ | </gallery> | ||
+ | |||
+ | <gallery caption="Kempston compatible mouse"> | ||
+ | Image:KempstonMouse.jpg|Kempston Mouse | ||
+ | Image:KempstonMouseUnder.jpg|Kempston Mouse (under) | ||
+ | </gallery> | ||
== Technical == | == Technical == | ||
− | + | The interface described here was loaned to arnoldemu by yoshi.doshi. | |
− | Port FBEEh READ: Kempston Mouse 8 bit X position | + | |
− | Port FBEFh READ: Kempston Mouse 8 bit Y position | + | PCB has a 50-way edge connector. There is no through connector. The mouse connects via a 9-pin female D-sub (standard joystick socket) which is on the PCB. |
− | + | ||
− | + | The board is labelled "(C) KEMPSTON MICRO AMSTRAD MOUSE I/F" and "ISS B". | |
+ | |||
+ | The ICs are labelled and are: | ||
+ | |||
+ | IC1 DM74LS00N QUAD 2-INPUT NAND | ||
+ | IC2 DM74LS191N SYNCHRONOUS UP/DOWN COUNTERS WITH DOWN/UP MODE CONTROL (4-bit binary counter) | ||
+ | IC3 DM74LS191N SYNCHRONOUS UP/DOWN COUNTERS WITH DOWN/UP MODE CONTROL (4-bit binary counter) | ||
+ | IC4 74LS125APC QUAD 3-STATE BUFFER | ||
+ | IC5 DM74LS191N SYNCHRONOUS UP/DOWN COUNTERS WITH DOWN/UP MODE CONTROL (4-bit binary counter) | ||
+ | IC6 DM74LS191N SYNCHRONOUS UP/DOWN COUNTERS WITH DOWN/UP MODE CONTROL (4-bit binary counter) | ||
+ | IC7 DM74LS138N 1-OF-8 DECODER/DEMULTIPLEXER | ||
+ | IC8 DM74LS257BN 3-STATE QUAD 2-DATA SELECTORS/MULTIPLEXERS | ||
+ | IC9 DM74LS257BN 3-STATE QUAD 2-DATA SELECTORS/MULTIPLEXERS | ||
+ | |||
+ | The mouse that comes with the interface has 2 buttons. It is a ball mouse. Unknown brand. | ||
+ | Green label reads "Q.C. PASSED. MADE IN TAIWAN. R. O. C.". Mouse has 9-pin DIN like a joystick. Unknown if compatible with Atari ST or Amiga or neither. | ||
+ | |||
+ | 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 === | ||
+ | |||
+ | Decoding seems to be (some testing to confirm this): | ||
+ | |||
+ | I/O port for X position is decoded as xxxx x0x1 xxx0 xxx0 (FBEE is normally used) | ||
+ | I/O port for Y position is decoded as xxxx x0x1 xxx0 xxx1 (FBEF is normally used) | ||
+ | I/O port for Buttons is decoded as xxxx x0x0 xxx0 xxxx (FAEF is normally used) | ||
+ | |||
+ | Confirmed connected: | ||
+ | A10, A0, A4, A8. | ||
+ | |||
+ | ==== Movement ==== | ||
+ | |||
+ | Port FBEEh READ: Kempston Mouse 8 bit X position (left: -ve, right: +ve) | ||
+ | Port FBEFh READ: Kempston Mouse 8 bit Y position (up: +ve, down: -ve) | ||
+ | |||
+ | NOTE: | ||
+ | * Movement is accumulated so you only need to read the mouse status when you want e.g. once per frame. | ||
+ | * Speed is 1 for slow movement of the mouse and 12 for very fast movement. | ||
+ | * The position values are not reset after reading. | ||
+ | * The position values do not change if the mouse is not moving | ||
+ | * Position values wrap around e.g. when moving left with movement speed of 1, 0 wraps around to ff (0-1 -> ff) and when moving right with movement speed of 1, ff wraps around to 0 (ff+1->0) | ||
+ | * To calculated the distance moved since last read subtract the new value read from the previous value read and AND with ff. The value is the amount of movement. | ||
+ | 0 means no movement. -ve means moving left/down, +ve means right/up. | ||
+ | |||
dist=new-old, old=new | dist=new-old, old=new | ||
whereas, | whereas, | ||
Line 14: | Line 81: | ||
dist=-01h..-80h moved left/down | dist=-01h..-80h moved left/down | ||
− | Buttons | + | ==== Buttons ==== |
+ | |||
Port FAEFh READ: Kempston Mouse Buttons | Port FAEFh READ: Kempston Mouse Buttons | ||
− | bit 0: | + | bit 0: Right Button (active low) |
− | bit 1: | + | bit 1: Left Button (active low) |
− | bit 2..7: unknown | + | bit 2..7: not used. report as high (1) |
+ | |||
+ | Number of supported mouse buttons is unknown. It is believed to be 2. The mouse that comes with the interface has two. | ||
== Review (German) == | == Review (German) == | ||
− | From an article about the "Amstrad Consumer Show" in | + | From an article about the "Amstrad Consumer Show" in German magazine "Happy Computer 12/1986": |
* "Bewundern Sie auch die Maussteuerung eines Atari ST oder eines Schneider PC? Bei Kempston gibt es für 69,95 Pfund auch für Ihren CPC oder Joyce so eine komfortable Benutzeroberfläche. Die Maus entspricht dabei völlig dem Standard mit zwei unabhängigen Tasten. Das mitgelieferte Desktop-Programm braucht sich vor den Brüdern auf 16-Bit-Computern nicht zu verstecken." | * "Bewundern Sie auch die Maussteuerung eines Atari ST oder eines Schneider PC? Bei Kempston gibt es für 69,95 Pfund auch für Ihren CPC oder Joyce so eine komfortable Benutzeroberfläche. Die Maus entspricht dabei völlig dem Standard mit zwei unabhängigen Tasten. Das mitgelieferte Desktop-Programm braucht sich vor den Brüdern auf 16-Bit-Computern nicht zu verstecken." | ||
+ | |||
+ | == Get mouse position on screen == | ||
+ | |||
+ | Calculating the mouse position from the information given on the Kempston mouse ports is easy. | ||
+ | |||
+ | We will proceed in 2 steps: | ||
+ | 1. Calculate mouse pointer location on a virtual screen that has a 640*400 resolution. | ||
+ | 2. Translate position from the virtual screen to the current CPC screen mode. | ||
+ | |||
+ | Here is the algorithm in pseudo-code: | ||
+ | # initMouse initializes variables and centers the mouse pointer on screen | ||
+ | def initMouse(): | ||
+ | maxX = 639 | ||
+ | maxY = 399 | ||
+ | # centering the mouse pointer on the screen | ||
+ | virtualX = maxX >> 1 # maxX/2 | ||
+ | virtualY = maxY >> 1 # 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? | ||
+ | |||
+ | |||
+ | [[Category:Peripherals]][[Category:Input Device]] |
Latest revision as of 12:52, 30 June 2024
This mouse is supported by The OCP Art Studio, The Advanced OCP Art Studio and Carrier Command.
It is emulated in Arnold, ACE and ACE-DL.
Contents
Pictures
Technical
The interface described here was loaned to arnoldemu by yoshi.doshi.
PCB has a 50-way edge connector. There is no through connector. The mouse connects via a 9-pin female D-sub (standard joystick socket) which is on the PCB.
The board is labelled "(C) KEMPSTON MICRO AMSTRAD MOUSE I/F" and "ISS B".
The ICs are labelled and are:
IC1 DM74LS00N QUAD 2-INPUT NAND IC2 DM74LS191N SYNCHRONOUS UP/DOWN COUNTERS WITH DOWN/UP MODE CONTROL (4-bit binary counter) IC3 DM74LS191N SYNCHRONOUS UP/DOWN COUNTERS WITH DOWN/UP MODE CONTROL (4-bit binary counter) IC4 74LS125APC QUAD 3-STATE BUFFER IC5 DM74LS191N SYNCHRONOUS UP/DOWN COUNTERS WITH DOWN/UP MODE CONTROL (4-bit binary counter) IC6 DM74LS191N SYNCHRONOUS UP/DOWN COUNTERS WITH DOWN/UP MODE CONTROL (4-bit binary counter) IC7 DM74LS138N 1-OF-8 DECODER/DEMULTIPLEXER IC8 DM74LS257BN 3-STATE QUAD 2-DATA SELECTORS/MULTIPLEXERS IC9 DM74LS257BN 3-STATE QUAD 2-DATA SELECTORS/MULTIPLEXERS
The mouse that comes with the interface has 2 buttons. It is a ball mouse. Unknown brand. Green label reads "Q.C. PASSED. MADE IN TAIWAN. R. O. C.". Mouse has 9-pin DIN like a joystick. Unknown if compatible with Atari ST or Amiga or neither.
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
Decoding seems to be (some testing to confirm this):
I/O port for X position is decoded as xxxx x0x1 xxx0 xxx0 (FBEE is normally used) I/O port for Y position is decoded as xxxx x0x1 xxx0 xxx1 (FBEF is normally used) I/O port for Buttons is decoded as xxxx x0x0 xxx0 xxxx (FAEF is normally used)
Confirmed connected: A10, A0, A4, A8.
Movement
Port FBEEh READ: Kempston Mouse 8 bit X position (left: -ve, right: +ve) Port FBEFh READ: Kempston Mouse 8 bit Y position (up: +ve, down: -ve)
NOTE:
- Movement is accumulated so you only need to read the mouse status when you want e.g. once per frame.
- Speed is 1 for slow movement of the mouse and 12 for very fast movement.
- The position values are not reset after reading.
- The position values do not change if the mouse is not moving
- Position values wrap around e.g. when moving left with movement speed of 1, 0 wraps around to ff (0-1 -> ff) and when moving right with movement speed of 1, ff wraps around to 0 (ff+1->0)
- To calculated the distance moved since last read subtract the new value read from the previous value read and AND with ff. The value is the amount of movement.
0 means no movement. -ve means moving left/down, +ve means right/up.
dist=new-old, old=new whereas, dist=00h : no move dist=+01h..+7Fh moved right/up dist=-01h..-80h moved left/down
Buttons
Port FAEFh READ: Kempston Mouse Buttons bit 0: Right Button (active low) bit 1: Left Button (active low) bit 2..7: not used. report as high (1)
Number of supported mouse buttons is unknown. It is believed to be 2. The mouse that comes with the interface has two.
Review (German)
From an article about the "Amstrad Consumer Show" in German magazine "Happy Computer 12/1986":
- "Bewundern Sie auch die Maussteuerung eines Atari ST oder eines Schneider PC? Bei Kempston gibt es für 69,95 Pfund auch für Ihren CPC oder Joyce so eine komfortable Benutzeroberfläche. Die Maus entspricht dabei völlig dem Standard mit zwei unabhängigen Tasten. Das mitgelieferte Desktop-Programm braucht sich vor den Brüdern auf 16-Bit-Computern nicht zu verstecken."
Get mouse position on screen
Calculating the mouse position from the information given on the Kempston mouse ports is easy.
We will proceed in 2 steps:
1. Calculate mouse pointer location on a virtual screen that has a 640*400 resolution. 2. Translate position from the virtual screen to the current CPC screen mode.
Here is the algorithm in pseudo-code:
# initMouse initializes variables and centers the mouse pointer on screen def initMouse(): maxX = 639 maxY = 399 # centering the mouse pointer on the screen virtualX = maxX >> 1 # maxX/2 virtualY = maxY >> 1 # 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?