src/mess/drivers/x68k.c
| r4477 | r4478 | |
| 680 | 680 | } |
| 681 | 681 | |
| 682 | 682 | // Megadrive 3 button gamepad |
| 683 | | // Multiplexer is controlled by bit 0 in the PPI control port |
| 684 | 683 | // According to XM6, bits 4 and 7 are always 1 (is this correct?) |
| 684 | // Bits 4 and 5 of PPI port C control each controller's multiplexer |
| 685 | // Button inputs (Start, A, B and C) are read in bits 5 and 6 (rather than 4 |
| 686 | // and 5 like on a Megadrive) |
| 687 | |
| 685 | 688 | static UINT8 md_3button_r(const device_config* device, int port) |
| 686 | 689 | { |
| 687 | 690 | if(port == 1) |
| r4477 | r4478 | |
| 712 | 715 | } |
| 713 | 716 | |
| 714 | 717 | // Megadrive 6 button gamepad |
| 715 | | // Multiplexer is controlled by bit 0 in the PPI control port |
| 716 | 718 | static TIMER_CALLBACK(md_6button_port1_timeout) |
| 717 | 719 | { |
| 718 | 720 | x68k_sys.mdctrl.seq1 = 0; |
| r4477 | r4478 | |
| 864 | 866 | const device_config *oki = devtag_get_device(device->machine, "okim6258"); |
| 865 | 867 | static UINT16 prev1; |
| 866 | 868 | static UINT16 prev2; |
| 869 | static UINT16 prevA; |
| 867 | 870 | |
| 868 | 871 | ppi_port[2] = data; |
| 869 | | x68k_sys.adpcm.pan = data & 0x03; |
| 870 | | x68k_sys.adpcm.rate = data & 0x0c; |
| 871 | | x68k_set_adpcm(device->machine); |
| 872 | | okim6258_set_divider(oki, (data >> 2) & 3); |
| 873 | | |
| 872 | if((data & 0x0f) != (prevA & 0x0f)) |
| 873 | { |
| 874 | x68k_sys.adpcm.pan = data & 0x03; |
| 875 | x68k_sys.adpcm.rate = data & 0x0c; |
| 876 | x68k_set_adpcm(device->machine); |
| 877 | okim6258_set_divider(oki, (data >> 2) & 3); |
| 878 | } |
| 879 | prevA = data & 0x0f; |
| 880 | |
| 874 | 881 | // The joystick enable bits also handle the multiplexer for various controllers |
| 875 | 882 | x68k_sys.joy.joy1_enable = data & 0x10; |
| 876 | 883 | x68k_sys.mdctrl.mux1 = data & 0x10; |