Welcome, Guest. Please login or register.


Author Topic: EnterMice (Joy & PS/2 mouse interface) (Read 177111 times)

Offline pear

  • EP lover
  • *
  • Posts: 825
  • Country: pl
  • Z80 only
    • Támogató Támogató
Re: EnterMice (Joy & PS/2 mouse interface)
« Reply #225 on: 2015.October.06. 18:35:54 »
The first test failed :(
I do not know yet, what I'm doing wrong.
The mouse pointer "escapes" to the top-left corner of the screen.

In the Arduino source I seen that are not sent the delta values, only after each mouse reading is summed delta and send the sum.
I was a little confused.

Offline gflorez

  • EP addict
  • *
  • Posts: 3607
  • Country: es
    • Támogató Támogató
Re: EnterMice (Joy & PS/2 mouse interface)
« Reply #226 on: 2015.October.06. 18:51:27 »
I can say you about the problems I had adapting the Arduino project to the Enterprise.

It uses an input-output register for the seven signals(four directions+two physical buttons+strobe). Then, after every host reading the MCU must mask the output lines. If not, the mouse pointer goes up-left because the host reads data of the last reading.

But congratulations, it means that the Enterprise is reading something. The pointer goes to the opposite when no mouse connected...

Offline gflorez

  • EP addict
  • *
  • Posts: 3607
  • Country: es
    • Támogató Támogató
Re: EnterMice (Joy & PS/2 mouse interface)
« Reply #227 on: 2015.October.06. 19:11:32 »
The Arduino script is very well made(even if the author says otherwise). Don't mess up with delta or other variables. Your problem has to be the reading phase.

At the end I 've only changed the polarity of the signals on the script and all begin to work.

Offline pear

  • EP lover
  • *
  • Posts: 825
  • Country: pl
  • Z80 only
    • Támogató Támogató
Re: EnterMice (Joy & PS/2 mouse interface)
« Reply #228 on: 2015.October.06. 19:17:52 »
I think, I know. All the data bits are negated!
But it's I'll check tomorrow.

Offline pear

  • EP lover
  • *
  • Posts: 825
  • Country: pl
  • Z80 only
    • Támogató Támogató
Re: EnterMice (Joy & PS/2 mouse interface)
« Reply #229 on: 2015.October.06. 21:10:15 »
If further tests come out better than today, and I counted correctly, it should EnterMice in the current configuration to work correctly even with the EP CPU clocked at 10 MHz. Measurements and calculations came out to me that reading occurs after 26 us, and interrupt service until set the data I managed to fit in 23 us (MCU clocked at 12MHz).
Code: ASM
  1. ;*** MSX service ***************************************************************
  2.                                         ; tacts limit 56 @12MHz (112 @24MHz)
  3.                                         ; data exhibit before 26 (52) tacts
  4.                                         ; tacts used
  5. msxservice:                             ; +2  wait for int
  6.         HDW_INT_START   1               ; +6  using set #1 of GPR
  7.         mov     a,r0                    ; +1    
  8.         clr     c                       ; +1
  9.         rrc     a                       ; +1  count msxData ptr
  10.         orl     a,#msxData              ; +1
  11.         mov     a,@r0                   ; +1  load msxData
  12.         jnc     msx_set                 ; +2  if odd
  13.         swap    a                       ; +1  then swap nibble
  14. msx_set:
  15.         anl     a,#0F0h                 ; +1  leave high nibble
  16.         xrl     a,#0F0h                 ; +1  inverting bits
  17.         mov     r7,a                    ; +1
  18.         mov     a,outBuff               ; +1
  19.         anl     a,#00Fh                 ; +1  reset msxD0..msxD3
  20.         orl     a,r7                    ; +1  store data
  21.         mov     outPort,a               ; +1  exhibit data  @23 tacts :)
  22.         mov     outBuff,a               ; +1
  23.         inc     r0                      ; +1
  24.         TMR_START       msxComTout      ; +6
  25.         HDW_INT_END                     ; +6 = 37

Offline pear

  • EP lover
  • *
  • Posts: 825
  • Country: pl
  • Z80 only
    • Támogató Támogató
Re: EnterMice (Joy & PS/2 mouse interface)
« Reply #230 on: 2015.October.06. 21:22:42 »
I stare at the code, and I just found a stupid mistake in the 11th line :)

Offline gflorez

  • EP addict
  • *
  • Posts: 3607
  • Country: es
    • Támogató Támogató
Re: EnterMice (Joy & PS/2 mouse interface)
« Reply #231 on: 2015.October.06. 22:43:29 »
On the Arduino script I modified that lines:


void sendMSX(char c)
// Optimized for Atmel328
// NOTE: Fixed pins!
{
while (digitalRead(JoyPin8)==LOW) {if (millis()>time) return;};
DDRD = ((DDRD & 195)|((~ (c>>2)) & 60));
while (digitalRead(JoyPin8)==HIGH) {if (millis()>time) return;};
DDRD = ((DDRD & 195)|((~ (c<<2)) & 60));
}

To:


void sendMSX(char c)
// Optimized for Atmel328
// NOTE: Fixed pins!
{
while (digitalRead(JoyPin8)==HIGH) {if (millis()>time) return;};
DDRD = ((DDRD & 195)|((~ (c>>2)) & 60));
while (digitalRead(JoyPin8)==LOW) {if (millis()>time) return;};
DDRD = ((DDRD & 195)|((~ (c<<2)) & 60));
}


And:

void JoyHigh()
// Optimized for Atmel328
// NOTE: Fixed pins!
{
     DDRD=(DDRD | 195);
}

To:

void JoyHigh()
// Optimized for Atmel328
// NOTE: Fixed pins!
{
     DDRD=(DDRD | 0xC3);
}

And it started to work properly.
« Last Edit: 2015.October.06. 22:47:50 by gflorez »

Offline pear

  • EP lover
  • *
  • Posts: 825
  • Country: pl
  • Z80 only
    • Támogató Támogató
Re: EnterMice (Joy & PS/2 mouse interface)
« Reply #232 on: 2015.October.07. 20:17:49 »
Today was much better :)
Tested with the original driver MOUSE.XR (not yet modified) in BoxSoft compatible mode.
Data bits are not inverted. There was only one mistake in the interrupt service :)
There are a few trinkets to refine.

The mouse can be disconnected during operation without shutting down the computer.
After reconnecting is ready for operation within approx. 2 seconds :)
You can also connect another mouse, and its type will be identified  (with the wheel or not).

Remained also to do a joystick mode. I still have to think about how he will exactly work, but compared to what already I did this little thing :)

All the PCBs already assembled. I have yet to mount edge connectors.
I also found and corrected a minor error in the PLD logic.

Offline Z80System

  • EP addict
  • *
  • Posts: 3848
  • Country: hu
Re: EnterMice (Joy & PS/2 mouse interface)
« Reply #233 on: 2015.October.07. 21:09:48 »
I like this kind of pictures.
Z80 System

Offline gflorez

  • EP addict
  • *
  • Posts: 3607
  • Country: es
    • Támogató Támogató
Re: EnterMice (Joy & PS/2 mouse interface)
« Reply #234 on: 2015.October.07. 22:52:05 »
I like too. I've been talking two years about mice and interfaces without a "video-proof". I should have done long ago one about my works....

Is a good trick that the Entermice can rearm the mouse like USB does. I remember resetting the PC as, if the PS/2 connector was moved,  you had to shut-off  and re-start the computer to have again a working mouse.

To watch the pointer moving on a different Enterprise than mine shakes something inside me....
« Last Edit: 2015.October.08. 08:45:03 by gflorez »

Offline Z80System

  • EP addict
  • *
  • Posts: 3848
  • Country: hu
Re: EnterMice (Joy & PS/2 mouse interface)
« Reply #235 on: 2015.October.08. 16:48:47 »
Quote
The mouse can be disconnected during operation without shutting down the computer.
After reconnecting is ready for operation within approx. 2 seconds :)
You can also connect another mouse, and its type will be identified  (with the wheel or not).

It is too nice to be true ... :)
Z80 System

Offline pear

  • EP lover
  • *
  • Posts: 825
  • Country: pl
  • Z80 only
    • Támogató Támogató
Re: EnterMice (Joy & PS/2 mouse interface)
« Reply #236 on: 2015.October.08. 20:06:36 »
I made a joystick emulation mode service on the model of Arduino code.
On the emulator it looks good.
Resolution (actually sensitivity) is set on dipswitch.
Today, I no longer have time to check the code on the target device.

Offline Zozosoft

  • Global Moderator
  • EP addict
  • *
  • Posts: 14723
  • Country: hu
    • http://enterprise.iko.hu/
Re: EnterMice (Joy & PS/2 mouse interface)
« Reply #237 on: 2015.October.09. 11:06:20 »
Some tips for sensitivy testing:
-Simcity, it is with the original Neos joy mode litle slow, need higher sensitivy setting
-Krakout, it is great with the original Neos. More better playing than the real joy!

Offline gflorez

  • EP addict
  • *
  • Posts: 3607
  • Country: es
    • Támogató Támogató
Re: EnterMice (Joy & PS/2 mouse interface)
« Reply #238 on: 2015.October.09. 13:21:39 »
I think, better put him the links as he may not know where to look for the games.

His time is precious for us...
« Last Edit: 2015.October.09. 14:13:43 by gflorez »

Offline pear

  • EP lover
  • *
  • Posts: 825
  • Country: pl
  • Z80 only
    • Támogató Támogató
Re: EnterMice (Joy & PS/2 mouse interface)
« Reply #239 on: 2015.October.09. 14:37:57 »
I have a better idea. I'll send to Zozo ready EnterMice for test and checks itself :)
I have the second tester. Do you agree Zozo ?