Difference between revisions of "EnterMice"
(→Keyboard issue) |
m (→Keyboard issue) |
||
Line 138: | Line 138: | ||
[[File:KbdFixer.jpg|thumb|200px|Keyboard fixer (visualisation)]] | [[File:KbdFixer.jpg|thumb|200px|Keyboard fixer (visualisation)]] | ||
During creating the EnterMice, accidentally we discovered a fairly serious error in the design of the Enterprise. | During creating the EnterMice, accidentally we discovered a fairly serious error in the design of the Enterprise. | ||
+ | |||
Totally do not mind, if nothing is connected to the ports Control 1 and Control 2. | Totally do not mind, if nothing is connected to the ports Control 1 and Control 2. | ||
+ | |||
However, that EnterMice uses them. | However, that EnterMice uses them. | ||
+ | |||
It's about interferences on KB0..KB9 ports from keyboard. | It's about interferences on KB0..KB9 ports from keyboard. | ||
+ | |||
If at one time is pressed only one key, then there is nothing wrong with (first figure). | If at one time is pressed only one key, then there is nothing wrong with (first figure). | ||
+ | |||
However, if you press two keys simultaneously in the same column, the signal from the selected line will be transferred also to the line of second key (figure two). | However, if you press two keys simultaneously in the same column, the signal from the selected line will be transferred also to the line of second key (figure two). | ||
+ | |||
In the Enterprise missing diodes to separating the rows of the keyboard ! | In the Enterprise missing diodes to separating the rows of the keyboard ! | ||
+ | |||
Electrically nothing will happen (inside LS145 decoder has open collector outputs), but causes errors when reading from the external ports Control 1 and Control 2. | Electrically nothing will happen (inside LS145 decoder has open collector outputs), but causes errors when reading from the external ports Control 1 and Control 2. | ||
+ | |||
In order to eliminate the cause should be add diodes to each row of keys the Enterprise, to press more than one key does not cause "collisions" (third figure). | In order to eliminate the cause should be add diodes to each row of keys the Enterprise, to press more than one key does not cause "collisions" (third figure). | ||
+ | |||
I prepared a draft of the PCB-fixing, but has not been tested. | I prepared a draft of the PCB-fixing, but has not been tested. | ||
Revision as of 19:01, 25 November 2015
Joysticks & PS/2 Mouse Interface
for Enterprise 64 & 128 computer
Contents
Introduction
The interface is designed for the computers Enterprise 64/128.
It enables direct connection of two joysticks in Atari standard without additional adapters. In addition, you can use the PS/2 mouse.
EnterMice is based on solutions used in the BoxSoft interface, which used a Neos or MSX mouse.
In one of the EnterMice operating modes it is fully compatible with BoxSoft.
A little story about Enterprise and mice
Putting a mouse to control the Enterprise is not a new and eccentric idea of a freaky retro-computing group, it was already planned by the designers of the machine. The problem was that the project was subcontracted to a modest English company named Aztec Software Ltd., that produced a disappointing job. For two main reasons: the first, it was ugly, nothing near the rounded shape of the Enterprise, and the second, it was not a real proportional mouse, it emulated the joystick movement. Also at that time Enterprise Computing Ltd. was disappearing.
But the following years the user base in United Kingdom remained very active. Some little companies where founded by Enterprise enthusiasts. New products where offered, memory expansions, tailored cables, games, utilities, Spectrum emulator, IDE controller, Eprom, expansion motherboards, serial modems, etc.
The most prolific company was Boxsoft, founded by a developer named Tim Box. They offered most of the products I have listed, and bundled with a paint program named Paintbox they marketed an adapter with a Neos mouse and a driver included. The Neos, internally a MSX mouse, had already been successfully adapted to other 8-bit computers like the Commodore 64.
At that time only a few of 8-bit computers had a working mouse with some form of GUI. It was very difficult to sell something the user can't use widely nor even known... Seen from today's perspective it is very clear the advantage of a mouse when it doesn't work or is broken...
Only about a hundred of the Paintbox bundles where sold...
The Paintbox program arrived to Hungary separately. Hungarians bought the Enterprise computers knowing that they came from U.K., but not much more... and when all the Enterprises where sold the user base was abandoned like in the country of origin. Again new companies surfaced offering new products. At the other side of the Iron Curtain nobody know ever about the Neos mouse.Then a company named "A studio" begun to market the Boxsoft catalogue of products but masking them as their own and made in Hungary. One of the programs was a Paintbox version without the mouse option. It still needed the driver, but a capped version.
Later it was offered on Hungary a serial card expansion for the Enterprise, thanks to the genius of a Hungarian developers named Gyula Mészáros for the hardware, and to László Haluska (HSOFT) for the software. HSOFT took the capped "A studio" mouse driver and modified it to suit the serial interface with a Mouse Systems mouse, later bulit in driver to the EPDOS 2.x system.
This was old history, but in recent years with WWW, Internet and globalization, some of the old artefacts Boxsoft+Neos where found and all the pieces of the puzzle begun to fit.
A real proportional mouse fitted to an Enterprise could be possible at last, from the old promises on the adverts of Enterprise Computers Ltd.
The new Entermice interface that is presented here is based on the works of the Boxsoft team, but adapted to new times and added more new options. Is a miracle what Boxsoft achieved with only a few logical gates and diodes.
The principal problem interfacing is that the Enterprise connectors and signals are far from being a joystick-mouse standard. Little edge connectors that can be accidentally plugged upside down, commons pulled to +5v for the buttons when normally 0 volts was used, lack of protection of the return of the signal when two or more buttons are pressed, no way to send information or state to the controller, and surely something more I forget.
What they did with cheap components now has been redesigned and improved with two programmable chips and other modern details. One of the chips, a Xiling, is in charge of the pinout and signals conversion to the Atari standard of game connectors. The original Boxsoft only standardized the first controller port, that was used to connect the Neos mouse or a standard joystick, but not at the same time. On the present project two joystick ports have been provided and they don't interfere with the mouse port.
But the Neos mouse(MSX) is not widely found today so, a PS/2 to MSX conversion adapter has been implemented. It is made by a powerful 12Mhz Atmel AT89C4051 able to adapt itself to the frequency of the Z-80 processor installed on the Enterprise. With this chip and the proper coding it has, the Entermice can work the same on a 4Mhz EP than on a supercharged 10Mhz one.
General description
Important
Do not connect the interface to the computer when the power is on !
If your computer when you connect the interface does not start up properly or behaves abnormally, it must be switched off immediately !
Check whether the interface is connected correctly and try again.
Mouse and joystick can be connected and disconnected while the computer is power on, but this is not recommended. It is safer to perform any connection with the power disconnected.
Connecting to a computer
Interface board is connected to 3 edge connectors on the back of your Enterprise: Control 1, Control 2 and Serial.
It can be done only on one way, but it may happen that the contact pins do not centered on edge connectors and contact between them is not stable.
Then, the computer and/or the interface may not work properly.
Properly connected interface works right after turning on the power.
After running is performed self-test, during which both LEDs flashing 3 times (regardless of the state dip-switch 3).
Features
Interface can operate in several modes. To configure is used a five sectional dip-switch.
Configuration settings you can change during operation interface. You do not have to restart your computer.
Below is the description of all possible settings.
DS1 | DS2 | Work mode |
---|---|---|
ON | ON | EnterMice native mouse mode |
OFF | ON | BoxSoft compatible mouse mode |
OFF | OFF | EnterMice joystick mode (instead of Joystick 1) |
ON | OFF | not used (exactly EnterMice as joystick on KB K column) |
Joystick 2 always works the same regardless of the operating mode selected interface.
DS3 | LED status |
---|---|
OFF | LED status disabled |
ON | LED status enabled |
Joystick emulation mode configuration
DS4 | Sensitivity |
---|---|
OFF | Normal |
ON | High |
DS5 | Diagonal correction |
---|---|
OFF | Disable |
ON | Enable |
Diagonal correction improves the precision of simulation diagonal movements, at the expense of a slight decrease in speed.
Troubleshooting
Keyboard issue
During creating the EnterMice, accidentally we discovered a fairly serious error in the design of the Enterprise.
Totally do not mind, if nothing is connected to the ports Control 1 and Control 2.
However, that EnterMice uses them.
It's about interferences on KB0..KB9 ports from keyboard.
If at one time is pressed only one key, then there is nothing wrong with (first figure).
However, if you press two keys simultaneously in the same column, the signal from the selected line will be transferred also to the line of second key (figure two).
In the Enterprise missing diodes to separating the rows of the keyboard !
Electrically nothing will happen (inside LS145 decoder has open collector outputs), but causes errors when reading from the external ports Control 1 and Control 2.
In order to eliminate the cause should be add diodes to each row of keys the Enterprise, to press more than one key does not cause "collisions" (third figure).
I prepared a draft of the PCB-fixing, but has not been tested.
Microsoft Optical Mouse
MS Optical Mouse, in opposite to other mouses, works with EnterMice, but in its case, you can not use hot-plug feature.
After connecting the mouse to EnterMice during operation, you need momentarily short the RESET pin-header on the interface.
Technical specification
Joystick port pinout
pin | signal |
---|---|
1 | Up |
2 | Down |
3 | Left |
4 | Right |
5 | Fire 3 |
6 | Fire 1 |
7 | +5 V |
8 | GND |
9 | Fire 2 |
Control Map
J column (bit 0) | K column (bit 1) | L column (bit 2) | |||||
---|---|---|---|---|---|---|---|
JM=0 | JM=1 | JM=0 | JM=1 | JM=0 | JM=1 | ||
Control 1 | Row 0 Fire | Joy 1 Fire 1 | Mice Left Btn | Mice Left Btn or Joy 1 Fire 2* | Joy 1 Fire 2 | Mice Right Btn or Joy 1 Fire 3* | |
Row 1 Up | Joy 1 Up | Mice D0 | Mice D0 | spare | spare | spare | |
Row 2 Down | Joy 1 Down | Mice D1 | Mice D1 | spare | spare | spare | |
Row 3 Left | Joy 1 Left | Mice D2 | Mice D2 | spare | spare | spare | |
Row 4 Right | Joy 1 Right | Mice D3 | Mice D3 | spare | spare | spare | |
Control 2 | Row 5 Fire | Joy 2 Fire 1 | Joy 2 Fire 2 | Joy 2 Fire 3 | |||
Row 6 Up | Joy 2 Up | spare | spare | spare | spare | ||
Row 7 Down | Joy 2 Down | spare | spare | spare | spare | ||
Row 8 Left | Joy 2 Left | spare | spare | spare | spare | ||
Row 9 Right | Joy 2 Right | spare | spare | spare | spare |
* Mouse buttons have higher priority
Sega twister
pin | Select = Low | Select = High | Select = pulse-3 |
---|---|---|---|
1 | Up | Up | Button Z |
2 | Down | Down | Button Y |
3 | GND | Left | Button X |
4 | GND | Right | not used |
5 | +5V | ||
6 | Button A | Button B | not used |
7 | Select | ||
8 | GND | ||
9 | Start | Button C | not used |
Information for developers
Mouse reading
; Here begin the Neos mouse reading | ||
ld hl,X_REL | ; first byte | |
ld a,2 | ; RTS low | |
out (0B7h),a | ||
ld b,8 | ; long delay | |
call WAIT | ||
call READ_4BIT | ; read four higher bits | |
rld | ; push them in (HL) | |
xor a | ; RTS high | |
out (0B7h),a | ||
ld b,5 | ; short delay | |
call WAIT | ||
call READ_4BIT | ; read four lower bits | |
rld | ; push them in (HL) | |
ld hl,Y_REL | ; second byte | |
ld a,2 | ; RTS low | |
out (0B7h),a | ||
ld b,5 | ; short delay | |
call WAIT | ||
call READ_4BIT | ; read four higher bits | |
rld | ; push them in (HL) | |
xor a | ; RTS high | |
out (0B7h),a | ||
ld b,5 | ; short delay | |
call WAIT | ||
call READ_4BIT | ; read four lower bits | |
rld | ; push them in (HL) | |
;<======Here will be added the future Wheel and three spare buttons reading. SECOND TENTATIVE | ||
ld hl,SW_Z_STATUS | ||
ld a,2 | ; RTS low | |
out (0B7h),a | ||
ld b,5 | ; short delay | |
call WAIT | ||
call READ_4BIT | ; read four higher bits | |
and 15 | ||
cp 1 | ; IF THIS NIBBLE=0001 THEN THE MOUSE IS IN EXTENDED PROTOCOL | |
jr z,CONTINUE_READ | ||
xor a | ; RTS high | |
out (0B7h),a | ;IGNORE THAT NIBBLE | |
ld (hl),0 | ; we don't need old values | |
jr STOP_READ | ||
CONTINUE_READ: | ||
xor a | ; RTS high | |
out (0B7h),a | ||
ld b,5 | ; short delay | |
call WAIT | ||
call READ_4BIT | ; read four higher bits, the three lower bits are the buttons. They come ready to store | |
push af | ; push them in stack. they are in the lower nibble. | |
ld a,(hl) | ; | |
push af | ;save the Z counter for later. | |
ld a,2 | ; RTS low | |
out (0B7h),a | ||
ld b,5 | ; short delay | |
call WAIT | ||
call READ_4BIT | ; read four bits | |
rld | ;we need z displacement in 8 bit | |
xor a | ; RTS high | |
out (0B7h),a | ||
ld b,5 | ; short delay | |
call WAIT | ||
call READ_4BIT | ; read four lower bits. Z displacement | |
rld | ; push them in (HL) ;NOW WE HAVE Z displacement in (hl) | |
pop af | ; restored Z counter to "a", but we have garbage on high nibble | |
and 00Fh | ||
bit 3,a | ||
jr z,SIGN_DONE | ||
or 0F0h | ||
SIGN_DONE: | ; now we have the sign extended to 8 bits on "a" | |
add a,(hl) | ||
cp 128 | ; positive or negative? | |
jr c,POSITIVE | ||
cp 248 | ; lower than -8? | |
jr nc,FINISHED | ; | |
ld a,248 | ; -8 is the bottom | |
jr FINISHED | ||
POSITIVE: | ||
cp 8 | ; higher than 7? | |
jr c,FINISHED | ||
ld a,7 | ; 7 is the top | |
FINISHED: | ; the excess of 7 or -8 has been wiped | |
ld c,a | ; save Z addition on c | |
pop af | ; retrieve the buttons status. They are now on first nibble of a | |
rld | ; buttons stored | |
ld a,c | ; we only need the first nibble of Z counter addition | |
rld | ; the spare buttons status and the Z counter are now in SW_Z_STATUS | |
STOP_READ: | ||
xor a | ; recall buttons on row 0 | |
out (0B5h),a | ||
in a,(0B6h) | ; read Mouse buttons | |
and 7 | ; mask | |
xor 7 | ; flip them all as on Enterprise a pressed key is 1 and released 0 | |
rl (hl) | ; Get ready the bit 7 of "hl" register pair. Inside is SW_Z_STATUS, variable number 190 | |
srl a | ; This is the very FIRST "srl a". The button status is now in the carry flag | |
; secondary button of Boxsoft is read on J column. Primary button of Entermice is read on K column | ||
push af | ||
ld a,(INPUT_DEVICE) | ||
cp 3 | ; Boxsoft interface mode buttons | |
jr nz,L_BUTTON | ||
pop af | ; We need the value of "a" and "f" registers. Carry flag still stores the value of secondary button | |
rr (hl) | ; secondary button goes to bit 7 of SW_Z_STATUS, variable number 190 | |
srl a | ; Primary button of Boxsoft is on J column. This is the second "srl a" | |
JR MAIN_BUTTON | ||
L_BUTTON: | ; Entermice interface mode buttons | |
pop af | ; retrieve the value of register "a". "f" is disposable, soon we will load the button on carry flag | |
push af | ; I still will need later the register "a" value | |
srl a | ; two "srl a" because the secondary button of Entermice is read on L column | |
srl a | ; the proper button status is now in the carry flag | |
rr (hl) | ; secondary button goes to bit 7 of SW_Z_STATUS, variable number 190 | |
pop af | ; retrieve the value of register "a" just after the FIRST "srl a" | |
MAIN_BUTTON: | ||
and 1 | ||
ld (FIRE_STATUS),a | ; EXOS Variable 188. K column if Boxsoft or L column if Entermice | |
call sub_C3A6 | ; this is the "corrections and drawing" routine where the "velocity" 1.1 modification was made | |
ld a,(X_REL) | ||
ld c,a | ||
ld a,(Y_REL) | ||
or c | ||
ret | ||
WAIT: | ||
nop | ||
nop | ||
nop | ||
dec b | ||
jr nz,WAIT | ||
ret | ||
READ_4BIT: | ; I split the routine in two to not put more processor time | |
ld b,4 | ||
ld d,0 | ||
ld a,(INPUT_DEVICE) | ||
cp 3 | ||
jr z,L_COLUMN | ||
K_COLUMN: | ||
ld a,b | ||
;inc c | ; this is not necessary | |
out (0B5h),a | ||
in a,(0B6h) | ||
;ld c,a | ; this is not necessary | |
rra | ; data read from K column | |
rra | ||
rl d | ||
djnz K_COLUMN | ||
jr CONTINUE | ||
L_COLUMN: | ||
ld a,b | ||
;inc c | ; this is not necessary | |
out (0B5h),a | ||
in a,(0B6h) | ||
;ld c,a | ; this is not necessary | |
rra | ; data read from L column | |
rl d | ||
djnz L_COLUMN | ||
CONTINUE: | ||
ld a,d | ||
ret |