Welcome, Guest. Please login or register.


Author Topic: Universal Mouse Driver (Read 77594 times)

Offline gflorez

  • EP addict
  • *
  • Posts: 3607
  • Country: es
    • Támogató Támogató
Re: Universal Mouse Driver
« Reply #150 on: 2016.November.07. 00:33:38 »
I  have re-arranged the commands again.

Now, to put automatically a mouse pointer on an Editor video page, the command is :MOUSE ON.

A new command has been implemented to close the Editor page mouse channel, :MOUSE OFF. It just acts like the Basic command CLOSE £150:.

:PB still can be used, but must be avoided as it does more things that only closing the channel, and returns the annoying error.

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

For test purposes only, I have implemented another command , to try to set the cursor coordinates on the pointers position.

On Basic it can be done easily with a line like this:

PRINT £C:CHR$(27);"=";Y+32;X+32;  (being C the Editor channel, and Y and X the coordinates).

But Basic is intrinsically merged with the Editor and it has not worked for me to make a block write call(EXOS 8 ) to the Editor channel, so I have to abandon that path.
« Last Edit: 2016.November.07. 15:36:15 by gflorez »

Offline gflorez

  • EP addict
  • *
  • Posts: 3607
  • Country: es
    • Támogató Támogató
Re: Universal Mouse Driver
« Reply #151 on: 2016.November.08. 02:29:41 »
Another fix.

Exiting from the EGI and entering WP produced a change on the Mouse driver IRQ. This caused an interrupt jump to page 0 while drawing the pointer, and as the drawing routine use page 0, the execution hung.
« Last Edit: 2016.November.08. 03:01:50 by gflorez »

Offline gflorez

  • EP addict
  • *
  • Posts: 3607
  • Country: es
    • Támogató Támogató
Re: Universal Mouse Driver
« Reply #152 on: 2016.November.10. 01:21:05 »
This is somewhat a fix, because the pointer can't slide over the ruler line.

Now, when the ruler line is displayed, the mouse pointer area will start on the second row of the video page.

This is important, because the click event  will bring the cursor to the pointer's position, but the ruler is forbidden to the cursor.

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

And talking about the always delayed click event, I have found a way while studying the two Editor drivers. Both maintain their variables on the same index positions, so I will be able to implement the two with the same routine, only loading ix or iy registers with the appropriate address, and loading  on Z80 page 1 the segment where is located the Editor variable area.


The Editor lines aren't filled with spaces. A visible line(on screen line) can be empty, written with something, or completely filled of text.

Is because of this that the click event will only move the cursor to near "populated" positions.

Moving the cursor to empty zones implies to fill them at least with spaces, involving modifying a lot of the Editor variables, and this is beyond my possibilities without calling directly the internal routines of the two Editor drivers.

Offline endi

  • EP addict
  • *
  • Posts: 7298
  • Country: hu
  • grafikus, játékfejlesztõ, programozás, scifi, tudományok, vallás
    • Honlapom
Re: Universal Mouse Driver
« Reply #153 on: 2016.November.10. 11:29:34 »
cool, with the new emulator, I will make a mouse controlled game!
Vigyázat! Szektás vagyok! :)

Offline gflorez

  • EP addict
  • *
  • Posts: 3607
  • Country: es
    • Támogató Támogató
Re: Universal Mouse Driver
« Reply #154 on: 2016.November.10. 15:33:01 »
Great!

But don't wait for me, for a game you don't need Mouse pointer on Editor modes.

Offline Povi

  • EP addict
  • *
  • Posts: 2287
  • Country: hu
    • http://povi.fw.hu
Re: Universal Mouse Driver
« Reply #155 on: 2016.November.10. 16:12:31 »
Cool!!!

I've just downloaded the snapshots with the mouse cursor on EDITOR:

Will be the click replace the text cursor position?

Will be the scroll wheel scrolls up and down the displayed text?

Edit: I should buy a mouse interface for my EP... :-)
*** Speicherplatz zu klein

Offline gflorez

  • EP addict
  • *
  • Posts: 3607
  • Country: es
    • Támogató Támogató
Re: Universal Mouse Driver
« Reply #156 on: 2016.November.10. 16:42:23 »
Yes, I plan to replace the text cursor position, and even simulate an Enter key press when the coordinates of both the cursor and pointer are the same. I think it can be done. But I progress very slowly... I have to learn a lot on the process.

The Scroll is more difficult. Think that the Mouse driver is all made with hacks, because it is driven with interrupts, and on interrupt mode EXOS refuses to accept its calls. On the other side is very fast.

Offline gflorez

  • EP addict
  • *
  • Posts: 3607
  • Country: es
    • Támogató Támogató
Re: Universal Mouse Driver
« Reply #157 on: 2016.November.24. 01:18:03 »
I have managed to do the cursor positioning call within the interrupt, only putting 0f3h(DI) on the 0056h address on Z80 page 0.

It works, but corrupts the Editor.  Promising.

Offline gflorez

  • EP addict
  • *
  • Posts: 3607
  • Country: es
    • Támogató Támogató
Re: Universal Mouse Driver
« Reply #158 on: 2017.February.20. 11:09:52 »
Not actually any news about the driver, only to show a simple way to detect if the driver has been already loaded in Basic:

100 WHEN EXCEPTION USE DRIVER_LOADING
110      SET 189,4 ! try to set EnterMice control mode. Only possible if the driver has been installed.
120 END WHEN


1000 HANDLER  DRIVER_LOADING
1010      EXT "LOAD MOUSE.XR" ! The file has to be on the current directory, if not, the program will give us another error.
1020      PRINT "Loading the Mouse Driver"
1030      SET 189,4                  ! Here we assume that the driver has been correctly installed.
1040 END HANDLER

It can be made more complex and effective, setting a variable on the handler to signal the not-loaded status, loading the driver on the main program.  Then, if the file is not found(probably we are on another path), the error can be parsed on the same or on another handler.

It is a good practice to avoid installing several instances of the Mouse Driver.
« Last Edit: 2017.February.20. 11:16:54 by gflorez »

Offline gflorez

  • EP addict
  • *
  • Posts: 3607
  • Country: es
    • Támogató Támogató
Re: Universal Mouse Driver
« Reply #159 on: 2017.March.17. 14:44:25 »
Now that the SID storm has almost subsided, maybe Geco or Istvan-v have time to study how to make work my Click-event approach on the Mouse Driver.

What I want to do is to move the Editor cursor to the mouse pointer position when a click is done.

I already have created a mouse pointer on text video pages. Once installed the driver, the mouse pointer can be called, for example, from the Basic editor with ":MOUSE ON". Also ":MOUSE OFF" closes the mouse channel.

Hacking a little the interrupt area I have managed to do an EXOS call within the interrupt. Then, every time a click is done on an Editor page, a four bytes string like this is written to the Editor channel:  01Bh&"="&020h+Y&020h+X. Being Y and X the character boundaries of the mouse pointer.

This effectively moves the cursor to a place near the pointer, but corrupts the Editor data.

The "Click-event" is called like this:

ld a,(0056h)
 push af
 in a, (0B1h)
 push af
 in a, (0B3h)
 out (0B1h), a
 ld a,0f3h     ;  This hack is to prevent the blocking of the EXOS call inside the interrupt
 ld (0056h),a  
 ld de,SET_CURSOR;     This contains something like this "db 27,61,33,33      ; escape sequence set cursor"
 ld a,(EDITOR_CHN)
 ld bc,4
 di
 rst 30h
 db 8
 di
 pop af
 out (0B1h),a
 pop af
 ld (0056h),a;  the value is restored


Edit: snapshot corrected
« Last Edit: 2017.March.17. 15:23:24 by gflorez »

Offline gflorez

  • EP addict
  • *
  • Posts: 3607
  • Country: es
    • Támogató Támogató
Re: Universal Mouse Driver
« Reply #160 on: 2017.April.04. 17:04:37 »
It is possible that I have found a way to make the click event work.

Once the mouse driver installed, with the aid of the marvellous debugger that EP128emu offers, I have monitorised when EXOS re-enters to the mouse driver entry point.

Then, I have discovered that it is accessed cyclically aprox. every two seconds by the main EXOS-Editor routine. I have tested this on WP, EXDOS, ISDOS, LISP and HPASCAL.

I have already tested that a click event(EXOS call) done at the entry point is perfectly legal.

Two seconds since the click is a very long waiting, but is better than nothing.

This night at home I will test this.

Offline geco

  • EP addict
  • *
  • Posts: 7069
  • Country: hu
    • Támogató Támogató
Re: Universal Mouse Driver
« Reply #161 on: 2017.April.04. 19:24:27 »
Two seconds since the click is a very long waiting, but is better than nothing.
Yes, and it seems to be usable speed, even if faster solution is not found in the future.

Offline gflorez

  • EP addict
  • *
  • Posts: 3607
  • Country: es
    • Támogató Támogató
Re: Universal Mouse Driver
« Reply #162 on: 2017.April.04. 20:07:08 »
2 seconds will be the worst case. Then we have to add the cursor movement execution time, but this is made very fast.

Offline gflorez

  • EP addict
  • *
  • Posts: 3607
  • Country: es
    • Támogató Támogató
Re: Universal Mouse Driver
« Reply #163 on: 2017.April.05. 03:04:57 »
The 2 seconds call is done by the BRD, HUN, ESP Rom asking for the var 144 value. It is not done on native English machines without language Rom.

But  the cursor movement call also returns the 254 error code like when done on interrupt mode, ***EXOS function call not allowed. Once forced the call, the same Editor corruption....

Let's start again....

Offline gflorez

  • EP addict
  • *
  • Posts: 3607
  • Country: es
    • Támogató Támogató
Re: Universal Mouse Driver
« Reply #164 on: 2017.June.12. 10:53:43 »
I'm taking a break from the mouse driver.

The last thing I learned about it was that the "cursor position change" routine when forced corrupts the editor FLG__EDIT read flag, so I must preserve it before calling.

But definitively the call has to be done outside the interrupt. I've tried everything to make it work, but it always corrupts the Editor buffer.

It is understandable, the Editor is constantly passing the control to the Host program (Basic, Exdos, etc), so I can't know if it is safe to make the call at any given time.

The only solution I see is to implant a hook to the RST 30h call, test if a click hast to be done, and then return the control. But there is little space to make that complex hook.