Welcome, Guest. Please login or register.


Author Topic: Universal Mouse Driver (Read 21524 times)

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 #90 on: 2016.February.26. 09:05:24 »
Not a great problem, but It convices me even more to not include Boxsoft on the autodetect routine. It is not a fault on the EnterMice side, but a virtue, as it wouldn't collide with some programs when in Boxsoft mode.....

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 #91 on: 2016.February.26. 10:46:09 »
The default JOY(1) value is 0.

Yes, of course it is. Only that I was playing with the mouse eulation of XEP128, that works different from Boxsoft and EnterMice.

Online gflorez

  • EP addict
  • *
  • Posts: 2380
  • Country: es
  • OS:
  • Windows 7/Server 2008 R2 Windows 7/Server 2008 R2
  • Browser:
  • Firefox 47.0 Firefox 47.0
    • View Profile
Re: Universal Mouse Driver
« Reply #92 on: 2016.July.27. 02:34:09 »
I'm still intrigued on implementing mouse on graphics modes 0 and 2.

I have almost figured out how, but there are little details that prevents me to complete it.


Static pages aren't the problem, it is very easy to make work the mouse driver on a page that has a static LPT. The driver does perfectly on graphics modes only with EXOS calls(@@SIZE and @@ADDR). Text modes can be even more easy, as we only will move the mouse pointer between character boundaries.

The future TEXT 40 mouse mode will have a single defined font character, the same on the 80 mode, with some form of pointer. But to make tests easier, on the first attempts I will use the 255 ASCII(that strange "b" character) on TEXT 40, and a blue underline(also 255) on TEXT 80 mode.

But I also want mouse control on the Editor pages, where the LPT lines can be strangely mixed.

For example, on "normal" Basic Editor pages, TEXT 40 or 80, we have fixed sizes of 40x24 0r 80x24. The mouse driver maintains its X and Y own coordinates, and the LPT can serve to know what character is on the coordinates.

This is the procedure:


-The Enterprise is loaded with a program that makes use of the internal Editor.

-The interrupt routine halts the main program and makes a call to the mouse interrupt routine.

-If there is already a mouse pointer drawn, it is erased. For that, the driver maintains stored the original character that was on the old coordinates. But the Editor could have altered the position of that line on the LPT, so the old address and segment was stored on the last interrupt cycle.

-The LPT is used to know the actual value inside the coordinates.

-The actual value inside the current coordinates is stored, with the exact NICK position, segment+address. A 255 is stored on that position.

-The control is returned to the main program.

This procedure can work, but I want to extend it to all possible editor modes, the four editor lines that remain when a GRAPHICS mode is recalled, the EXDOS or ISDOS editors, or even other languages editors, including of course the WP editor.

I want to call the mouse driver from an editor and it start automatically without the need to open the mouse channel. Only typing :MOUSE ON or :MOUSE OFF, for example.

But an Editor page can have variable size and position on the LPT, and I don't know if there is an easy way to know it.


 

 

Online gflorez

  • EP addict
  • *
  • Posts: 2380
  • Country: es
  • OS:
  • Windows 7/Server 2008 R2 Windows 7/Server 2008 R2
  • Browser:
  • Firefox 47.0 Firefox 47.0
    • View Profile
Re: Universal Mouse Driver
« Reply #93 on: 2016.July.27. 02:55:14 »
Another problem will follow eventually once the mouse text modes would be implemented, the use of the mouse buttons.

For example, the right button can serve to change the editor cursor to the mouse pointer coordinates, while the left one can act like the Enter key. Even the wheel can be used to scroll the editor page.


But....., within an interrupt call, writing to a channel is forbidden, so the keyboard buffer must be accessed directly to put there the scape sequences or the "0Dh" character. 

How can it be done?

Online gflorez

  • EP addict
  • *
  • Posts: 2380
  • Country: es
  • OS:
  • Windows XP Windows XP
  • Browser:
  • Firefox 47.0 Firefox 47.0
    • View Profile
Re: Universal Mouse Driver
« Reply #94 on: 2016.July.28. 20:07:19 »
Let's think on an hypothetical example:

The mouse driver tries to know all parameter of the text page to move there a pointer.

It is not in interrupt mode, so it can call EXOS to check the Editor system var 29, VID_EDIT, to know the channel of the text video page where the Editor is working(more dirty directly on address BFE2h).

Next it call the Special functions @@ADDR and @@SIZE.

But it doesn't know where on the LPT is the video page....(It is necessary for the implementation I am figuring out)

Should it check all the LPT lines for their memory address?

Offline geco

  • EP addict
  • *
  • Posts: 5088
  • Country: hu
  • OS:
  • Linux / Sony Ericsson SK17iv Linux / Sony Ericsson SK17iv
  • Browser:
  • Safari 4.0 Safari 4.0
    • View Profile
Re: Universal Mouse Driver
« Reply #95 on: 2016.July.28. 21:39:28 »
I think, yes, I know only this method. If Zozo does not know a better one...

Online gflorez

  • EP addict
  • *
  • Posts: 2380
  • Country: es
  • OS:
  • Windows 7/Server 2008 R2 Windows 7/Server 2008 R2
  • Browser:
  • Firefox 47.0 Firefox 47.0
    • View Profile
Re: Universal Mouse Driver
« Reply #96 on: 2016.July.28. 23:16:50 »
OK, thanks. It seems to me not very difficult to check the lines.


Online gflorez

  • EP addict
  • *
  • Posts: 2380
  • Country: es
  • OS:
  • Windows 7/Server 2008 R2 Windows 7/Server 2008 R2
  • Browser:
  • Firefox 47.0 Firefox 47.0
    • View Profile
Re: Universal Mouse Driver
« Reply #97 on: 2016.August.03. 21:34:25 »
Thinking about checking the addresses on the LPT for the text modes, I have discovered a way to test if a graphics channel has been modified, and then proceed to close a Mouse channel associated to it.

The  @@ADDR special call returns the display Ram address of the video channel.

I think it is a mater of searching and storing the LPT line that holds that value and compare it often, every second.

Of course this only serves for static video channels, not for Editor video channels.

This is advised on the EXOS video driver specification on page 5 chapter 3:

Online gflorez

  • EP addict
  • *
  • Posts: 2380
  • Country: es
  • OS:
  • Windows 7/Server 2008 R2 Windows 7/Server 2008 R2
  • Browser:
  • Firefox 47.0 Firefox 47.0
    • View Profile
Re: Universal Mouse Driver
« Reply #98 on: 2016.August.07. 21:47:33 »
I am slowly progressing.

Now, every time a mouse channel is opened, the driver checks on the associated video page the LPT line where it is first displayed. If found, also the 16 bytes of that LPT line are stored for future comparisons to check changes on the video channel. I have tested Paintbox, that alternates two mouse-video channels, and the process doesn't make any noticeable slowdown

Video pages with first line not displayed are rejected.

Limitation to only graphic pages has been removed, but I am still on an early stage implementing the mouse text modes on Machine Code.

Editor modes, hard/soft text, will be managed slightly different, as its first video page line can be or not the first LPT line shown. An account of shown  channel lines has to be made to know the first LPT line on display, before working on them. Discrimination of Editor video channels can be made with the system var no. 29, VID_EDIT.

Offline lgb

  • EP addict
  • *
  • Posts: 3494
  • Country: hu
  • æðsta yfirmaður
  • OS:
  • Linux (Ubuntu) Linux (Ubuntu)
  • Browser:
  • Firefox 48.0 Firefox 48.0
    • View Profile
    • http://lgb.hu/
Re: Universal Mouse Driver
« Reply #99 on: 2016.August.08. 01:30:31 »
I admire your willpower with an universal mouse driver, to be honest :) I think, somehow, it should be part of the "base" system, ie EPs usually should :) have VIDEO: and KEYBOARD: driver to be really useful for anything :) After reading your posts here over the time, I am more and more sure, that the bulk of the problem would be lowered with tighter integration of mouse driver with these "main" stuffs. However it should require an EXOS with built-in mouse driver for example :D Maybe Zozo would consider it later? :) Anyway I like the idea of universal mouse driver, to be honest, I wouldn't have the idea to turn this as this universal stuff as you would like to do ... I don't mean it's a bad thing, but the opposite!!!! :)

Online gflorez

  • EP addict
  • *
  • Posts: 2380
  • Country: es
  • OS:
  • Windows 7/Server 2008 R2 Windows 7/Server 2008 R2
  • Browser:
  • Firefox 47.0 Firefox 47.0
    • View Profile
Re: Universal Mouse Driver
« Reply #100 on: 2016.August.08. 09:30:53 »
The "Universal" word comes from the more or less achieved task of unify all the direction devices, but at the end only the EnterMice and the internal joystick will be "widely" used. 

Then I also want universality on the modes, graphically or text, because is the only way that the user base can take seriously the mouse device.

But the most "normal" of the modes is the Editor, and it mixes the LPT lines on a way that is incompatible with a mouse pointing device. The solution I have found is to limit the movement to character boundaries.

Of course If I get it done, the driver will be better included on a Rom. This also has its problems, as the variable zone of the driver is inside the code.

Don't worry, what guides me in my efforts is the enjoyment, just like you with Xep...

Only that I'm not a good programmer.

Online gflorez

  • EP addict
  • *
  • Posts: 2380
  • Country: es
  • OS:
  • Windows 7/Server 2008 R2 Windows 7/Server 2008 R2
  • Browser:
  • Firefox 47.0 Firefox 47.0
    • View Profile
Re: Universal Mouse Driver
« Reply #101 on: 2016.August.16. 01:32:52 »
Another problem solved.

My LPT line searching routine works the same on all modes.

Now it searches for any video page line displayed on an LPT line, because it checks sequentially all the LPT video addresses to be contained on the buffer of the video page. Including Attribute mode or hardware text cases.

To do it, first the buffer of the video page has to be calculated multiplying rows x columns x pixels.

Even in the worst case of Editor video pages with all its lines mixed, now the upper LPT line displayed is found correctly.

Online gflorez

  • EP addict
  • *
  • Posts: 2380
  • Country: es
  • OS:
  • Windows 7/Server 2008 R2 Windows 7/Server 2008 R2
  • Browser:
  • Firefox 47.0 Firefox 47.0
    • View Profile
Re: Universal Mouse Driver
« Reply #102 on: 2016.August.27. 12:16:51 »
Now that I can store the first LPT line of the video page associated to the mouse channel, I have returned to my old idea of closing the mouse channel if something changes on the video page.

Now the driver compares the actual LPT line with the stored one, if there isn't movement in five 1/10 of second. This behaviour can be modified later if necessary.

It seems to work, expecially when TEXT is typed when a mouse channel is shown on a video page while on Basic editor mode.

I have to check it better but theoretically it won't work if the lower part of the mouse video page is resized, as only the first video page line is checked.

Also, the mouse channel will remain open, because closing it is a task of Exos, and it is not possible to do a call within an interrupt. The driver will only deactivate itself.
« Last Edit: 2016.August.28. 12:44:37 by gflorez »

Online gflorez

  • EP addict
  • *
  • Posts: 2380
  • Country: es
  • OS:
  • Windows 7/Server 2008 R2 Windows 7/Server 2008 R2
  • Browser:
  • Firefox 47.0 Firefox 47.0
    • View Profile
Re: Universal Mouse Driver
« Reply #103 on: 2016.August.28. 03:42:50 »
Predictably, all the actions that modify the upper LPT line displayed deactivate the mouse driver.

For example, CLEAR GRAPHICS doesn't close the driver, but DISPLAY TEXT and again DISPLAY GRAPHICS, disables it.

The same with DISPLAY AT, the mouse channel has to be opened after it, but we can use again and again the command, provided that the upper LPT line displayed is left untouched.




I am reasonably satisfied with this approach.
« Last Edit: 2016.August.28. 12:51:07 by gflorez »

Online gflorez

  • EP addict
  • *
  • Posts: 2380
  • Country: es
  • OS:
  • Windows 7/Server 2008 R2 Windows 7/Server 2008 R2
  • Browser:
  • Firefox 48.0 Firefox 48.0
    • View Profile
Re: Universal Mouse Driver
« Reply #104 on: 2016.September.01. 00:08:05 »
I'm now thinking on the  text modes.

As their pointers are only drawn on character boundaries but they work with pixel coordinates, the driver will have to constantly convert them to text coordinates.

At first I was thinking to check every erase-draw cycle if the pointer has been moved of character boundary. Then, if not moved, the mouse driver could save some processor time not redrawing the pointer on the same place.

But on those modes the pointer will be a lot quicker to calculate and draw than on graphic modes, so I think of that procedure as totally unnecessary as it would waste more than the saved time. The actual routine jumps erase-draw cycles if no movement is detected.

The minimalistic pointer will be erased and drawn every cycle.

Of course this is theoretical, as I still haven't implemented the text modes.
« Last Edit: 2016.September.01. 00:31:15 by gflorez »