Welcome, Guest. Please login or register.


Author Topic: Universal Mouse Driver (Read 21519 times)

Online gflorez

  • EP addict
  • *
  • Posts: 2380
  • Country: es
  • OS:
  • Windows XP Windows XP
  • Browser:
  • Firefox 43.0 Firefox 43.0
    • View Profile
Re: Universal Mouse Driver
« Reply #75 on: 2016.February.01. 00:54:09 »
I've found a slightly "harmful" error on the driver:

-My Basic program opens a GRAPHICS LORES mode screen. It defaults to channel #101.

-Then it opens a Mouse channel to that screen. The mouse pointer appears...

-I press the STOP key and the Basic program stops but the mouse driver continues working.

-I type TEXT. The  101 channel disappears but the mouse driver continues drawing the pointer on what it thinks is still the graphics screen....

If I move the mouse enough(or the internal joystick in this case) it will produce an error on the EDITOR buffer...., or worse...
« Last Edit: 2016.February.01. 10:02:35 by gflorez »

Online gflorez

  • EP addict
  • *
  • Posts: 2380
  • Country: es
  • OS:
  • Unknown Unknown
  • Browser:
  • Firefox 44.0 Firefox 44.0
    • View Profile
Re: Universal Mouse Driver
« Reply #76 on: 2016.February.01. 01:30:43 »
The problem here is that the Mouse driver only checks the Video channel just at the openning of the Mouse channel, but no further checking is done until the Mouse channel is closed.

The graphics screen can even change its dimensions and the Mouse driver will not be aware of it.

I think, at least the existence of the video channel must be checked from time to time. I have to mark this on the "TODO" list.

Online gflorez

  • EP addict
  • *
  • Posts: 2380
  • Country: es
  • OS:
  • Windows XP Windows XP
  • Browser:
  • Firefox 43.0 Firefox 43.0
    • View Profile
Re: Universal Mouse Driver
« Reply #77 on: 2016.February.01. 11:18:40 »
Courtesy of Nick Milner, the gentleman that brought us the EGI from the distant past, some examples of the use of the Mouse driver in Basic.

They are on the disk 2 of his five disks, WIMPS directory:

MS_TEST.BAS is the example described on the Boxsoft manual.

ICON1.BAS, ICON2.BAS, ICON3.BAS, ICON4.BAS and ICON5.BAS are stages of a work in process program that nick was writing... They give a good idea of what can be achieved with a simple basic program, clicking on icon zones.


Online gflorez

  • EP addict
  • *
  • Posts: 2380
  • Country: es
  • OS:
  • Windows XP Windows XP
  • Browser:
  • Firefox 43.0 Firefox 43.0
    • View Profile
Re: Universal Mouse Driver
« Reply #78 on: 2016.February.02. 01:08:15 »
I'm sorry if someone gets bored while I am thinking aloud....

Following with the plan on how to auto-detecting a controller, a single byte counter can serve to know how much time the mouse has been idle. If the movement received is (0, 0 ) the counter is incremented, if not it will be put to zero.

Then, if a count of, for example, five seconds(250) is reached, the video channel is checked if still open. If yes, an auto-detection routine is triggered if the controller type on System var 189 is set to automatic. Return to the main routine.

If the video channel is found closed, then the mouse channel is also closed.

Edit: Five seconds? better if the limit is the result of experimentation, but I think that  only a second can be enough.
« Last Edit: 2016.February.02. 09:53:22 by gflorez »

Online gflorez

  • EP addict
  • *
  • Posts: 2380
  • Country: es
  • OS:
  • Windows XP Windows XP
  • Browser:
  • Firefox 43.0 Firefox 43.0
    • View Profile
Re: Universal Mouse Driver
« Reply #79 on: 2016.February.03. 12:42:07 »
Another version......


I have corrected the PaintBox error introduced two versions ago....

Now the driver reacts to a :PB command only if the MOUSE device is not linked, the same as if an initialisation code(8 ) is received. This is the best of the old driver and the new one. All programs work.

The exit codes of the :PB command are left like in the original Mouse driver, C=0 and A=(in a, (0B3h)). It works....

Here begins a new numeration of the driver's version, starting at 1.100.

Edit: Wiki links updated.
« Last Edit: 2016.February.03. 16:31:15 by gflorez »

Online gflorez

  • EP addict
  • *
  • Posts: 2380
  • Country: es
  • OS:
  • Windows 7/Server 2008 R2 Windows 7/Server 2008 R2
  • Browser:
  • Firefox 44.0 Firefox 44.0
    • View Profile
Re: Universal Mouse Driver
« Reply #80 on: 2016.February.03. 23:25:18 »
Here is a boring video I've made with the emulator about using the Mousedriver in Basic, EGI and PaintBox.

Offline geco

  • EP addict
  • *
  • Posts: 5088
  • Country: hu
  • OS:
  • Linux Linux
  • Browser:
  • Firefox 38.0 Firefox 38.0
    • View Profile
Re: Universal Mouse Driver
« Reply #81 on: 2016.February.04. 08:47:36 »
Cool :)

Online gflorez

  • EP addict
  • *
  • Posts: 2380
  • Country: es
  • OS:
  • Windows XP Windows XP
  • Browser:
  • Firefox 43.0 Firefox 43.0
    • View Profile
Re: Universal Mouse Driver
« Reply #82 on: 2016.February.05. 12:09:47 »
Ron, a friend from Retrowiki(Spain) has put the video demonstration on Youtube.

Edit: A shortened version.
« Last Edit: 2016.February.08. 09:45:32 by gflorez »

Online gflorez

  • EP addict
  • *
  • Posts: 2380
  • Country: es
  • OS:
  • Windows 7/Server 2008 R2 Windows 7/Server 2008 R2
  • Browser:
  • Firefox 44.0 Firefox 44.0
    • View Profile
Re: Universal Mouse Driver
« Reply #83 on: 2016.February.08. 01:25:24 »
How can I know if the video channel is closed within the interrupt call of the mouse device. EXOS doesn't admit calls when executing the interrupt call. I've tried call 9(read channel status) or 11(b=3 Special function= Video page addess) but both return always FEh(EXOS Function call not allowed)

Is there a list of opened channels that I can read and test easily on memory?

Online gflorez

  • EP addict
  • *
  • Posts: 2380
  • Country: es
  • OS:
  • Windows XP Windows XP
  • Browser:
  • Firefox 44.0 Firefox 44.0
    • View Profile
Re: Universal Mouse Driver
« Reply #84 on: 2016.February.24. 12:02:57 »
OK, I can't test if the associated video page has been modified or closed. I will return to this problem if sometime the driver is put on Rom.

-------------------------------------------------


Now, just to clarify my mind, I will present here the logic I pretend for Autodetect mode(sys var 189=7) on the mouse driver.

Checking only for the presence or not of a controller is very difficult, as the controllers can be  digital joysticks, MSX protocol or serial protocol. The presence can be more or less detected only on some of them, MSX and serial, but not on the joysticks.

Then I have though that the easiest way to switch between controllers is to search for activity on the different ports, just when the user stops the active controller and begins to move other.

But in order to use this method, first I need to know if a serial card is present, then, if a mouse is connected, its protocol, Mouse Systems or Microsoft. This can be figured out just at the initialisation of the serial card, so no problem here.

Is a fact that all Enterprises have an internal joystick..., is the only controller that is always connected, so it will be the default state. Priority is EnterMice(4 ), Boxsoft(3 ), Mouse Systems(5 ), Microsoft(6 ),  Joystick 1(1 ), joystick2 (2 ) and Internal Joy(0 ). The first found activity makes it the active controller.

The Autodectect routine can be as this:

-At first the active controller is the internal joystick(0 ).

-Normal mouse reading loop.

-After 50 mouse readings(1 minute ) of the active controller without movement the auto-detection routine is triggered.

-Read columns J and K, rows 1 to 4, on the controllers ports and check for activity.

           -Is there activity on column K? If yes, make EnterMice the active controller and return to Normal mouse reading loop.

           -Is there activity on column J? If yes, check for impossible movements. If found, make Boxsoft the active controller and return to the reading loop.

-If there is a serial mouse we already know what protocol it has so, if there is activity make it the active controller and return to the reading loop.

-read column J rows 1 to 4 and 6 to 9 on the controllers ports and check for activity.

           -Is there activity on rows 1 to 4? If yes, make Joystick 1 the active controller and return to the reading loop.

           -Is there activity on rows 6 to 9? If yes, make Joystick 2 the active controller and return to the reading loop.

-Make the internal Joystick the active controller and return to the reading loop.
« Last Edit: 2016.February.24. 12:22:02 by gflorez »

Online gflorez

  • EP addict
  • *
  • Posts: 2380
  • Country: es
  • OS:
  • Windows XP Windows XP
  • Browser:
  • Firefox 44.0 Firefox 44.0
    • View Profile
Re: Universal Mouse Driver
« Reply #85 on: 2016.February.24. 16:51:34 »
Now we have to consider, do we need Joy1 and Joy2 to take part on the mouse auto-detection?

I think that the external joystick ports have to be saved to only play games. They where planed for it, and are used on the vast majority of games, even z80 conversions. They could still be forced to control the mouse pointer if 1 or 2  is selected on sys var 189.

And, what about the Boxsoft mode? I think of it as an aberration... now that finally EnterMice exist...  Tim Box already knew the existence and potential use of the K and L commons on the control connectors. But even so he insisted on using the J common, which from the Enterprise conception was assigned to and used for the external joysticks . The use of the Boxsoft mode collides with programs that expect  joystick movement instead of the extrange data that a mouse gives. Prodatron has announced EnterMice compatibility for the next version of SymbOS, the only program that still needs the Boxsoft mode. That day will be the beginning of the end for the Boxsoft mode... Of course it still could be forced with the system variable 189.
« Last Edit: 2016.February.24. 17:18:58 by gflorez »

Online gflorez

  • EP addict
  • *
  • Posts: 2380
  • Country: es
  • OS:
  • Windows XP Windows XP
  • Browser:
  • Firefox 44.0 Firefox 44.0
    • View Profile
Re: Universal Mouse Driver
« Reply #86 on: 2016.February.25. 23:38:26 »
Why Boxsoft+Neos is  so incompatible with some programs?   Is EnterMice as incompatible as Boxsoft?

I mean, the normal value when we type PRINT JOY(1) in Basic is 31, or "000 1 1 1 1 1", if the stick is in the middle position or not connected.

I can't test it in this moment, but I am sure the Neos returns 0 or "00000000" when it doesn't receive /strobe signals, but I'm not totally sure if EnterMice(in Boxsoft mode) gives the same.

This is an important aspect, because "1 1 1 1"(UpDownLeftRight) is a possible but infrequent value  if read from the Neos or EnteMice, so it can be used to know if an interface+mouse is not present. Then it can be discriminated. Also it can serve to know if the Joystick  1 is inactive.

 "0000"(UpDownLeftRight) is an impossible movement if returned from the joystick port, so it can serve to know that a mouse device is present but motionless. No joystick 1 is connected.

There are about other 6 impossible combinations that can serve to discriminate a moving mouse, but  Is a pity that some values can still be possible for both the Boxsoft and Joystick 1 modes.

Offline Zozosoft

  • EP addict
  • *
  • Posts: 13081
  • Country: hu
  • OS:
  • Windows 7/Server 2008 R2 Windows 7/Server 2008 R2
  • Browser:
  • Firefox 44.0 Firefox 44.0
    • View Profile
    • http://enterprise.iko.hu/
Re: Universal Mouse Driver
« Reply #87 on: 2016.February.26. 07:43:01 »
The default JOY(1) value are 0.
It is also true for Boxsoft (at power on), until the mouse button first time pressed. When pressing mouse button, then send random data (without strobe!), most of times value 15. If mouse moved and button pressed again then value changed.

EnterMice don't send random data without strobe.

Offline pear

  • EP lover
  • *
  • Posts: 689
  • Country: pl
  • Z80 only
  • OS:
  • Windows 7/Server 2008 R2 Windows 7/Server 2008 R2
  • Browser:
  • Firefox 44.0 Firefox 44.0
    • View Profile
Re: Universal Mouse Driver
« Reply #88 on: 2016.February.26. 08:10:28 »
A small imcompatibility, but it's probably okay ?
This eliminates the need to remove the mouse when you want to use the joystick.

Offline Zozosoft

  • EP addict
  • *
  • Posts: 13081
  • Country: hu
  • OS:
  • Windows XP Windows XP
  • Browser:
  • Firefox 44.0 Firefox 44.0
    • View Profile
    • http://enterprise.iko.hu/
Re: Universal Mouse Driver
« Reply #89 on: 2016.February.26. 09:03:22 »
A small imcompatibility, but it's probably okay ?
Yes, this solution are better!