Welcome, Guest. Please login or register.


Author Topic: EnterMice option on EDCW? (Read 32141 times)

Offline gflorez

  • EP addict
  • *
  • Posts: 3607
  • Country: es
    • Támogató Támogató
EnterMice option on EDCW?
« on: 2016.February.26. 11:38:38 »
I've  been snooping on the EDCW Rom-program. It is a front-end like the EGI, more integrated on EXOS but less graphical.

Also it is well documented, and can have extensions.

It is a perfect candidate to have an Entermice option. All the necessary things are there.

But, is the developer(EXOSWORM) still active to include in it a little mouse reading routine?
« Last Edit: 2016.February.26. 12:06:28 by gflorez »

Offline Zozosoft

  • Global Moderator
  • EP addict
  • *
  • Posts: 14723
  • Country: hu
    • http://enterprise.iko.hu/
Re: EnterMice option on EDCW?
« Reply #1 on: 2016.February.26. 11:52:52 »
He is not active, but I have the sources.

Offline gflorez

  • EP addict
  • *
  • Posts: 3607
  • Country: es
    • Támogató Támogató
Re: EnterMice option on EDCW?
« Reply #2 on: 2016.February.26. 12:04:36 »
Great!. You dare...?

Offline gflorez

  • EP addict
  • *
  • Posts: 3607
  • Country: es
    • Támogató Támogató
Re: EnterMice option on EDCW?
« Reply #3 on: 2016.February.27. 10:03:52 »
What is needed for old programs or games is a simple EnterMice movement routine with only one button. All at hand on rows 0 to 4 on K column. It is not necessary to implement the whole driver.


The internal or external joystick movement mixed with the EnterMice mouse movement, just like the Hsoft mouse driver did.

Offline Zozosoft

  • Global Moderator
  • EP addict
  • *
  • Posts: 14723
  • Country: hu
    • http://enterprise.iko.hu/
Re: EnterMice option on EDCW?
« Reply #4 on: 2016.February.27. 22:05:52 »
Source converted for compile with Sjasm 0.39

Offline gflorez

  • EP addict
  • *
  • Posts: 3607
  • Country: es
    • Támogató Támogató
Re: EnterMice option on EDCW?
« Reply #5 on: 2016.February.27. 23:15:59 »
This is the most simple EnterMice reading routine, only 118 bytes. It only reads the two first bytes, strictly MSX protocol, but has the possibility of  a secondary "wired" button.

It must be driven by a 50 Hz interrupt, embedded on the internal joystick reading routine of the target program or game.

Sorry for the badly formatted comments.

Code: [Select]
EnterMice simple reading routine:

ld hl, X_REL           ;first byte, X displacement since last lecture
ld a, 2                   ;RTS low
out (0B7h), a
ld b, 3                     ;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, 2                          ;short delay
call WAIT
call READ_4BIT                   ;read four lower bits
rld                              ;push them in (HL)
ld hl, Y_REL               ;second byte, Y displacement since last lecture
ld a, 2                          ;RTS low
out (0B7h), a
ld b, 2                          ;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, 2                          ;short delay
call WAIT
call READ_4BIT               ;read four lower bits
rld                                 ;push them in (HL)
xor a
ld c, a
out (0B5h), a
in a, (0B6h)
and 6                            
srl a ; here the status of J column is on carry, but is discarded
srl a
rl c ; K column is saved on c
xor 1
ld (SECBUTT_STATUS), a ; L column is the Right Mouse Button
ld a, c
xor 1
ld (MAINBUTT_STATUS), a ; K column is the Left Mouse Button
ld a, (X_REL)
ld c, a
ld a, (Y_REL)
or c ;If a=0, no movement
ret

WAIT:
nop
nop
nop
dec b
jr nz, WAIT
ret

READ_4BIT:
ld b, 4
ld d, 0

READ_LOOP:
ld a, b
out (0B5h), a
in a, (0B6h)
rra ;data is read from K column
rra
rl d
djnz READ_LOOP

ld a, d
ret

Offline Zozosoft

  • Global Moderator
  • EP addict
  • *
  • Posts: 14723
  • Country: hu
    • http://enterprise.iko.hu/
Re: EnterMice option on EDCW?
« Reply #6 on: 2016.February.27. 23:26:02 »
This is the most simple EnterMice reading routine, only 118 bytes.
But now only 36 free bytes in the EDCW :oops:

Offline gflorez

  • EP addict
  • *
  • Posts: 3607
  • Country: es
    • Támogató Támogató
Re: EnterMice option on EDCW?
« Reply #7 on: 2016.February.27. 23:50:22 »
Ok, lets see if can be made some space in EDCW.....


But the routine  can be used easily inside other programs.

Offline gflorez

  • EP addict
  • *
  • Posts: 3607
  • Country: es
    • Támogató Támogató
Re: EnterMice option on EDCW?
« Reply #8 on: 2016.February.27. 23:58:21 »
Seems that it searches for the Mouse driver...

Code: [Select]
nomodrv db 13,"Mouse driver not found,mouse ignored",0
yemodrv db 13,"Mouse driver found,control device redirected",0

I have to test it, tomorrow.

Edit: How much more programs work with the Driver and we don't know?
« Last Edit: 2016.February.28. 00:17:51 by gflorez »

Offline gflorez

  • EP addict
  • *
  • Posts: 3607
  • Country: es
    • Támogató Támogató
Re: EnterMice option on EDCW?
« Reply #9 on: 2016.February.28. 00:59:26 »
It searches for the Hsoft own created mouse driver, not the Boxoft mouse driver modified by Hsoft:


Offline gflorez

  • EP addict
  • *
  • Posts: 3607
  • Country: es
    • Támogató Támogató
Re: EnterMice option on EDCW?
« Reply #10 on: 2016.February.28. 10:31:13 »
I think I can inject the EnterMice routine on the Hsoft driver if you arrange a disassembly of it for me...

On the big Hsoft download packet there is a Mouse directory with an extension and a Rom version in it. Only 2kb.



Edit: It is totally incompatible being running at the same time with the Boxsoft driver, nor the EnterMice nor the serial card can be shared.

May be another driver mix.... but they are very different, and Hsoft has even a Basic commands extension....
« Last Edit: 2016.February.28. 11:36:12 by gflorez »

Offline BruceTanner

  • EP lover
  • *
  • Posts: 607
  • Country: gb
Re: EnterMice option on EDCW?
« Reply #11 on: 2016.February.28. 13:43:30 »
This is the most simple EnterMice reading routine, only 118 bytes.

51 bytes (untested!) :mrgreen: (but relies on Y_REL being the byte after X_REL in memory and assumes the value of C on exit does not matter):

Code: [Select]
ld hl, X_REL           ;first byte, X displacement since last lecture
ld b,3 ;long delay
call READ_8BIT
inc hl ;Y_REL
ld b,2 ;short delay
call READ_8BIT ;leaves B=0
xor a
out (0B5h), a
in a, (0B6h)
and 6                            
xor 6
srl a ; here the status of J column is on carry, but is discarded
srl a
rl b ; K column is saved in b
ld (SECBUTT_STATUS), a ; L column is the Right Mouse Button
ld a,b
ld (MAINBUTT_STATUS), a ; K column is the Left Mouse Button
ld a, (HL) ;Y-rel
dec hl ;X-REL
or (hl) ;If a=0, no movement
ret

WAIT:
nop
nop
nop
dec b
jr nz, WAIT
ret
;
READ_8BIT: ld a,2                   ;RTS low
out (0B7h), a
call WAIT_READ_4BIT     ; read four higher bits
xor a                           ;RTS high
out (0B7h), a
ld b, 2                         ;short delay
WAIT_READ_4BIT:call WAIT ;leaves B=0
READ_4BIT:
ld d, b ;d=0
ld b, 4

READ_LOOP:
ld a, b
out (0B5h), a
in a, (0B6h)
rra ;data is read from K column
rra
rl d
djnz READ_LOOP

ld a, d
rld
ret

Offline gflorez

  • EP addict
  • *
  • Posts: 3607
  • Country: es
    • Támogató Támogató
Re: EnterMice option on EDCW?
« Reply #12 on: 2016.February.28. 15:47:59 »
Thanks!

Now I see that a little more can be saved if the buttons are stored contiguous to the movement....

C is not important.

Edit: And the buttons phase put at the beggining, then only increasing hl will do, and at the end only a "dec hl" to compare the x and y movement.
« Last Edit: 2016.February.28. 16:32:37 by gflorez »

Offline BruceTanner

  • EP lover
  • *
  • Posts: 607
  • Country: gb
Re: EnterMice option on EDCW?
« Reply #13 on: 2016.February.28. 16:48:43 »
I don't know how I got 51 bytes, it's 79 :oops: must have not scrolled down to the bottom when counting!


Offline gflorez

  • EP addict
  • *
  • Posts: 3607
  • Country: es
    • Támogató Támogató
Re: EnterMice option on EDCW?
« Reply #14 on: 2016.February.28. 23:50:46 »
No problem, I think it is short enough. Thanks.

Two mouse drivers, one serial, the other universal but, as only one driver is possible, I choose my dear son.... well, I just adopted it, I'm not its real father....


The Mouse driver interrupt only writes the /RTS pin on the Serial port if a Mouse channel is open. This can only happen inside a program that uses it. Then, a little mouse reading routine is compatible  inside  a stand-alone program, as the Enterprise EXOS does not multi-task....




Then, I must remove the code that interacts with the Hsoft mouse driver interrupt outside, and replace it with this tiny EnterMice reading routine.