Welcome, Guest. Please login or register.


Author Topic: EnterMice (Joy & PS/2 mouse interface) (Read 60837 times)

Offline pear

  • EP lover
  • *
  • Posts: 627
  • Country: pl
  • Z80 only
  • OS:
  • Windows NT 6.3 Windows NT 6.3
  • Browser:
  • Firefox 58.0 Firefox 58.0
    • View Profile
Re: EnterMice (Joy & PS/2 mouse interface)
« Reply #480 on: 2018.March.05. 09:55:59 »
Just check if the connector pins have not been shortened ?
If yes, you need new connectors too.
Let me know.

Offline Tutus

  • EP user
  • *
  • Posts: 344
  • Country: hu
  • OS:
  • Windows NT 10.0 Windows NT 10.0
  • Browser:
  • Firefox 58.0 Firefox 58.0
    • View Profile
    • Enterpress News
Re: EnterMice (Joy & PS/2 mouse interface)
« Reply #481 on: 2018.March.05. 09:59:21 »
Pear, you can add Zozo to my order. I'll give it to her :)

Offline pear

  • EP lover
  • *
  • Posts: 627
  • Country: pl
  • Z80 only
  • OS:
  • Windows NT 6.3 Windows NT 6.3
  • Browser:
  • Firefox 58.0 Firefox 58.0
    • View Profile
Re: EnterMice (Joy & PS/2 mouse interface)
« Reply #482 on: 2018.March.05. 10:03:36 »
No problem :)

Online gflorez

  • EP addict
  • *
  • Posts: 2231
  • Country: es
  • OS:
  • Windows XP Windows XP
  • Browser:
  • Firefox 52.0 Firefox 52.0
    • View Profile
Re: EnterMice (Joy & PS/2 mouse interface)
« Reply #483 on: 2018.April.20. 11:34:26 »
Hello

If I want to put mouse control in an old game (eg Ledmmings), what should I watch for?

Suppose you have the original jpy reader routine, see where it is going to jump, to the left, to where, to the right, etc.

Now, I get a relative movement at the mouse. So what do you need to pay attention to working well? Here I am thinking that if I make things a little simpler, it will work at the same time on joy mode and EnterMice mode (1.2 DIP OFF)


You must search the keyboard-joystick reading routine, near it you will find the movement routine, usually with -+1 coordinate additions. Usually the inputs are checked every 1/50 second, perfect to add the EnterMice reading routine by a CALL on some place of the code(probably altering a JP command).

You must first search for a place where to inject the mouse reading routine. There are some variations in complexity and length, according to the number of buttons you want to read, but for a game the best is the basic movement and two main buttons.

You will save some process time if you read the joystick bits at the same time as the EnterMice bit on the same B6h Z80 port. But the mouse has to be read 4 times, not only one.

You can read the descriptions of my strugglings modifying programs:

 https://enterpriseforever.com/programming/entermice-option-on-edcw/

https://enterpriseforever.com/programming/pasziansz-solitaire-from-hsoft-need-entermice-support/

Remember, the mouse can add movement from -+1 to -+128 coordinate units

Offline Povi

  • EP addict
  • *
  • Posts: 1565
  • Country: hu
  • OS:
  • Windows NT 10.0 Windows NT 10.0
  • Browser:
  • Chrome 65.0.3325.181 Chrome 65.0.3325.181
    • View Profile
    • http://povi.fw.hu
Re: EnterMice (Joy & PS/2 mouse interface)
« Reply #484 on: 2018.April.20. 14:08:20 »
Remember, the mouse can add movement from -+1 to -+128 coordinate units
What kind of unit is it? I assume they are needed to convert to pixel coordinates based on experimental way?
*** Speicherplatz zu klein

Online gflorez

  • EP addict
  • *
  • Posts: 2231
  • Country: es
  • OS:
  • Windows XP Windows XP
  • Browser:
  • Firefox 52.0 Firefox 52.0
    • View Profile
Re: EnterMice (Joy & PS/2 mouse interface)
« Reply #485 on: 2018.April.20. 14:45:04 »
EnterMice returns two bytes for the movement, on two's complements for the Z80 processor. You can add them directly to the actual position, checking what happens to the flags to correct the coordinates if the addition is lower or  higher than your playing zone.

Two's complements is a convention to represent a whole signed number. The Z80 works with sign when the appropriate operant is selected. Bit 7 set indicates a negative bit, but you can't take the rest of the bits as the data, only in positive numbers happens this, because negative numbers start from 255(1111 1111) as -1  backwards up to 128(1000 0000) as -128.

But the magic is that adding a pair of two's complement numbers works...  if the result don't exceeds the +127 -128 range...

Online gflorez

  • EP addict
  • *
  • Posts: 2231
  • Country: es
  • OS:
  • Windows XP Windows XP
  • Browser:
  • Firefox 52.0 Firefox 52.0
    • View Profile
Re: EnterMice (Joy & PS/2 mouse interface)
« Reply #486 on: 2018.April.20. 18:13:10 »
I forgot to say, the Z80 also manages 16bit signed numbers, and in that case the range is form +32767  to -32768 on operations with register pairs.

Online gflorez

  • EP addict
  • *
  • Posts: 2231
  • Country: es
  • OS:
  • Windows XP Windows XP
  • Browser:
  • Firefox 52.0 Firefox 52.0
    • View Profile
Re: EnterMice (Joy & PS/2 mouse interface)
« Reply #487 on: 2018.April.23. 15:47:12 »
Probably the program maintains the pointer coordinates on word variables(16 bits). To add the 8 bit increment to the 16 bit coordinate you must expand it to 16 bit. If the bit 7 is 0 then the high byte will be 0, but if it is set all the bits on the high byte have to be set, so it will have  a 255. The value remains the same.


Code: [Select]
                         High     Low

+23 = 00010111   ----> 00000000 00010111 still +23

-10 = 11110110   ----> 11111111 11110110 still -10