|
Post by walker7 on May 5, 2011 18:39:59 GMT -5
I can give you information on the EA Sports 4-Way Play. The article is at wiki.megadrive.org/index.php?title=Joypad_Read if you are interested. You can detect it with the following assembly code: Detect_4WayPlay: move.b #$40,($A10009) nop move.b #$43,($A1000B) nop move.b #$7C,($A10005) nop move.b #$7F,($A1000B) nop move.b #$7C,($A10005) nop move.b ($A10003),d0 and.b #3,d0 ; Z=1 for a 4-Way Play, 0 for no 4-Way Play rts
After detecting the 4-Way Play, you send a bitfield of %00xx1100 to $A10005 to tell it which controller you want to read. Does anyone know how to detect the Sega Team Player? A hint is that it will probably involve the addresses in the above code for the 4-Way Play.
|
|
|
Post by jlf65 on May 5, 2011 22:08:45 GMT -5
Here's some code I did for the Team Player. It isn't fully tested yet, but it should give you something to start with. And use code tags for code, not quote tags. Here's a doc on the multi-taps. | get current team player pad values | entry: | exit: d0 = pad values portA(R L D U S A C B) portB(R L D U S A C B) portC(R L D U S A C B) portD(R L D U S A C B) get_team: move.l d3,-(sp) move.b #0x60,0xA10009 move.b #0x60,0xA10003 /* TH = 1, TR = 1 */ nop nop nop nop move.b #0x20,0xA10003 /* TH = 0, TR = 1 start transfer */ nop nop nop nop bsr.b get_byte cmpi.b #0xFF,d0 bne no_mtap bsr.b get_byte /* IDA IDB */ lsl.w #8,d0 bsr.b get_byte move.w d0,d3 /* IDA IDB IDC IDD */ | port A bsr.b get_byte lsl.w #8,d0 btst #12,d3 bne.b 1f /* 3 button pad */ bsr.b get_nibble /* 6 button pad - read extra nibble */ 1: | port B bsr.b get_byte lsl.l #8,d0 btst #8,d3 bne.b 2f /* 3 button pad */ bsr.b get_nibble /* 6 button pad - read extra nibble */ 2: | port C bsr.b get_byte lsl.l #8,d0 btst #4,d3 bne.b 3f /* 3 button pad */ bsr.b get_nibble /* 6 button pad - read extra nibble */ 3: | port D bsr.b get_byte lsl.l #8,d0 btst #0,d3 bne.b 4f /* 3 button pad */ bsr.b get_nibble /* 6 button pad - read extra nibble */ 4: move.l (sp)+,d3 move.b #0x60,0xA10009 move.b #0x60,0xA10003 /* TH = 1, TR = 1 */ rts
| get two nibbles from Team Player multi-tap
get_byte: bsr.b get_nibble lsl.b #4,d0
| fall into get_nibble for second nibble
get_nibble: move.w #99,d2 /* retries - 1 */ btst #5,0xA10003 /* check current state of TR */ bne.b 2f | TR currently 0 move.b #0x20,0xA10003 /* set TR = 1 */ 1: move.b 0xA10003,d1 btst #4,d1 /* check current state of TL */ dbne d2,1b /* wait for TL = 1 or timeout */ andi.b #0x0F,d1 /* mask off nibble */ or.b d1,d0 rts 2: | TR currently 1 move.b #0x00,0xA10003 /* set TR = 0 */ 3: move.b 0xA10003,d1 btst #4,d1 /* check current state of TL */ dbeq d2,3b /* wait for TL = 0 or timeout */ andi.b #0x0F,d1 /* mask off nibble */ or.b d1,d0 rts
no_mtap: move.l (sp)+,d3 moveq #-1,d0 move.b #0x40,0xA10009 move.b #0x40,0xA10003 rts
|
|
Deleted
Deleted Member
Posts: 0
|
Post by Deleted on Apr 21, 2013 14:04:11 GMT -5
This seems to work great for 3 button controllers (total of 8 buttons, so 8*4 = 32), but for the use of 6 button controllers, you'd need to put the Team Player into Extra mode to poll the additional buttons (or just use the EA 4-Way). Is there another register for the additional buttons?
|
|
|
Post by sega16 on Apr 22, 2013 17:48:13 GMT -5
jlf65's code appears to support 6 button controllers. Did you read the comments in his code?
|
|