Welcome, Guest. Please login or register.


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

Online Zozosoft

  • Global Moderator
  • EP addict
  • *
  • Posts: 14731
  • Country: hu
    • http://enterprise.iko.hu/
Re: EnterMice option on EDCW?
« Reply #15 on: 2016.February.29. 21:09:25 »
It searches for the Hsoft own created mouse driver, not the Boxoft mouse driver modified by Hsoft:

Now I tried it, but don't work. Driver detected, but system crashed after few seconds :-( Probably started development of this function but don't finished?

Offline gflorez

  • EP addict
  • *
  • Posts: 3610
  • Country: es
    • Támogató Támogató
Re: EnterMice option on EDCW?
« Reply #16 on: 2016.February.29. 22:21:03 »
There are two versions of the Hsoft driver, 0.0 and 1.1, 2kb and 7Kb

The 1.1 invalidates the keyboard once loaded, but once soft reset the EP it stays resident and obeys the commands.

On the EP/MOUSE/MOUSE1-1 subdirectory.
« Last Edit: 2016.February.29. 22:29:33 by gflorez »

Offline gflorez

  • EP addict
  • *
  • Posts: 3610
  • Country: es
    • Támogató Támogató
Re: EnterMice option on EDCW?
« Reply #17 on: 2016.February.29. 23:05:54 »
And the Mkey.ext says "Enterprise Mouse-Keyboard". It weights 4280 bytes.

The disassembly of the Hsoft mouse driver 1.1 is inside "K", but I don't know with what assembler has been made.
« Last Edit: 2016.February.29. 23:16:19 by gflorez »

Offline gflorez

  • EP addict
  • *
  • Posts: 3610
  • Country: es
    • Támogató Támogató
Re: EnterMice option on EDCW?
« Reply #18 on: 2016.March.09. 23:16:34 »
I have found  a zone of code in the EDCW assembly that has not labels or entries, this saves about forty bytes more, now about 80 bytes in total. It can be found if search for "without label".

Still insufficient to insert the EnterMice routine, but it is a progress. If the chunk is removed from the code it doesn't affects the program.

I have edited the file for better reading.
« Last Edit: 2016.March.09. 23:35:40 by gflorez »

Offline gflorez

  • EP addict
  • *
  • Posts: 3610
  • Country: es
    • Támogató Támogató
Re: EnterMice option on EDCW?
« Reply #19 on: 2016.March.12. 23:46:52 »
I have "bad-translated" with the aid of Google the MOUSE.DOC file. First I had to put all the á, ó and ú in the text, as it was written on  an EP Magyar type font.

It will aid me to know how EDCW interacts with the HSOFT mouse driver.

There is a command "MOUSE" followed by 0FDh that returns in A and BC the segment and address where is the descriptor of the MOUSE device.

At that position  there are some useful internal variables:

-4      SYNC    The byte synchronism of the scan routine
-5      KEY     b0-b1-b2=Mouse buttons status
-6      X1      mouse X1 relative displacement
-7      Y1      mouse Y1 relative displacement
-8      XH      mouse X position
-9      XL
-10     YH      mouse Y position
-11     YL
-12  *  XH      X Upper limit position, little endian type
-13  *  XL
-14  *  YH      Y Upper limit position, little endian type
-15  *  YL
-16  *  XE      X Sensitivity  (0-7)
-17  *  YE      Y Sensitivity  (0-7)
-18  *  XPH     mouse X position little endian type
-19  *  XPL
-20  *  YPH     mouse Y position little endian type
-21  *  YPL
-22  *  SI      software interrupt mode: b3=movement, b2-b1-b0=buttons
-23     KEY2    mouse button to copy the soft-interrupt
-24     XPH     X copy of the soft-interrupt position
-25     XPL
-26     YPH     Y copy of the soft-interrupt position
-27     YPL


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

I'm now searching for "not entry" labels to save more space for the EnterMice routine.  At this moment I've found one that will save 4 bytes, not much, but I'm only beginning with the listing.
« Last Edit: 2016.March.12. 23:49:58 by gflorez »

Offline gflorez

  • EP addict
  • *
  • Posts: 3610
  • Country: es
    • Támogató Támogató
Re: EnterMice option on EDCW?
« Reply #20 on: 2016.March.13. 21:20:22 »
At last I've found six labels without entries, and now the EDCW.EXT file has 16234 bytes with the same untouched functionality.

You can search the code with "no entry label" to see the removed chunks.

Now it's time to think how can I inject the EnterMice subroutine maintaining the original code.

Offline gflorez

  • EP addict
  • *
  • Posts: 3610
  • Country: es
    • Támogató Támogató
Re: EnterMice option on EDCW?
« Reply #21 on: 2016.March.24. 00:57:08 »
Slowly I am figuring out how EDCW moves the pointer.

Meantime I find some curious details about how it has been programmed.

-It is plagued of auto modifiable code, for example:

Code: [Select]
wasn    ld a,0
        or a
        jr nz,nonc
 
        ld a,252
        call seize

        ld a,255
        ld (wasn+1),a

-Almost the entire extension is loaded on Z80 Page 0 at 100h address every time it is executed:

Code: [Select]
        push bc
        ld hl,maincde+1
        ld bc,extname-256; end of the code
        ld de,100h
        ldir
        pop bc
        jp 100h

To do it, there is a compiler command that forces the assembly of that chunk to be executed from 100h:

Code: [Select]
maincde ret

        phase 100h;  assembles this chunk on 100h address

And, at the end of the code:

Code: [Select]
extname equ $
        dephase
PEND equ $
END



I think that the Rom version of the EDCW uses the same method, as the author claims the two versions are compatible. It would have cost the rewriting of all the program to remove all that auto-modifiable code.

-An unknown "External keyboard" hardware is used by the program.  Probably also created by Meszaros, uses Z80 ports 60h and 61h, not present  on LGB list.

-Inside the code, some 16 bit input-output port instructions are used. I though they where forbidden due to the paging method of the Enterprise:

Code: [Select]
int     ld bc,0b5h; b=0
        ld e,7; row 7
        out (c),e; Keyboard/Joystick row select
        in d,(c); Keyboard line status
        bit 2,d; right
        jr nz,wo

Here, "out (c),e" is used to save some instructions when scanning the keyboard.

But here it is used to scan for connected hardware in a way that I still don't understand:

Code: [Select]
he?     push bc
        in a,(c); I think it searches for hardware in the ports
        inc a
        jr z,pw

        ld (hl),c
        inc hl
        inc d

pw      pop bc
        inc c
        djnz he?

        ret



















Offline lgb

  • EP addict
  • *
  • Posts: 3563
  • Country: hu
  • æðsta yfirmaður
    • http://lgb.hu/
Re: EnterMice option on EDCW?
« Reply #22 on: 2016.March.28. 00:09:24 »
An unknown "External keyboard" hardware is used by the program.  Probably also created by Meszaros, uses Z80 ports 60h and 61h, not present  on LGB list.

I am not sure about this, but if I remember correctly, there was an external PC keyboard once, which is not compatible with the original keyboard though, so you must to use custom ports to access it. Maybe this one: http://ep128.hu/Ep_Hardware/Ep_Billentyu.htm

This Hungarian article talks about ports 60h and 61h ...

Offline gflorez

  • EP addict
  • *
  • Posts: 3610
  • Country: es
    • Támogató Támogató
Re: EnterMice option on EDCW?
« Reply #23 on: 2016.March.28. 00:59:37 »
Surely it is. Not so complicated like the serial card. There is even a driver for it on the HSOFT big file.

A pity that serial keyboards are not so common today. I have thrown many to the junk...

I remember a project to modify the ROM inside on a specific maker....

Offline lgb

  • EP addict
  • *
  • Posts: 3563
  • Country: hu
  • æðsta yfirmaður
    • http://lgb.hu/
Re: EnterMice option on EDCW?
« Reply #24 on: 2016.March.28. 01:24:45 »
A pity that serial keyboards are not so common today. I have thrown many to the junk...

Well, USB is also serial, did you mean PS/2? :) This project uses even older ones, XT keyboards ... I am not sure about the difference though between PS/2 AT and XT stuffs ...

Offline gflorez

  • EP addict
  • *
  • Posts: 3610
  • Country: es
    • Támogató Támogató
Re: EnterMice option on EDCW?
« Reply #25 on: 2016.March.28. 02:26:45 »
I remember to have 5 pin DIN to mini-DIN(PS/2) adapters for that XT keyboards.

I think both use the same protocol. Not the same protocol as PS/2 mice but with the same signals, +5, negative, clock and data.

Offline pear

  • EP lover
  • *
  • Posts: 825
  • Country: pl
  • Z80 only
    • Támogató Támogató
Re: EnterMice option on EDCW?
« Reply #26 on: 2016.March.28. 08:00:39 »
XT keyboards are different from AT at layer 1 of communication protocol (clock signal).
PS/2 and AT keyboards have the same layer 1, but are different at layer 2 (extended but compatible commands, other than mouse).

Offline gflorez

  • EP addict
  • *
  • Posts: 3610
  • Country: es
    • Támogató Támogató
Re: EnterMice option on EDCW?
« Reply #27 on: 2016.March.31. 14:49:59 »
EDCW stores the cursor coordinates with three bytes, first the line(IX), 0 to 199, then the column(IX+1), 0 to 74, and at last the pixel(IX+2), 0 to 7.

This way it is very easy to calculate the exact memory address of the position. It is an intermediate stage between the pure coordinate position and the mere memory position. But adding or subtracting from a position involves to perform many calculations.

At the other side, the  Boxsoft approach(mouse driver, EGI and Paintbox) works internally with simple coordinates, and only translates them to memory position when the pointer has to be drawn.

The good news is that EDCW has already the subroutines to add or subtract from a position, so there I can save some valuable memory. I only have to discover how to call them without disturbing the main process. The ideal approach is to merge the EnterMice movement with the joysticks routines. I think it is possible, because they are already prepared for increments grater than 1. If you press a direction on the internal joystick for a while the pointer begins to move faster. There is an acceleration routine that detects that.

Offline gflorez

  • EP addict
  • *
  • Posts: 3610
  • Country: es
    • Támogató Támogató
Re: EnterMice option on EDCW?
« Reply #28 on: 2016.April.03. 03:18:12 »
I am struggling against the code..... I've managed to move the pointer with the mouse, a bad movement but it is a promising start.

The problem here is that I only have about 13 bytes free, not enough to do beautiful miracles... 

To my tests I am using superb LGB's Xep128. As it access read only the SD-image it is easy to have it mounted as a virtual unit and copy the newly compiled EDCW extension to try.

Offline lgb

  • EP addict
  • *
  • Posts: 3563
  • Country: hu
  • æðsta yfirmaður
    • http://lgb.hu/
Re: EnterMice option on EDCW?
« Reply #29 on: 2016.April.03. 13:49:32 »
The problem here is that I only have about 13 bytes free, not enough to do beautiful miracles...  

640Kbyte should be enough for everyone :) Ok. but 13 bytes? :D

Quote
To my tests I am using superb LGB's Xep128. As it access read only the SD-image it is easy to have it mounted as a virtual unit and copy the newly compiled EDCW extension to try.

"superb LGB" :) Maybe LGB's superb Xep128, but it's even too much :) Sorry, I couldn't resist to react, but thanks for the nice words :)

Acutally - I think - you must be careful with that. What you're doing is nice (even I do this sometimes) just care must be taken, as if image changes, EP won't notice it and maybe things cached FAT etc entries (I am not sure about EXDOS/FISH internals ...) will be invalid. But if you modify that among EP reboots etc, it must be safe ... I think :D

Anyway it's nice that somebody else other than me uses Xep128 too at least :-P Even just myself, I can find bugs if I try to use it eg with Bricky Prise now, the sound problem :) This is because just developing Xep128 may not expose bugs with testing some "fixed stuff", but the every-day usage can point some other bugs out, sometimes :)