MultiPlay

From CPCWiki - THE Amstrad CPC encyclopedia!
Revision as of 15:38, 31 May 2024 by Phi2x (Talk | contribs) (Mouse bits)

Jump to: navigation, search

The MultiPlay allows to add two controllers on the expansion port. It is easy to use them from BASIC, with the INP() command.

Each controller port can be set with two inputs modes:

  • AMS = Amstrad joystick and GX4000 gamepad
  • AMI = Amiga joystick / mouse (and compatible)

Each mouse sensitivity is 200dpi / 4bit acceleration.  (DK'Tronics mouse is 50dpi / 1bit) Last but not least: Left, Middle and Right buttons are supported.

50Hz games support w/o conflict. It is handled like arcade machines!

Technical

200 DPI (1 inch = 200 pixel movement)

         ________          ________
 A _____|        |________|        |________
             ________          ________        
 B _________|        |________|        |________

200 DPI |1  |2   |3  |4   |5  |6   |7  |8                                   
 50 DPI |1                |2 

About usages:

- Reading from BASIC with 50Hz interrupt is fine to handle a fast char pointer with acceleration.

- Reading from ASM with 300Hz interrupt is fine to handle a fast pixel pointer with acceleration.

I/O ports

&F990 = Port A Actions bits

&F991 = Port B Actions bits

&F992 = Port A Mouse POS-X value

&F993 = Port A Mouse POS-Y value

&F994 = Port B Mouse POS-X value

&F995 = Port B Mouse POS-Y value

Ports &F996 and &F997 are unused

Action bits

bit0: Up

bit1: Down

bit2: Left

bit3: Right

bit4: 1st fire or LMB

bit5: 2nd fire or RMB

bit6: 3rd fire or MMB

bit7: 0

Mouse position bits

bit0-2: value

bit3-7: sign (all 0 or 1)


Buttons 1, 2, 3 are the same for joystick and mouse input A/B.

Mouse register X/Y return the offset since the last read. These are 4 bit value with sign extension. The 4 values are sign extended to 8 bit, so negative value will have bit7-4 at one. In fact bit 7-4 = bit 3.

Note also that the X/Y value will saturate if not read for a long time (or if the movement is fast). It will never overflow or wrap.

From a software point of view, just read the port and add its value to your position variable.

Downloads

  • Any MultiPlay example or driver software exists?