diff --git a/src/mame/drivers/seibuspi.cpp b/src/mame/drivers/seibuspi.cpp index b663acc99af..6922755b6d8 100644 --- a/src/mame/drivers/seibuspi.cpp +++ b/src/mame/drivers/seibuspi.cpp @@ -948,17 +948,17 @@ READ32_MEMBER(seibuspi_state::ejsakura_keyboard_r) switch (m_ejsakura_input_port) { case 0x01: - return ioport("INPUT01")->read(); + return m_key[0]->read(); case 0x02: - return ioport("INPUT02")->read(); + return m_key[1]->read(); case 0x04: - return ioport("INPUT04")->read(); + return m_key[2]->read(); case 0x08: - return ioport("INPUT08")->read(); + return m_key[3]->read(); case 0x10: - return ioport("INPUT10")->read(); + return m_key[4]->read(); default: - return ioport("SYSTEM")->read(); + return m_special->read(); } } @@ -977,7 +977,7 @@ static ADDRESS_MAP_START( base_map, AS_PROGRAM, 32, seibuspi_state ) AM_RANGE(0x00000498, 0x0000049b) AM_WRITENOP // ? dma address high bits? (always writes 0) AM_RANGE(0x00000600, 0x00000603) AM_READ8(spi_status_r, 0x000000ff) AM_RANGE(0x00000604, 0x00000607) AM_READ_PORT("INPUTS") - AM_RANGE(0x00000608, 0x0000060b) AM_READ_PORT("UNKNOWN") + AM_RANGE(0x00000608, 0x0000060b) AM_READ_PORT("EXCH") AM_RANGE(0x0000060c, 0x0000060f) AM_READ_PORT("SYSTEM") AM_RANGE(0x00000000, 0x0003ffff) AM_RAM AM_SHARE("mainram") AM_RANGE(0x00200000, 0x003fffff) AM_ROM AM_SHARE("share1") @@ -1074,7 +1074,7 @@ ADDRESS_MAP_END static ADDRESS_MAP_START( sys386f_map, AS_PROGRAM, 32, seibuspi_state ) AM_IMPORT_FROM( rise_map ) AM_RANGE(0x00000010, 0x00000013) AM_READ8(spi_status_r, 0x000000ff) - AM_RANGE(0x00000400, 0x00000403) AM_WRITE(ejsakura_input_select_w) + AM_RANGE(0x00000400, 0x00000403) AM_READ_PORT("SYSTEM") AM_WRITE(ejsakura_input_select_w) AM_RANGE(0x00000404, 0x00000407) AM_WRITE8(eeprom_w, 0x000000ff) AM_RANGE(0x00000408, 0x0000040f) AM_DEVWRITE8("ymz", ymz280b_device, write, 0x000000ff) AM_RANGE(0x00000484, 0x00000487) AM_WRITE(palette_dma_start_w) @@ -1144,7 +1144,7 @@ ADDRESS_MAP_END static ADDRESS_MAP_START( spi_soundmap, AS_PROGRAM, 8, seibuspi_state ) AM_RANGE(0x4008, 0x4008) AM_DEVWRITE("soundfifo2", fifo7200_device, data_byte_w) - AM_RANGE(0x400a, 0x400a) AM_READ_PORT("JP1") // is JP1 physically really here? + AM_RANGE(0x400a, 0x400a) AM_READ_PORT("JUMPERS") // TO DO: get these to actually work AM_IMPORT_FROM( sxx2e_soundmap ) ADDRESS_MAP_END @@ -1180,30 +1180,30 @@ WRITE_LINE_MEMBER(seibuspi_state::ymf_irqhandler) CUSTOM_INPUT_MEMBER(seibuspi_state::ejanhs_encode) { /* E-Jan Highschool has a keyboard with the following keys - The keys are encoded with 6 bits - A - 000010 port 0 - B - 010000 port 0 - C - 000010 port 1 - D - 010000 port 1 - E - 000011 port 0 - F - 011000 port 0 - G - 000011 port 1 - H - 011000 port 1 - I - 000100 port 0 - J - 100000 port 0 - K - 000100 port 1 - L - 100000 port 1 - M - 000101 port 0 - N - 101000 port 0 - CHI - 000101 port 1 - PON - 101000 port 1 - KAN - 000110 port 0 - REACH - 110000 port 0 - RON - 000110 port 1 - Start - 000111 port 0 + The keys are encoded with 3 bits for each input port + A - 010 port A + B - 010 port B + C - 010 port C + D - 010 port D + E - 011 port A + F - 011 port B + G - 011 port C + H - 011 port D + I - 100 port A + J - 100 port B + K - 100 port C + L - 100 port D + M - 101 port A + N - 101 port B + CHI - 101 port C + PON - 101 port D + KAN - 110 port A + REACH - 110 port B + RON - 110 port C + Start - 111 port A */ - static const UINT8 encoding[] = { 0x02, 0x10, 0x03, 0x18, 0x04, 0x20, 0x05, 0x28, 0x06, 0x30, 0x07 }; - ioport_value state = ioport((const char *)param)->read(); + static const UINT8 encoding[] = { 6, 5, 4, 3, 2, 7 }; + ioport_value state = ~m_key[(FPTR)param]->read(); for (int bit = 0; bit < ARRAY_LENGTH(encoding); bit++) if (state & (1 << bit)) @@ -1245,7 +1245,8 @@ static INPUT_PORTS_START( sxx2e ) PORT_BIT( 0x00000080, IP_ACTIVE_LOW, IPT_UNUSED ) PORT_BIT( 0xffffff00, IP_ACTIVE_LOW, IPT_UNUSED ) - PORT_START("UNKNOWN") + // Some sets still read unused 3P and 4P inputs from here as in Zero Team + PORT_START("EXCH") PORT_BIT( 0xffffffff, IP_ACTIVE_LOW, IPT_UNKNOWN ) PORT_START("COIN") @@ -1258,11 +1259,11 @@ INPUT_PORTS_END static INPUT_PORTS_START( spi_3button ) PORT_INCLUDE( sxx2e ) - PORT_START("JP1") - PORT_CONFNAME( 0x03, 0x03, "JP1" ) - PORT_CONFSETTING( 0x03, "Update" ) - PORT_CONFSETTING( 0x01, DEF_STR( Off ) ) - PORT_CONFSETTING( 0x00, DEF_STR( On ) ) + PORT_START("JUMPERS") + PORT_DIPNAME( 0x03, 0x03, "JP1" ) + PORT_DIPSETTING( 0x03, "Update" ) + PORT_DIPSETTING( 0x01, DEF_STR( Off ) ) + PORT_DIPSETTING( 0x00, DEF_STR( On ) ) PORT_BIT( 0xfc, IP_ACTIVE_LOW, IPT_UNUSED ) INPUT_PORTS_END @@ -1300,22 +1301,80 @@ static INPUT_PORTS_START( sys386i ) INPUT_PORTS_END +static INPUT_PORTS_START( spi_mahjong_keyboard ) + PORT_START("KEY.0") + PORT_BIT( 0x00000001, IP_ACTIVE_LOW, IPT_UNKNOWN ) + PORT_BIT( 0x00000002, IP_ACTIVE_LOW, IPT_MAHJONG_PON ) + PORT_BIT( 0x00000004, IP_ACTIVE_LOW, IPT_MAHJONG_L ) + PORT_BIT( 0x00000008, IP_ACTIVE_LOW, IPT_MAHJONG_H ) + PORT_BIT( 0x00000010, IP_ACTIVE_LOW, IPT_MAHJONG_D ) + PORT_BIT( 0xffffffe0, IP_ACTIVE_LOW, IPT_UNUSED ) + + PORT_START("KEY.1") + PORT_BIT( 0x00000001, IP_ACTIVE_LOW, IPT_MAHJONG_BIG ) + PORT_BIT( 0x00000002, IP_ACTIVE_LOW, IPT_MAHJONG_FLIP_FLOP ) + PORT_BIT( 0x00000004, IP_ACTIVE_LOW, IPT_MAHJONG_DOUBLE_UP ) + PORT_BIT( 0x00000008, IP_ACTIVE_LOW, IPT_MAHJONG_SCORE ) + PORT_BIT( 0x00000010, IP_ACTIVE_LOW, IPT_MAHJONG_LAST_CHANCE ) + PORT_BIT( 0x00000020, IP_ACTIVE_LOW, IPT_MAHJONG_SMALL ) + PORT_BIT( 0xffffffc0, IP_ACTIVE_LOW, IPT_UNUSED ) + + PORT_START("KEY.2") + PORT_BIT( 0x00000001, IP_ACTIVE_LOW, IPT_MAHJONG_RON ) + PORT_BIT( 0x00000002, IP_ACTIVE_LOW, IPT_MAHJONG_CHI ) + PORT_BIT( 0x00000004, IP_ACTIVE_LOW, IPT_MAHJONG_K ) + PORT_BIT( 0x00000008, IP_ACTIVE_LOW, IPT_MAHJONG_G ) + PORT_BIT( 0x00000010, IP_ACTIVE_LOW, IPT_MAHJONG_C ) + PORT_BIT( 0xffffffe0, IP_ACTIVE_LOW, IPT_UNUSED ) + + PORT_START("KEY.3") + PORT_BIT( 0x00000001, IP_ACTIVE_LOW, IPT_MAHJONG_KAN ) + PORT_BIT( 0x00000002, IP_ACTIVE_LOW, IPT_MAHJONG_M ) + PORT_BIT( 0x00000004, IP_ACTIVE_LOW, IPT_MAHJONG_I ) + PORT_BIT( 0x00000008, IP_ACTIVE_LOW, IPT_MAHJONG_E ) + PORT_BIT( 0x00000010, IP_ACTIVE_LOW, IPT_MAHJONG_A ) + PORT_BIT( 0x00000020, IP_ACTIVE_LOW, IPT_START1 ) + PORT_BIT( 0xffffffc0, IP_ACTIVE_LOW, IPT_UNUSED ) + + PORT_START("KEY.4") + PORT_BIT( 0x00000001, IP_ACTIVE_LOW, IPT_MAHJONG_REACH ) + PORT_BIT( 0x00000002, IP_ACTIVE_LOW, IPT_MAHJONG_N ) + PORT_BIT( 0x00000004, IP_ACTIVE_LOW, IPT_MAHJONG_J ) + PORT_BIT( 0x00000008, IP_ACTIVE_LOW, IPT_MAHJONG_F ) + PORT_BIT( 0x00000010, IP_ACTIVE_LOW, IPT_MAHJONG_B ) + PORT_BIT( 0x00000020, IP_ACTIVE_LOW, IPT_MAHJONG_BET ) + PORT_BIT( 0xffffffc0, IP_ACTIVE_LOW, IPT_UNUSED ) +INPUT_PORTS_END + + static INPUT_PORTS_START( spi_ejanhs ) + PORT_INCLUDE( spi_mahjong_keyboard ) + PORT_START("INPUTS") - PORT_BIT( 0x0000003f, IP_ACTIVE_LOW, IPT_SPECIAL ) PORT_CUSTOM_MEMBER(DEVICE_SELF, seibuspi_state,ejanhs_encode, "IN0BITS") - PORT_BIT( 0x00003f00, IP_ACTIVE_LOW, IPT_SPECIAL ) PORT_CUSTOM_MEMBER(DEVICE_SELF, seibuspi_state,ejanhs_encode, "IN1BITS") + PORT_BIT( 0x00000007, IP_ACTIVE_LOW, IPT_SPECIAL ) PORT_CUSTOM_MEMBER(DEVICE_SELF, seibuspi_state,ejanhs_encode, (FPTR)3) + PORT_BIT( 0x00000038, IP_ACTIVE_LOW, IPT_SPECIAL ) PORT_CUSTOM_MEMBER(DEVICE_SELF, seibuspi_state,ejanhs_encode, (FPTR)4) + PORT_BIT( 0x00000700, IP_ACTIVE_LOW, IPT_SPECIAL ) PORT_CUSTOM_MEMBER(DEVICE_SELF, seibuspi_state,ejanhs_encode, (FPTR)2) + PORT_BIT( 0x00003800, IP_ACTIVE_LOW, IPT_SPECIAL ) PORT_CUSTOM_MEMBER(DEVICE_SELF, seibuspi_state,ejanhs_encode, (FPTR)0) PORT_BIT( 0xffff0000, IP_ACTIVE_LOW, IPT_UNUSED ) PORT_START("SYSTEM") + // These need a noncontiguous encoding, but are nonfunctional in any case + //PORT_BIT( 0x00000013, IP_ACTIVE_LOW, IPT_SPECIAL ) PORT_CUSTOM_MEMBER(DEVICE_SELF, seibuspi_state,ejanhs_encode, (FPTR)1) PORT_SERVICE_NO_TOGGLE( 0x00000004, IP_ACTIVE_LOW ) PORT_BIT( 0x00000008, IP_ACTIVE_LOW, IPT_SERVICE1 ) PORT_BIT( 0x000000f3, IP_ACTIVE_LOW, IPT_UNKNOWN ) PORT_BIT( 0xffffff00, IP_ACTIVE_LOW, IPT_UNUSED ) - PORT_START("UNKNOWN") + PORT_MODIFY("KEY.1") + PORT_BIT( 0x0000003f, IP_ACTIVE_LOW, IPT_UNUSED ) // Decoded but not recognized + + PORT_MODIFY("KEY.4") + PORT_BIT( 0x00000020, IP_ACTIVE_LOW, IPT_UNUSED ) // Decoded but not recognized + + PORT_START("EXCH") // Another set of mahjong inputs is decoded from here but not used PORT_BIT( 0xffffffff, IP_ACTIVE_LOW, IPT_UNKNOWN ) - PORT_START("JP1") + PORT_START("JUMPERS") PORT_CONFNAME( 0x03, 0x03, "JP1" ) PORT_CONFSETTING( 0x03, "Update" ) PORT_CONFSETTING( 0x01, DEF_STR( Off ) ) @@ -1326,90 +1385,25 @@ static INPUT_PORTS_START( spi_ejanhs ) PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_COIN1 ) PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_COIN2 ) PORT_BIT( 0xfc, IP_ACTIVE_LOW, IPT_UNUSED ) - - PORT_START("IN0BITS") - PORT_BIT( 0x001, IP_ACTIVE_HIGH, IPT_MAHJONG_A ) - PORT_BIT( 0x002, IP_ACTIVE_HIGH, IPT_MAHJONG_B ) - PORT_BIT( 0x004, IP_ACTIVE_HIGH, IPT_MAHJONG_E ) - PORT_BIT( 0x008, IP_ACTIVE_HIGH, IPT_MAHJONG_F ) - PORT_BIT( 0x010, IP_ACTIVE_HIGH, IPT_MAHJONG_I ) - PORT_BIT( 0x020, IP_ACTIVE_HIGH, IPT_MAHJONG_J ) - PORT_BIT( 0x040, IP_ACTIVE_HIGH, IPT_MAHJONG_M ) - PORT_BIT( 0x080, IP_ACTIVE_HIGH, IPT_MAHJONG_N ) - PORT_BIT( 0x100, IP_ACTIVE_HIGH, IPT_MAHJONG_KAN ) - PORT_BIT( 0x200, IP_ACTIVE_HIGH, IPT_MAHJONG_REACH ) - PORT_BIT( 0x400, IP_ACTIVE_HIGH, IPT_START1 ) - - PORT_START("IN1BITS") - PORT_BIT( 0x001, IP_ACTIVE_HIGH, IPT_MAHJONG_C ) - PORT_BIT( 0x002, IP_ACTIVE_HIGH, IPT_MAHJONG_D ) - PORT_BIT( 0x004, IP_ACTIVE_HIGH, IPT_MAHJONG_G ) - PORT_BIT( 0x008, IP_ACTIVE_HIGH, IPT_MAHJONG_H ) - PORT_BIT( 0x010, IP_ACTIVE_HIGH, IPT_MAHJONG_K ) - PORT_BIT( 0x020, IP_ACTIVE_HIGH, IPT_MAHJONG_L ) - PORT_BIT( 0x040, IP_ACTIVE_HIGH, IPT_MAHJONG_CHI ) - PORT_BIT( 0x080, IP_ACTIVE_HIGH, IPT_MAHJONG_PON ) - PORT_BIT( 0x100, IP_ACTIVE_HIGH, IPT_MAHJONG_RON ) INPUT_PORTS_END -static INPUT_PORTS_START( sys386f ) - PORT_START("INPUT01") - PORT_BIT( 0x00000001, IP_ACTIVE_LOW, IPT_UNKNOWN ) - PORT_BIT( 0x00000002, IP_ACTIVE_LOW, IPT_MAHJONG_PON ) - PORT_BIT( 0x00000004, IP_ACTIVE_LOW, IPT_MAHJONG_L ) - PORT_BIT( 0x00000008, IP_ACTIVE_LOW, IPT_MAHJONG_H ) - PORT_BIT( 0x00000010, IP_ACTIVE_LOW, IPT_MAHJONG_D ) - PORT_BIT( 0xffffffe0, IP_ACTIVE_LOW, IPT_UNUSED ) +static INPUT_PORTS_START( ejsakura ) + PORT_INCLUDE( spi_mahjong_keyboard ) - PORT_START("INPUT02") - PORT_BIT( 0x00000001, IP_ACTIVE_LOW, IPT_MAHJONG_BIG ) - PORT_BIT( 0x00000002, IP_ACTIVE_LOW, IPT_MAHJONG_FLIP_FLOP ) - PORT_BIT( 0x00000004, IP_ACTIVE_LOW, IPT_MAHJONG_DOUBLE_UP ) - PORT_BIT( 0x00000008, IP_ACTIVE_LOW, IPT_MAHJONG_SCORE ) - PORT_BIT( 0x00000010, IP_ACTIVE_LOW, IPT_MAHJONG_LAST_CHANCE ) - PORT_BIT( 0x00000020, IP_ACTIVE_LOW, IPT_MAHJONG_SMALL ) - PORT_BIT( 0xffffffc0, IP_ACTIVE_LOW, IPT_UNUSED ) - - PORT_START("INPUT04") - PORT_BIT( 0x00000001, IP_ACTIVE_LOW, IPT_MAHJONG_RON ) - PORT_BIT( 0x00000002, IP_ACTIVE_LOW, IPT_MAHJONG_CHI ) - PORT_BIT( 0x00000004, IP_ACTIVE_LOW, IPT_MAHJONG_K ) - PORT_BIT( 0x00000008, IP_ACTIVE_LOW, IPT_MAHJONG_G ) - PORT_BIT( 0x00000010, IP_ACTIVE_LOW, IPT_MAHJONG_C ) - PORT_BIT( 0xffffffe0, IP_ACTIVE_LOW, IPT_UNUSED ) - - PORT_START("INPUT08") - PORT_BIT( 0x00000001, IP_ACTIVE_LOW, IPT_MAHJONG_KAN ) - PORT_BIT( 0x00000002, IP_ACTIVE_LOW, IPT_MAHJONG_M ) - PORT_BIT( 0x00000004, IP_ACTIVE_LOW, IPT_MAHJONG_I ) - PORT_BIT( 0x00000008, IP_ACTIVE_LOW, IPT_MAHJONG_E ) - PORT_BIT( 0x00000010, IP_ACTIVE_LOW, IPT_MAHJONG_A ) - PORT_BIT( 0x00000020, IP_ACTIVE_LOW, IPT_START1 ) - PORT_BIT( 0xffffffc0, IP_ACTIVE_LOW, IPT_UNUSED ) - - PORT_START("INPUT10") - PORT_BIT( 0x00000001, IP_ACTIVE_LOW, IPT_MAHJONG_REACH ) - PORT_BIT( 0x00000002, IP_ACTIVE_LOW, IPT_MAHJONG_N ) - PORT_BIT( 0x00000004, IP_ACTIVE_LOW, IPT_MAHJONG_J ) - PORT_BIT( 0x00000008, IP_ACTIVE_LOW, IPT_MAHJONG_F ) - PORT_BIT( 0x00000010, IP_ACTIVE_LOW, IPT_MAHJONG_B ) - PORT_BIT( 0x00000020, IP_ACTIVE_LOW, IPT_MAHJONG_BET ) + PORT_MODIFY("KEY.4") PORT_SERVICE_NO_TOGGLE( 0x00000200, IP_ACTIVE_LOW) PORT_BIT( 0x00000800, IP_ACTIVE_LOW, IPT_SERVICE1 ) PORT_NAME("Payout") PORT_CODE(KEYCODE_Q) PORT_BIT( 0xfffff5c0, IP_ACTIVE_LOW, IPT_UNUSED ) - PORT_START("SYSTEM") + PORT_START("SPECIAL") PORT_BIT( 0x00000040, IP_ACTIVE_LOW, IPT_COIN1 ) PORT_BIT( 0x00000080, IP_ACTIVE_LOW, IPT_COIN2 ) PORT_BIT( 0x00004000, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_READ_LINE_DEVICE_MEMBER("eeprom", eeprom_serial_93cxx_device, do_read) PORT_BIT( 0xffffbf3f, IP_ACTIVE_LOW, IPT_UNUSED ) - PORT_START("INPUTS") + PORT_START("SYSTEM") PORT_BIT( 0xffffffff, IP_ACTIVE_LOW, IPT_UNUSED ) - - PORT_START("UNKNOWN") - PORT_BIT( 0xffffffff, IP_ACTIVE_LOW, IPT_UNKNOWN ) INPUT_PORTS_END @@ -4003,5 +3997,5 @@ GAME( 2000, rdft22kc, rdft2, sys386i, sys386i, seibuspi_state, rdft2, GAME( 2000, rfjet2kc, rfjet, sys386i, sys386i, seibuspi_state, rfjet, ROT270, "Seibu Kaihatsu", "Raiden Fighters Jet 2000 (China, SYS386I)", MACHINE_SUPPORTS_SAVE | MACHINE_IMPERFECT_GRAPHICS ) /* SYS386F */ -GAME( 1999, ejsakura, 0, sys386f, sys386f, seibuspi_state, sys386f, ROT0, "Seibu Kaihatsu", "E-Jan Sakurasou (Japan, SYS386F V2.0)", MACHINE_SUPPORTS_SAVE ) -GAME( 1999, ejsakura12, ejsakura, sys386f, sys386f, seibuspi_state, sys386f, ROT0, "Seibu Kaihatsu", "E-Jan Sakurasou (Japan, SYS386F V1.2)", MACHINE_SUPPORTS_SAVE ) +GAME( 1999, ejsakura, 0, sys386f, ejsakura, seibuspi_state, sys386f, ROT0, "Seibu Kaihatsu", "E-Jan Sakurasou (Japan, SYS386F V2.0)", MACHINE_SUPPORTS_SAVE ) +GAME( 1999, ejsakura12, ejsakura, sys386f, ejsakura, seibuspi_state, sys386f, ROT0, "Seibu Kaihatsu", "E-Jan Sakurasou (Japan, SYS386F V1.2)", MACHINE_SUPPORTS_SAVE ) diff --git a/src/mame/includes/seibuspi.h b/src/mame/includes/seibuspi.h index e1a13238284..074a4a2a327 100644 --- a/src/mame/includes/seibuspi.h +++ b/src/mame/includes/seibuspi.h @@ -28,7 +28,9 @@ public: m_oki1(*this, "oki1"), m_oki2(*this, "oki2"), m_gfxdecode(*this, "gfxdecode"), - m_palette(*this, "palette") + m_palette(*this, "palette"), + m_key(*this, "KEY"), + m_special(*this, "SPECIAL") { } required_device m_maincpu; @@ -45,6 +47,9 @@ public: required_device m_gfxdecode; required_device m_palette; + optional_ioport_array<5> m_key; + optional_ioport m_special; + int m_z80_prg_transfer_pos; int m_z80_lastbank; UINT8 m_sb_coin_latch;