src/mess/machine/sms.c
| r769 | r770 | |
| 30 | 30 | UINT8 ggSIO[5] = { 0x7F, 0xFF, 0x00, 0xFF, 0x00 }; |
| 31 | 31 | UINT8 sms_store_control = 0; |
| 32 | 32 | |
| 33 | /* Data needed for Rapid Fire Unit support */ |
| 34 | mame_timer *rapid_fire_timer; |
| 35 | UINT8 rapid_fire_state_1; |
| 36 | UINT8 rapid_fire_state_2; |
| 37 | |
| 33 | 38 | struct { |
| 34 | 39 | UINT8 *ROM; /* Pointer to ROM image data */ |
| 35 | 40 | UINT32 size; /* Size of the ROM image */ |
| r769 | r770 | |
| 42 | 47 | } sms_cartridge[MAX_CARTRIDGES]; |
| 43 | 48 | UINT8 sms_current_cartridge; |
| 44 | 49 | |
| 50 | static TIMER_CALLBACK( rapid_fire_callback ) { |
| 51 | rapid_fire_state_1 ^= 0xFF; |
| 52 | rapid_fire_state_2 ^= 0xFF; |
| 53 | } |
| 54 | |
| 45 | 55 | WRITE8_HANDLER(sms_fm_detect_w) { |
| 46 | 56 | if ( HAS_FM ) { |
| 47 | 57 | smsFMDetect = (data & 0x01); |
| r769 | r770 | |
| 55 | 65 | if ( biosPort & IO_CHIP ) { |
| 56 | 66 | return 0xFF; |
| 57 | 67 | } else { |
| 58 | | return readinputport(0); |
| 68 | UINT8 data = readinputport(0); |
| 69 | /* Rapid Fire setting for Button A */ |
| 70 | if ( readinputport(7) & 0x01 ) { |
| 71 | data = ( data & 0xEF ) | ( rapid_fire_state_1 & 0x10 ); |
| 72 | } |
| 73 | /* Check Rapid Fire setting for Button B */ |
| 74 | if ( readinputport(7) & 0x02 ) { |
| 75 | data = ( data & 0xDF ) | ( rapid_fire_state_1 & 0x20 ); |
| 76 | } |
| 77 | return data; |
| 59 | 78 | } |
| 60 | 79 | } |
| 61 | 80 | } |
| r769 | r770 | |
| 84 | 103 | /* Merge version data with input port #2 data */ |
| 85 | 104 | temp = (temp & 0xC0) | (readinputport(1) & 0x3F); |
| 86 | 105 | |
| 106 | /* Rapid Fire setting for Button A */ |
| 107 | if ( readinputport(7) & 0x04 ) { |
| 108 | temp = ( temp & 0xFB ) | ( rapid_fire_state_2 & 0x04 ); |
| 109 | } |
| 110 | /* Check Rapid Fire setting for Button B */ |
| 111 | if ( readinputport(7) & 0x08 ) { |
| 112 | temp = ( temp & 0xF7 ) | ( rapid_fire_state_2 & 0x08 ); |
| 113 | } |
| 114 | |
| 87 | 115 | return (temp); |
| 88 | 116 | } |
| 89 | 117 | |
| r769 | r770 | |
| 114 | 142 | if (biosPort & IO_CHIP) { |
| 115 | 143 | return (0xFF); |
| 116 | 144 | } else { |
| 117 | | return readinputport(0); |
| 145 | UINT8 data = readinputport(0); |
| 146 | /* Rapid Fire setting for Button A */ |
| 147 | if ( readinputport(7) & 0x01 ) { |
| 148 | data = ( data & 0xEF ) | ( rapid_fire_state_1 & 0x10 ); |
| 149 | } |
| 150 | /* Check Rapid Fire setting for Button B */ |
| 151 | if ( readinputport(7) & 0x02 ) { |
| 152 | data = ( data & 0xDF ) | ( rapid_fire_state_1 & 0x20 ); |
| 153 | } |
| 154 | return data; |
| 118 | 155 | } |
| 119 | 156 | } |
| 120 | 157 | |
| r769 | r770 | |
| 743 | 780 | setup_banks(); |
| 744 | 781 | |
| 745 | 782 | setup_rom(); |
| 783 | |
| 784 | rapid_fire_state_1 = 0; |
| 785 | rapid_fire_state_2 = 0; |
| 786 | rapid_fire_timer = mame_timer_alloc( rapid_fire_callback ); |
| 787 | mame_timer_adjust( rapid_fire_timer, MAME_TIME_IN_HZ(10), 0, MAME_TIME_IN_HZ(10) ); |
| 746 | 788 | } |
| 747 | 789 | |
| 748 | 790 | READ8_HANDLER(sms_store_cart_select_r) { |
src/mess/drivers/sms.c
| r769 | r770 | |
| 181 | 181 | PORT_START /* IN6 - Light phaser Y - player 2 */ |
| 182 | 182 | // PORT_BIT( 0xff, 0x80, IPT_LIGHTGUN_Y ) PORT_CROSSHAIR( Y, 1.0, 0.0, 0 ) PORT_SENSITIVITY(25) PORT_KEYDELTA(25) PORT_PLAYER(2) |
| 183 | 183 | |
| 184 | PORT_START /* IN7 - Rapid Fire Unit */ |
| 185 | PORT_DIPNAME( 0x03, 0x00, "Rapid Fire Unit - Player 1" ) |
| 186 | PORT_DIPSETTING( 0x00, DEF_STR( Off ) ) |
| 187 | PORT_DIPSETTING( 0x01, "Button A" ) |
| 188 | PORT_DIPSETTING( 0x02, "Button B" ) |
| 189 | PORT_DIPSETTING( 0x03, "Button A+B" ) |
| 190 | PORT_DIPNAME( 0x0c, 0x00, "Rapid Fire Unit - Player 2" ) |
| 191 | PORT_DIPSETTING( 0x00, DEF_STR( Off ) ) |
| 192 | PORT_DIPSETTING( 0x04, "Button A" ) |
| 193 | PORT_DIPSETTING( 0x08, "Button B" ) |
| 194 | PORT_DIPSETTING( 0x0C, "Button A+B" ) |
| 195 | |
| 184 | 196 | INPUT_PORTS_END |
| 185 | 197 | |
| 186 | 198 | static PALETTE_INIT( sms ) { |
| r769 | r770 | |
| 494 | 506 | static void smssdisp_cartslot_getinfo(const device_class *devclass, UINT32 state, union devinfo *info) { |
| 495 | 507 | switch(state) { |
| 496 | 508 | case DEVINFO_INT_COUNT: info->i = 5; break; |
| 509 | case DEVINFO_INT_MUST_BE_LOADED: info->i = 1; break; |
| 497 | 510 | default: sms_cartslot_getinfo(devclass, state, info); break; |
| 498 | 511 | } |
| 499 | 512 | } |