src/mess/machine/sms.c
| r3416 | r3417 | |
| 129 | 129 | /* Player 1 */ |
| 130 | 130 | switch( input_port_read(machine, "CTRLSEL") & 0x0F ) { |
| 131 | 131 | case 0x00: /* Joystick */ |
| 132 | | data = input_port_read(machine, "JOY0"); |
| 132 | data = input_port_read(machine, "PORT_DC"); |
| 133 | 133 | /* Rapid Fire setting for Button A */ |
| 134 | 134 | if ( input_port_read(machine, "RFU") & 0x01 ) { |
| 135 | 135 | data = ( data & 0xEF ) | ( rapid_fire_state_1 & 0x10 ); |
| r3416 | r3417 | |
| 149 | 149 | data = data >> 4; |
| 150 | 150 | } |
| 151 | 151 | sms_input_port0 = ( sms_input_port0 & 0xC0 ) | ( data & 0x0F ) | ( paddle_read_state & 0x20 ) |
| 152 | | | ( ( input_port_read(machine, "IN0") & 0x02 ) << 3 ); |
| 152 | | ( ( input_port_read(machine, "CTRLIPT") & 0x02 ) << 3 ); |
| 153 | 153 | break; |
| 154 | 154 | case 0x03: /* Sega Sports Pad */ |
| 155 | 155 | switch( sports_pad_state_1 ) { |
| r3416 | r3417 | |
| 166 | 166 | data = sports_pad_1_y & 0x0F; |
| 167 | 167 | break; |
| 168 | 168 | } |
| 169 | | sms_input_port0 = ( sms_input_port0 & 0xC0 ) | data | ( ( input_port_read(machine, "IN0") & 0x0C ) << 2 ); |
| 169 | sms_input_port0 = ( sms_input_port0 & 0xC0 ) | data | ( ( input_port_read(machine, "CTRLIPT") & 0x0C ) << 2 ); |
| 170 | 170 | break; |
| 171 | 171 | } |
| 172 | 172 | |
| 173 | 173 | /* Player 2 */ |
| 174 | 174 | switch( input_port_read(machine, "CTRLSEL") >> 4 ) { |
| 175 | 175 | case 0x00: /* Joystick */ |
| 176 | | data = input_port_read(machine, "JOY0"); |
| 176 | data = input_port_read(machine, "PORT_DC"); |
| 177 | 177 | sms_input_port0 = ( sms_input_port0 & 0x3F ) | ( data & 0xC0 ); |
| 178 | | data = input_port_read(machine, "JOY1"); |
| 178 | data = input_port_read(machine, "PORT_DD"); |
| 179 | 179 | if ( input_port_read(machine, "RFU") & 0x04 ) { |
| 180 | 180 | data = ( data & 0xFB ) | ( rapid_fire_state_2 & 0x04 ); |
| 181 | 181 | } |
| r3416 | r3417 | |
| 194 | 194 | } |
| 195 | 195 | sms_input_port0 = ( sms_input_port0 & 0x3F ) | ( ( data & 0x03 ) << 6 ); |
| 196 | 196 | sms_input_port1 = ( sms_input_port1 & 0xF0 ) | ( ( data & 0x0C ) >> 2 ) | ( paddle_read_state & 0x08 ) |
| 197 | | | ( ( input_port_read(machine, "IN0") & 0x20 ) >> 3 ); |
| 197 | | ( ( input_port_read(machine, "CTRLIPT") & 0x20 ) >> 3 ); |
| 198 | 198 | break; |
| 199 | 199 | case 0x03: /* Sega Sports Pad */ |
| 200 | 200 | switch( sports_pad_state_2 ) { |
| r3416 | r3417 | |
| 211 | 211 | break; |
| 212 | 212 | } |
| 213 | 213 | sms_input_port0 = ( sms_input_port0 & 0x3F ) | ( ( data & 0x03 ) << 6 ); |
| 214 | | sms_input_port1 = ( sms_input_port1 & 0xF0 ) | ( data >> 2 ) | ( ( input_port_read(machine, "IN0") & 0xC0 ) >> 4 ); |
| 214 | sms_input_port1 = ( sms_input_port1 & 0xF0 ) | ( data >> 2 ) | ( ( input_port_read(machine, "CTRLIPT") & 0xC0 ) >> 4 ); |
| 215 | 215 | break; |
| 216 | 216 | } |
| 217 | 217 | } |
| r3416 | r3417 | |
| 280 | 280 | |
| 281 | 281 | void sms_check_pause_button( running_machine *machine ) { |
| 282 | 282 | if ( ! IS_GAMEGEAR ) { |
| 283 | | if ( ! (input_port_read(machine, "JOY2") & 0x80) ) { |
| 283 | if ( ! (input_port_read(machine, "PAUSE") & 0x80) ) { |
| 284 | 284 | if ( ! smsPaused ) { |
| 285 | 285 | cpunum_set_input_line(machine, 0, INPUT_LINE_NMI, ASSERT_LINE ); |
| 286 | 286 | cpunum_set_input_line(machine, 0, INPUT_LINE_NMI, CLEAR_LINE ); |
| r3416 | r3417 | |
| 315 | 315 | } |
| 316 | 316 | |
| 317 | 317 | READ8_HANDLER(gg_input_port_2_r) { |
| 318 | | //logerror("joy 2 read, val: %02x, pc: %04x\n", (( IS_REGION_JAPAN ? 0x00 : 0x40) | (input_port_read(machine, "JOY2") & 0x80)), activecpu_get_pc()); |
| 319 | | return (( IS_REGION_JAPAN ? 0x00 : 0x40 ) | (input_port_read(machine, "JOY2") & 0x80)); |
| 318 | //logerror("joy 2 read, val: %02x, pc: %04x\n", (( IS_REGION_JAPAN ? 0x00 : 0x40) | (input_port_read(machine, "START") & 0x80)), activecpu_get_pc()); |
| 319 | return (( IS_REGION_JAPAN ? 0x00 : 0x40 ) | (input_port_read(machine, "START") & 0x80)); |
| 320 | 320 | } |
| 321 | 321 | |
| 322 | 322 | READ8_HANDLER(sms_mapper_r) |
src/mess/drivers/sms.c
| r3416 | r3417 | |
| 128 | 128 | AM_RANGE(0x40, 0x7F) AM_READWRITE(sms_count_r, sn76496_0_w) |
| 129 | 129 | AM_RANGE(0x80, 0x80) AM_MIRROR(0x3e) AM_READWRITE(sms_vdp_data_r, sms_vdp_data_w) |
| 130 | 130 | AM_RANGE(0x80, 0x81) AM_MIRROR(0x3e) AM_READWRITE(sms_vdp_ctrl_r, sms_vdp_ctrl_w) |
| 131 | | AM_RANGE(0xC0, 0xC0) AM_READ_PORT("JOY0") |
| 132 | | AM_RANGE(0xC1, 0xC1) AM_READ_PORT("JOY1") |
| 133 | | AM_RANGE(0xDC, 0xDC) AM_READ_PORT("JOY0") |
| 134 | | AM_RANGE(0xDD, 0xDD) AM_READ_PORT("JOY1") |
| 131 | AM_RANGE(0xC0, 0xC0) AM_READ_PORT("PORT_DC") |
| 132 | AM_RANGE(0xC1, 0xC1) AM_READ_PORT("PORT_DD") |
| 133 | AM_RANGE(0xDC, 0xDC) AM_READ_PORT("PORT_DC") |
| 134 | AM_RANGE(0xDD, 0xDD) AM_READ_PORT("PORT_DD") |
| 135 | 135 | ADDRESS_MAP_END |
| 136 | 136 | |
| 137 | 137 | |
| 138 | 138 | static INPUT_PORTS_START( sms ) |
| 139 | | PORT_START("JOY0") |
| 140 | | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_UP) PORT_CATEGORY(10) PORT_PLAYER(1) PORT_8WAY |
| 141 | | PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN) PORT_CATEGORY(10) PORT_PLAYER(1) PORT_8WAY |
| 142 | | PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT) PORT_CATEGORY(10) PORT_PLAYER(1) PORT_8WAY |
| 143 | | PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT) PORT_CATEGORY(10) PORT_PLAYER(1) PORT_8WAY |
| 144 | | PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_BUTTON1) PORT_CATEGORY(10) PORT_PLAYER(1) |
| 145 | | PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_BUTTON2) PORT_CATEGORY(10) PORT_PLAYER(1) |
| 146 | | PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_JOYSTICK_UP) PORT_CATEGORY(20) PORT_PLAYER(2) PORT_8WAY |
| 147 | | PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN) PORT_CATEGORY(20) PORT_PLAYER(2) PORT_8WAY |
| 139 | PORT_START("PORT_DC") |
| 140 | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_CATEGORY(10) PORT_PLAYER(1) PORT_8WAY |
| 141 | PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_CATEGORY(10) PORT_PLAYER(1) PORT_8WAY |
| 142 | PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_CATEGORY(10) PORT_PLAYER(1) PORT_8WAY |
| 143 | PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_CATEGORY(10) PORT_PLAYER(1) PORT_8WAY |
| 144 | PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_CATEGORY(10) PORT_PLAYER(1) |
| 145 | PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_CATEGORY(10) PORT_PLAYER(1) |
| 146 | PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_CATEGORY(20) PORT_PLAYER(2) PORT_8WAY |
| 147 | PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_CATEGORY(20) PORT_PLAYER(2) PORT_8WAY |
| 148 | 148 | |
| 149 | | PORT_START("JOY1") |
| 150 | | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT) PORT_CATEGORY(20) PORT_PLAYER(2) PORT_8WAY |
| 151 | | PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT) PORT_CATEGORY(20) PORT_PLAYER(2) PORT_8WAY |
| 152 | | PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_BUTTON1) PORT_CATEGORY(20) PORT_PLAYER(2) |
| 153 | | PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_BUTTON2) PORT_CATEGORY(20) PORT_PLAYER(2) |
| 149 | PORT_START("PORT_DD") |
| 150 | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_CATEGORY(20) PORT_PLAYER(2) PORT_8WAY |
| 151 | PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_CATEGORY(20) PORT_PLAYER(2) PORT_8WAY |
| 152 | PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_CATEGORY(20) PORT_PLAYER(2) |
| 153 | PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_CATEGORY(20) PORT_PLAYER(2) |
| 154 | 154 | PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_UNUSED ) /* Software Reset bit */ |
| 155 | 155 | PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_UNUSED ) |
| 156 | 156 | PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNUSED ) |
| 157 | 157 | PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNUSED ) |
| 158 | 158 | |
| 159 | | PORT_START("JOY2") |
| 160 | | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_UNUSED) |
| 161 | | PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_UNUSED ) |
| 162 | | PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_UNUSED ) |
| 163 | | PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_UNUSED ) |
| 164 | | PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_UNUSED ) |
| 165 | | PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_UNUSED ) |
| 166 | | PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNUSED ) |
| 167 | | PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_START ) /* Game Gear START */ |
| 159 | PORT_START("PAUSE") |
| 160 | PORT_BIT( 0x7f, IP_ACTIVE_LOW, IPT_UNUSED ) |
| 161 | PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_START ) PORT_NAME("Pause") /* Game Gear START */ |
| 168 | 162 | |
| 169 | 163 | PORT_START("LPHASER0") /* Light phaser X - player 1 */ |
| 170 | 164 | // PORT_BIT( 0xff, 0x80, IPT_LIGHTGUN_X ) PORT_CROSSHAIR( X, 1.0, 0.0, 0 ) PORT_SENSITIVITY(25) PORT_KEYDELTA(15) PORT_CATEGORY(11) PORT_PLAYER(1) |
| r3416 | r3417 | |
| 196 | 190 | PORT_START("PADDLE1") /* Paddle player 2 */ |
| 197 | 191 | PORT_BIT( 0xff, 0x80, IPT_PADDLE) PORT_SENSITIVITY(40) PORT_KEYDELTA(20) PORT_CENTERDELTA(0) PORT_MINMAX(0,255) PORT_CATEGORY(22) PORT_PLAYER(2) |
| 198 | 192 | |
| 199 | | PORT_START("IN0") /* Light Phaser and Paddle Control buttons */ |
| 193 | PORT_START("CTRLIPT") /* Light Phaser and Paddle Control buttons */ |
| 200 | 194 | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_CATEGORY(11) PORT_PLAYER(1) |
| 201 | 195 | PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_CATEGORY(12) PORT_PLAYER(1) |
| 202 | 196 | PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_CATEGORY(13) PORT_PLAYER(1) |
| r3416 | r3417 | |
| 231 | 225 | PORT_BIT( 0xff, 0x00, IPT_TRACKBALL_Y ) PORT_SENSITIVITY(50) PORT_KEYDELTA(40) PORT_RESET PORT_REVERSE PORT_CATEGORY(23) PORT_PLAYER(2) |
| 232 | 226 | INPUT_PORTS_END |
| 233 | 227 | |
| 228 | static INPUT_PORTS_START( gg ) |
| 229 | PORT_START("PORT_DC") |
| 230 | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_PLAYER(1) PORT_8WAY |
| 231 | PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_PLAYER(1) PORT_8WAY |
| 232 | PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_PLAYER(1) PORT_8WAY |
| 233 | PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_PLAYER(1) PORT_8WAY |
| 234 | PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(1) |
| 235 | PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_PLAYER(1) |
| 236 | PORT_BIT( 0xc0, IP_ACTIVE_LOW, IPT_UNUSED ) |
| 237 | |
| 238 | PORT_START("PORT_DD") |
| 239 | PORT_BIT( 0xff, IP_ACTIVE_LOW, IPT_UNUSED ) |
| 240 | |
| 241 | PORT_START("START") |
| 242 | PORT_BIT( 0x7f, IP_ACTIVE_LOW, IPT_UNUSED ) |
| 243 | PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_START ) PORT_NAME("Start") /* Game Gear START */ |
| 244 | INPUT_PORTS_END |
| 245 | |
| 234 | 246 | static PALETTE_INIT( sms ) { |
| 235 | 247 | int i; |
| 236 | 248 | for( i = 0; i < 64; i++ ) { |
| r3416 | r3417 | |
| 618 | 630 | CONS( 1990, smspal, sms, 0, sms2pal, sms, 0, sms, "Sega", "Master System II (PAL)", FLAG_BIOS_FULL ) |
| 619 | 631 | CONS( 1990, sms2kr, sms, 0, sms2fm, sms, 0, sms, "Samsung", "Gam*Boy II (Korea)", FLAG_REGION_JAPAN | FLAG_BIOS_FULL | FLAG_FM ) |
| 620 | 632 | |
| 621 | | CONS( 1990, gamegear, 0, sms, gamegear, sms, 0, gamegear, "Sega", "Game Gear (Europe/America)", FLAG_GAMEGEAR ) |
| 622 | | CONS( 1990, gamegeaj, gamegear, 0, gamegear, sms, 0, gamegear, "Sega", "Game Gear (Japan)", FLAG_REGION_JAPAN | FLAG_GAMEGEAR | FLAG_BIOS_0400 ) |
| 633 | CONS( 1990, gamegear, 0, sms, gamegear, gg, 0, gamegear, "Sega", "Game Gear (Europe/America)", FLAG_GAMEGEAR ) |
| 634 | CONS( 1990, gamegeaj, gamegear, 0, gamegear, gg, 0, gamegear, "Sega", "Game Gear (Japan)", FLAG_REGION_JAPAN | FLAG_GAMEGEAR | FLAG_BIOS_0400 ) |