Changes

Jump to: navigation, search

MultiPlay

2,122 bytes added, 10 April
/* Links */
The MultiPlay allows to add two controllers on the expansion port.
It is easy to use them from BASIC, with the [[Locomotive_BASIC#INP_.28.E2.80.B9port_number.E2.80.BA.29|INP()]] command.
 
[[File:MultiPlay.jpg]]
Each controller port can be set with two inputs modes:
</pre>
== Technical information ==About usages:
&F990 : 0321RLDU : Input A, joystick and buttons- Reading from BASIC with 50Hz interrupt is fine to handle a fast char pointer with acceleration.
&F991 : 0321RLDU : Input B, joystick and buttons- Reading from ASM with 300Hz interrupt is fine to handle a fast pixel pointer with acceleration.
&F992 : 0000XXXX : Input A, mouse X== I/O ports ==
Port &F993 : 0000YYYY : Input F990 = Port A, mouse YActions bits
Port &F991 = Port B Actions bits Port &F992 = Port A Mouse POS-X value Port &F993 = Port A Mouse POS-Y value Port &F994 : 0000XXXX : Input = Port B, mouse Mouse POS-Xvalue Port &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)
&F995 : 0000YYYY : Input B, mouse Y
Buttons 1, 2, 3 are the same for joystick and mouse input A/B.
&F996 and &F997 ports are unused.
About usages:- Reading from BASIC Mouse register X/Y return the offset since the last read. These are 4 bit value with 50Hz interrupt is fine sign extension. The 4 values are sign extended to handle 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 char pointer with acceleration). It will never overflow or wrap.- Reading from ASM with 300Hz interrupt is fine From a software point of view, just read the port and add its value to handle your position variable. == Text Cursor == <pre>10 MODE 2:BORDER 020 s=1:'sensitivity can also be fractional30 w=80:h=2540 x=w*0.5:y=h*0.550 LOCATE x,y:PRINT"*":60 xp=x:yp=y70 xo=INP(&F994):yo=INP(&F995):a fast pixel pointer with acceleration=INP(&F991)80 IF xo>7 THEN xo=xo-25590 IF yo>7 THEN yo=yo-255100 x=x+xo*s110 y=y+yo*s120 LOCATE 1,1:IF a AND 16 THEN PRINT"LEFT " ELSE IF a AND 32 THEN PRINT"RIGHT " ELSE IF a AND 64 THEN PRINT"MIDDLE" ELSE PRINT" "130 IF x<1 THEN x=1140 IF x>w THEN x=w150 IF y<1 THEN y=1160 IF y>h THEN y=h170 IF x<>xp OR y<>yp THEN FRAME:LOCATE xp,yp:PRINT" ";:LOCATE x,y:PRINT"*";180 GOTO 60</pre> == Graphics Cursor == <pre>10 MODE 2:BORDER 020 s=8:'sensitivity can also be fractional30 w=640:h=40040 x=w*0.5:y=h*0.550 TAG:MOVE x,h-y:PRINT"^";60 xp=x:yp=y70 xo=INP(&F994):yo=INP(&F995):a=INP(&F991)80 IF xo>7 THEN xo=xo-25590 IF yo>7 THEN yo=yo-255100 x=x+xo*s110 y=y+yo*s120 TAGOFF:LOCATE 1,1:IF a AND 16 THEN PRINT"LEFT " ELSE IF a AND 32 THEN PRINT"RIGHT " ELSE IF a AND 64 THEN PRINT"MIDDLE" ELSE PRINT" "130 IF x<1 THEN x=1140 IF x>w THEN x=w150 IF y<1 THEN y=1160 IF y>h THEN y=h170 IF x<>xp OR y<>yp THEN FRAME:TAG:MOVE xp,h-yp:PRINT" ";:MOVE x,h-y:PRINT"^";180 GOTO 60</pre>
== Downloads Links ==
* Any MultiPlay example or driver software exists[https://www.cpc-power.com/index.php?page=database&lemot=MultiPlay&r1=0&r2=1&r3=0&r4=1 All games using MultiPlay on CPC-Power]*[https://framagit.org/offset/multiplay-acepansion MultiPlay ACEpansion] on Framagit*[https://www.cpcwiki.eu/forum/amstrad-cpc-hardware/multiplay-mx4-expansion MultiPlay topic on CPCWiki forum]
[[Category:Peripherals]] [[Category:Input Device]]
13,173
edits