summaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
-rw-r--r--src/mame/dynax/ddenlovr.cpp123
-rw-r--r--src/mame/dynax/dynax.cpp116
-rw-r--r--src/mame/dynax/dynax.h1
-rw-r--r--src/mame/igs/igs017.cpp2
-rw-r--r--src/mame/igs/igs_m027.cpp2
-rw-r--r--src/mame/igs/igs_m027_023vid.cpp2
-rw-r--r--src/mame/igs/igsmahjong.cpp27
-rw-r--r--src/mame/igs/igsmahjong.h (renamed from src/mame/igs/mahjong.h)6
-rw-r--r--src/mame/igs/mahjong.cpp51
-rw-r--r--src/mame/jaleco/ms32.cpp70
-rw-r--r--src/mame/jaleco/ms32.h2
-rw-r--r--src/mame/nichibutsu/nb1413m3.cpp3
-rw-r--r--src/mame/seta/ssv.cpp48
-rw-r--r--src/mame/shared/mahjong.cpp177
-rw-r--r--src/mame/shared/mahjong.h17
15 files changed, 340 insertions, 307 deletions
diff --git a/src/mame/dynax/ddenlovr.cpp b/src/mame/dynax/ddenlovr.cpp
index 548758faae6..b2aad037dc7 100644
--- a/src/mame/dynax/ddenlovr.cpp
+++ b/src/mame/dynax/ddenlovr.cpp
@@ -124,6 +124,8 @@ Notes:
#include "emu.h"
#include "dynax.h"
+#include "mahjong.h"
+
#include "cpu/m68000/m68000.h"
#include "cpu/z80/kl5c80a12.h"
#include "cpu/z80/tmpz84c015.h"
@@ -417,7 +419,7 @@ protected:
// input/output
uint8_t m_coins = 0U;
- uint8_t m_hopper = 0U;
+ uint8_t m_hopper_hack = 0U;
// blitter (TODO: merge with the dynax.h, where possible)
int m_extra_layers;
@@ -3529,7 +3531,7 @@ void ddenlovr_state::hgokou_input_w(uint8_t data)
// bit 7 = ?
machine().bookkeeping().coin_counter_w(0, BIT(data, 0));
machine().bookkeeping().coin_counter_w(1, BIT(data, 1));
- m_hopper = data & 0x04;
+ m_hopper_hack = data & 0x04;
#ifdef MAME_DEBUG
// popmessage("COINS %02x",data);
#endif
@@ -4087,7 +4089,7 @@ void ddenlovr_state::sryudens_coincounter_w(uint8_t data)
machine().bookkeeping().coin_counter_w(0, BIT(data, 0));
machine().bookkeeping().coin_counter_w(1, BIT(data, 1));
- m_hopper = data & 0x04;
+ m_hopper_hack = data & 0x04;
if (data & 0x68)
logerror("%04x: warning, coin counter = %02x\n", m_maincpu->pc(), data);
@@ -4338,40 +4340,48 @@ void htengoku_state::htengoku_coin_w(uint8_t data)
{
switch (m_input_sel)
{
- case 0x0c:
- // bit 0 = coin counter
- // bit 1 = out counter
- // bit 2 = hopper
- machine().bookkeeping().coin_counter_w(0, BIT(data, 0));
- machine().bookkeeping().coin_counter_w(1, BIT(data, 1));
- m_hopper = data & 0x04;
+ case 0x0c:
+ // bit 0 = coin counter
+ // bit 1 = out counter
+ // bit 2 = hopper
+ machine().bookkeeping().coin_counter_w(0, BIT(data, 0));
+ machine().bookkeeping().coin_counter_w(1, BIT(data, 1));
+ m_hopper->motor_w(BIT(data, 2));
#ifdef MAME_DEBUG
// popmessage("COINS %02x",data);
#endif
- m_coins = data;
- break;
+ m_coins = data;
+ break;
- case 0x0d: break; // ff resets input port sequence?
+ case 0x0d: break; // ff resets input port sequence?
- case 0xff: break; // CRT controller?
- default:
- logerror("%04x: coins_w with select = %02x, data = %02x\n", m_maincpu->pc(), m_input_sel, data);
+ case 0xff: break; // CRT controller?
+ default:
+ logerror("%04x: coins_w with select = %02x, data = %02x\n", m_maincpu->pc(), m_input_sel, data);
}
}
uint8_t htengoku_state::htengoku_input_r()
{
- static const char *const keynames0[] = { "KEY0", "KEY1", "KEY2", "KEY3", "KEY4" };
- static const char *const keynames1[] = { "KEY5", "KEY6", "KEY7", "KEY8", "KEY9" };
-
+ uint8_t result = 0xff;
switch (m_input_sel)
{
- case 0x81: return ioport(keynames1[m_keyb++])->read();
- case 0x82: return ioport(keynames0[m_keyb++])->read();
- case 0x0d: return 0xff; // unused
+ case 0x81:
+ case 0x82:
+ if (m_keyb < 5)
+ {
+ result = m_io_key[BIT(m_input_sel, 0)][m_keyb]->read();
+ if (!machine().side_effects_disabled())
+ ++m_keyb;
+ }
+ break;
+ case 0x0d:
+ result = 0xff; // unused
+ break;
+ default:
+ logerror("%04x: input_r with select = %02x\n", m_maincpu->pc(), m_input_sel);
}
- logerror("%04x: input_r with select = %02x\n", m_maincpu->pc(), m_input_sel);
- return 0xff;
+ return result;
}
uint8_t htengoku_state::htengoku_coin_r()
@@ -4380,7 +4390,7 @@ uint8_t htengoku_state::htengoku_coin_r()
{
case 0x00: return ioport("COINS")->read();
case 0x01: return 0xff; //?
- case 0x02: return 0xbf | ((m_hopper && !(m_screen->frame_number() % 10)) ? 0 : (1 << 6)); // bit 7 = blitter busy, bit 6 = hopper
+ case 0x02: return 0xbf | (m_hopper->line_r() ? 0 : (1 << 6)); // bit 7 = blitter busy, bit 6 = hopper
case 0x03: return m_coins;
}
logerror("%04x: coin_r with select = %02x\n", m_maincpu->pc(), m_input_sel);
@@ -4468,6 +4478,8 @@ void htengoku_state::htengoku(machine_config &config)
m_mainlatch->q_out_cb<2>().set(FUNC(dynax_state::layer_half2_w)); //
m_mainlatch->q_out_cb<5>().set(FUNC(dynax_state::blitter_ack_w)); // Blitter IRQ Ack
+ HOPPER(config, m_hopper, attotime::from_msec(50));
+
// video hardware
SCREEN(config, m_screen, SCREEN_TYPE_RASTER);
m_screen->set_refresh_hz(60);
@@ -4510,7 +4522,7 @@ void htengoku_state::htengoku(machine_config &config)
uint8_t ddenlovr_state::daimyojn_keyb1_r()
{
- uint8_t hopper_bit = ((m_hopper && !(m_screen->frame_number() % 10)) ? 0 : (1 << 6));
+ uint8_t hopper_bit = ((m_hopper_hack && !(m_screen->frame_number() % 10)) ? 0 : (1 << 6));
uint8_t val = hanamai_keyboard_r<1>() | hopper_bit;
// val |= ioport("BET")->read();
@@ -4975,7 +4987,8 @@ INPUT_PORTS_END
static INPUT_PORTS_START( htengoku )
PORT_START("COINS")
- PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_GAMBLE_PAYOUT ) PORT_CODE(KEYCODE_4) // pay
+ PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_GAMBLE_PAYOUT ) PORT_CODE(KEYCODE_4) PORT_CONDITION("DSW4", 0x10, EQUALS, 0x00) // pay
+ PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_GAMBLE_KEYOUT ) PORT_CONDITION("DSW4", 0x10, EQUALS, 0x10)
PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_UNKNOWN )
PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_SERVICE ) PORT_NAME(DEF_STR( Test )) PORT_TOGGLE
PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_GAMBLE_BOOK ) // analyzer
@@ -5046,10 +5059,10 @@ static INPUT_PORTS_START( htengoku )
PORT_DIPNAME( 0x04, 0x04, "Credits Per Note" )
PORT_DIPSETTING( 0x00, "5" )
PORT_DIPSETTING( 0x04, "10" )
- PORT_DIPNAME( 0x08, 0x08, "Max Rate" )
+ PORT_DIPNAME( 0x08, 0x08, "Maximum Bet" )
PORT_DIPSETTING( 0x08, "5" )
PORT_DIPSETTING( 0x00, "10" )
- PORT_DIPNAME( 0x30, 0x30, "Min Rate To Play" )
+ PORT_DIPNAME( 0x30, 0x30, "Minimum Bet" )
PORT_DIPSETTING( 0x30, "1" )
PORT_DIPSETTING( 0x20, "2" )
PORT_DIPSETTING( 0x10, "3" )
@@ -5094,8 +5107,8 @@ static INPUT_PORTS_START( htengoku )
PORT_DIPNAME( 0x08, 0x08, "Unknown 2-9" )
PORT_DIPSETTING( 0x08, DEF_STR( Off ) )
PORT_DIPSETTING( 0x00, DEF_STR( On ) )
- PORT_DIPNAME( 0x10, 0x10, "Pay Out Type" )
- PORT_DIPSETTING( 0x10, "Credit" )
+ PORT_DIPNAME( 0x10, 0x10, "Payout Mode" )
+ PORT_DIPSETTING( 0x10, "Key-out" )
PORT_DIPSETTING( 0x00, "Hopper" )
PORT_DIPNAME( 0x20, 0x20, "Hopper Switch" )
PORT_DIPSETTING( 0x20, "Active Low" )
@@ -6264,7 +6277,7 @@ static INPUT_PORTS_START( mjreach1 )
PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_COIN1)
PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNKNOWN)
- PORT_INCLUDE( dynax_mahjong_keys_bet )
+ PORT_INCLUDE( mahjong_matrix_2p_bet )
PORT_START("DSW1")
PORT_DIPNAME( 0x0f, 0x07, "Pay Out Rate (%)" )
@@ -6419,7 +6432,7 @@ static INPUT_PORTS_START( jongtei )
PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_COIN1)
PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNKNOWN)
- PORT_INCLUDE( dynax_mahjong_keys_bet )
+ PORT_INCLUDE( mahjong_matrix_2p_bet )
PORT_START("DSW1")
PORT_DIPNAME( 0x0f, 0x07, "Pay Out Rate (%)" )
@@ -6630,7 +6643,7 @@ static INPUT_PORTS_START( mjchuuka )
PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_COIN1)
PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNKNOWN)
- PORT_INCLUDE( dynax_mahjong_keys_bet )
+ PORT_INCLUDE( mahjong_matrix_2p_bet )
PORT_START("DSW1")
PORT_DIPNAME( 0x0f, 0x07, "Pay Out Rate (%)" )
@@ -6785,7 +6798,7 @@ static INPUT_PORTS_START( mjschuka )
PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_COIN1)
PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNKNOWN)
- PORT_INCLUDE( dynax_mahjong_keys_bet )
+ PORT_INCLUDE( mahjong_matrix_2p_bet )
PORT_START("DSW1")
PORT_DIPNAME( 0x0f, 0x07, "Pay Out Rate (%)" )
@@ -7041,7 +7054,7 @@ static INPUT_PORTS_START( mjmyster )
PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_COIN1)
PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNKNOWN)
- PORT_INCLUDE( dynax_mahjong_keys_bet )
+ PORT_INCLUDE( mahjong_matrix_2p_bet )
PORT_START("DSW1")
PORT_DIPNAME( 0x0f, 0x07, "Pay Out Rate (%)" )
@@ -7399,7 +7412,7 @@ static INPUT_PORTS_START( hgokou )
PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_SERVICE ) PORT_NAME(DEF_STR( Test ))
PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_GAMBLE_BOOK ) // analyzer
PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_MEMORY_RESET ) // data clear
- PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_BILL1 ) PORT_CODE(KEYCODE_6) // note
+ PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_GAMBLE_KEYIN )
PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_COIN1 )
PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNKNOWN )
@@ -7429,9 +7442,15 @@ static INPUT_PORTS_START( hgokou )
PORT_DIPSETTING( 0x40, "75%" )
PORT_DIPSETTING( 0x20, "70%" )
PORT_DIPSETTING( 0x00, "65%" ) // Hard
- PORT_DIPNAME( 0x80, 0x80, "Key-in Rate ?" ) PORT_DIPLOCATION("SW1:8") // What is this? Manual says キ一インレ一ト
- PORT_DIPSETTING( 0x80, "x10" )
- PORT_DIPSETTING( 0x00, "x5" )
+ PORT_DIPNAME( 0x80, 0x80, "Key-in Rate" ) PORT_DIPLOCATION("SW1:8")
+ PORT_DIPSETTING( 0x00, "5" ) PORT_CONDITION("DSW2", 0x03, EQUALS, 0x03)
+ PORT_DIPSETTING( 0x00, "10" ) PORT_CONDITION("DSW2", 0x03, EQUALS, 0x02)
+ PORT_DIPSETTING( 0x00, "25" ) PORT_CONDITION("DSW2", 0x03, EQUALS, 0x01)
+ PORT_DIPSETTING( 0x00, "50" ) PORT_CONDITION("DSW2", 0x03, EQUALS, 0x00)
+ PORT_DIPSETTING( 0x80, "10" ) PORT_CONDITION("DSW2", 0x03, EQUALS, 0x03)
+ PORT_DIPSETTING( 0x80, "20" ) PORT_CONDITION("DSW2", 0x03, EQUALS, 0x02)
+ PORT_DIPSETTING( 0x80, "50" ) PORT_CONDITION("DSW2", 0x03, EQUALS, 0x01)
+ PORT_DIPSETTING( 0x80, "100" ) PORT_CONDITION("DSW2", 0x03, EQUALS, 0x00)
PORT_START("DSW2")
PORT_DIPNAME( 0x03, 0x03, DEF_STR( Coinage ) ) PORT_DIPLOCATION("SW2:1,2")
@@ -7439,7 +7458,7 @@ static INPUT_PORTS_START( hgokou )
PORT_DIPSETTING( 0x02, DEF_STR( 1C_2C ) )
PORT_DIPSETTING( 0x01, DEF_STR( 1C_5C ) )
PORT_DIPSETTING( 0x00, "1 Coin 10 Credits" )
- PORT_DIPNAME( 0x0c, 0x0c, "Start Level" ) PORT_DIPLOCATION("SW2:3,4")
+ PORT_DIPNAME( 0x0c, 0x0c, "Minimum Bet" ) PORT_DIPLOCATION("SW2:3,4")
PORT_DIPSETTING( 0x0c, "1" )
PORT_DIPSETTING( 0x08, "2" )
PORT_DIPSETTING( 0x04, "3" )
@@ -7520,9 +7539,9 @@ static INPUT_PORTS_START( hgokou )
PORT_DIPSETTING( 0x20, "30" )
PORT_DIPSETTING( 0x10, "40" )
PORT_DIPSETTING( 0x00, "50" )
- PORT_DIPNAME( 0x40, 0x40, "Max Bet" ) PORT_DIPLOCATION("SW1:9")
- PORT_DIPSETTING( 0x40, "10" )
+ PORT_DIPNAME( 0x40, 0x40, "Maximum Bet" ) PORT_DIPLOCATION("SW1:9")
PORT_DIPSETTING( 0x00, "5" )
+ PORT_DIPSETTING( 0x40, "10" )
PORT_DIPNAME( 0x80, 0x80, DEF_STR( Flip_Screen ) ) PORT_DIPLOCATION("SW1:10")
PORT_DIPSETTING( 0x80, DEF_STR( Off ) )
PORT_DIPSETTING( 0x00, DEF_STR( On ) )
@@ -7539,7 +7558,7 @@ static INPUT_PORTS_START( mjmyornt )
PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_COIN1 )
PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_SERVICE1 )
- PORT_INCLUDE( dynax_mahjong_keys_bet )
+ PORT_INCLUDE( mahjong_matrix_2p_bet )
PORT_START("DSW1")
PORT_DIPNAME( 0x0f, 0x07, "Pay Out Rate (%)" ) PORT_DIPLOCATION("SW1:1,2,3,4")
@@ -7782,7 +7801,7 @@ static INPUT_PORTS_START( mjflove )
PORT_BIT( 0x60, IP_ACTIVE_HIGH, IPT_CUSTOM ) PORT_CUSTOM_MEMBER(FUNC(ddenlovr_state::mjflove_blitter_r)) // RTC (bit 5) & blitter irq flag (bit 6)
PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_CUSTOM ) // blitter busy flag
- PORT_INCLUDE( dynax_mahjong_keys_bet )
+ PORT_INCLUDE( mahjong_matrix_2p_bet )
PORT_START("DSW2") // IN12 - DSW2
PORT_DIPNAME( 0x03, 0x03, DEF_STR( Coinage ) ) PORT_DIPLOCATION("SW1:1,2")
@@ -8023,7 +8042,7 @@ static INPUT_PORTS_START( sryudens )
PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_COIN1 )
PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_COIN3 ) // note2
- PORT_INCLUDE( dynax_mahjong_keys_bet )
+ PORT_INCLUDE( mahjong_matrix_2p_bet )
PORT_START("DSW1")
PORT_DIPNAME( 0x0f, 0x07, "Pay Out Rate (%)" )
@@ -8178,7 +8197,7 @@ static INPUT_PORTS_START( seljan2 )
PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_COIN1 ) PORT_IMPULSE(5)
PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_COIN3 ) // note2
- PORT_INCLUDE( dynax_mahjong_keys_bet )
+ PORT_INCLUDE( mahjong_matrix_2p_bet )
PORT_START("DSW1")
PORT_DIPNAME( 0x0f, 0x07, "Pay Out Rate (%)" )
@@ -8333,7 +8352,7 @@ static INPUT_PORTS_START( janshinp )
PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_COIN1 )
PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_COIN3 ) // service coin (test mode)
- PORT_INCLUDE( dynax_mahjong_keys_bet )
+ PORT_INCLUDE( mahjong_matrix_2p_bet )
PORT_START("DSW1")
PORT_DIPNAME( 0x0f, 0x07, "Pay Out Rate (%)" )
@@ -8487,7 +8506,7 @@ static INPUT_PORTS_START( dtoyoken )
PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_COIN1 )
PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_COIN3 ) // service coin (test mode)
- PORT_INCLUDE( dynax_mahjong_keys_bet )
+ PORT_INCLUDE( mahjong_matrix_2p_bet )
PORT_START("DSW1")
PORT_DIPNAME( 0x0f, 0x07, "Pay Out Rate (%)" )
@@ -8641,7 +8660,7 @@ static INPUT_PORTS_START( daimyojn )
PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_COIN1 ) PORT_IMPULSE(5)
PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_COIN3 ) // note2
- PORT_INCLUDE( dynax_mahjong_keys_bet )
+ PORT_INCLUDE( mahjong_matrix_2p_bet )
PORT_START("DSW1")
PORT_DIPNAME( 0x0f, 0x07, "Pay Out Rate (%)" )
@@ -8800,7 +8819,7 @@ MACHINE_START_MEMBER(ddenlovr_state,ddenlovr)
save_item(NAME(m_dsw_sel));
save_item(NAME(m_keyb));
save_item(NAME(m_coins));
- save_item(NAME(m_hopper));
+ save_item(NAME(m_hopper_hack));
save_item(NAME(m_okibank));
@@ -8819,7 +8838,7 @@ MACHINE_RESET_MEMBER(ddenlovr_state,ddenlovr)
m_dsw_sel = 0;
m_keyb = 0;
m_coins = 0;
- m_hopper = 0;
+ m_hopper_hack = 0;
m_okibank = 0;
m_prot_val = 0;
diff --git a/src/mame/dynax/dynax.cpp b/src/mame/dynax/dynax.cpp
index bb2ff1d1aae..9846714b61a 100644
--- a/src/mame/dynax/dynax.cpp
+++ b/src/mame/dynax/dynax.cpp
@@ -82,6 +82,8 @@ TODO:
#include "emu.h"
#include "dynax.h"
+#include "mahjong.h"
+
#include "cpu/tlcs90/tlcs90.h"
#include "cpu/z80/z80.h"
#include "cpu/z80/tmpz84c015.h"
@@ -1399,107 +1401,13 @@ void cdracula_state::cdracula_io_map(address_map &map)
***************************************************************************/
INPUT_PORTS_START( dynax_mahjong_keys )
- PORT_START("KEY0")
- PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_MAHJONG_A ) PORT_PLAYER(1)
- PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_MAHJONG_E ) PORT_PLAYER(1)
- PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_MAHJONG_I ) PORT_PLAYER(1)
- PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_MAHJONG_M ) PORT_PLAYER(1)
- PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_MAHJONG_KAN ) PORT_PLAYER(1)
- PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_START1 )
-
- PORT_START("KEY1")
- PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_MAHJONG_B ) PORT_PLAYER(1)
- PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_MAHJONG_F ) PORT_PLAYER(1)
- PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_MAHJONG_J ) PORT_PLAYER(1)
- PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_MAHJONG_N ) PORT_PLAYER(1)
- PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_MAHJONG_REACH ) PORT_PLAYER(1)
- PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_UNKNOWN )
-
- PORT_START("KEY2")
- PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_MAHJONG_C ) PORT_PLAYER(1)
- PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_MAHJONG_G ) PORT_PLAYER(1)
- PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_MAHJONG_K ) PORT_PLAYER(1)
- PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_MAHJONG_CHI ) PORT_PLAYER(1)
- PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_MAHJONG_RON ) PORT_PLAYER(1)
- PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_UNKNOWN )
-
- PORT_START("KEY3")
- PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_MAHJONG_D ) PORT_PLAYER(1)
- PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_MAHJONG_H ) PORT_PLAYER(1)
- PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_MAHJONG_L ) PORT_PLAYER(1)
- PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_MAHJONG_PON ) PORT_PLAYER(1)
- PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_UNKNOWN )
- PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_UNKNOWN )
-
- PORT_START("KEY4")
- PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_MAHJONG_LAST_CHANCE ) PORT_PLAYER(1) // "l"
- PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_UNKNOWN )
- PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_UNKNOWN )
- PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_MAHJONG_FLIP_FLOP ) PORT_PLAYER(1) // "f"
- PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_UNKNOWN )
- PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_UNKNOWN )
-
- PORT_START("KEY5")
- PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_MAHJONG_A ) PORT_PLAYER(2)
- PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_MAHJONG_E ) PORT_PLAYER(2)
- PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_MAHJONG_I ) PORT_PLAYER(2)
- PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_MAHJONG_M ) PORT_PLAYER(2)
- PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_MAHJONG_KAN ) PORT_PLAYER(2)
- PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_START2 )
-
- PORT_START("KEY6")
- PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_MAHJONG_B ) PORT_PLAYER(2)
- PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_MAHJONG_F ) PORT_PLAYER(2)
- PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_MAHJONG_J ) PORT_PLAYER(2)
- PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_MAHJONG_N ) PORT_PLAYER(2)
- PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_MAHJONG_REACH ) PORT_PLAYER(2)
- PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_UNKNOWN )
-
- PORT_START("KEY7")
- PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_MAHJONG_C ) PORT_PLAYER(2)
- PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_MAHJONG_G ) PORT_PLAYER(2)
- PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_MAHJONG_K ) PORT_PLAYER(2)
- PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_MAHJONG_CHI ) PORT_PLAYER(2)
- PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_MAHJONG_RON ) PORT_PLAYER(2)
- PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_UNKNOWN )
-
- PORT_START("KEY8")
- PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_MAHJONG_D ) PORT_PLAYER(2)
- PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_MAHJONG_H ) PORT_PLAYER(2)
- PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_MAHJONG_L ) PORT_PLAYER(2)
- PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_MAHJONG_PON ) PORT_PLAYER(2)
- PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_UNKNOWN )
- PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_UNKNOWN )
-
- PORT_START("KEY9")
- PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_MAHJONG_LAST_CHANCE ) PORT_PLAYER(2) // "l"
- PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_UNKNOWN )
- PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_UNKNOWN )
- PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_MAHJONG_FLIP_FLOP ) PORT_PLAYER(2) // "f"
- PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_UNKNOWN )
- PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_UNKNOWN )
-INPUT_PORTS_END
-
-INPUT_PORTS_START( dynax_mahjong_keys_bet )
- PORT_INCLUDE( dynax_mahjong_keys )
-
- PORT_MODIFY("KEY1")
- PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_MAHJONG_BET ) PORT_PLAYER(1)
+ PORT_INCLUDE( mahjong_matrix_2p_ff )
PORT_MODIFY("KEY4")
- PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_MAHJONG_SCORE ) PORT_PLAYER(1) // "t"
- PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_MAHJONG_DOUBLE_UP ) PORT_PLAYER(1) // "w"
- PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_MAHJONG_BIG ) PORT_PLAYER(1) // "b"
- PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_MAHJONG_SMALL ) PORT_PLAYER(1) // "s"
-
- PORT_MODIFY("KEY6")
- PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_MAHJONG_BET ) PORT_PLAYER(2)
+ PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_MAHJONG_LAST_CHANCE )
PORT_MODIFY("KEY9")
- PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_MAHJONG_SCORE ) PORT_PLAYER(2) // "t"
- PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_MAHJONG_DOUBLE_UP ) PORT_PLAYER(2) // "w"
- PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_MAHJONG_BIG ) PORT_PLAYER(2) // "b"
- PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_MAHJONG_SMALL ) PORT_PLAYER(2) // "s"
+ PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_MAHJONG_LAST_CHANCE ) PORT_PLAYER(2)
INPUT_PORTS_END
static INPUT_PORTS_START( dynax_hanafuda_keys )
@@ -3119,7 +3027,7 @@ static INPUT_PORTS_START( mjembase )
MAHJONG_COIN_TEST("DSW1", 0x40)
- PORT_INCLUDE( dynax_mahjong_keys_bet )
+ PORT_INCLUDE( mahjong_matrix_2p_bet )
INPUT_PORTS_END
@@ -3127,7 +3035,7 @@ INPUT_PORTS_END
static INPUT_PORTS_START( mjelct3 )
MAHJONG_COIN_TEST("DSW1", 0x40)
- PORT_INCLUDE( dynax_mahjong_keys_bet )
+ PORT_INCLUDE( mahjong_matrix_2p_bet )
PORT_START("SW1") // port 85
PORT_DIPUNKNOWN_DIPLOC(0x01, 0x01, "SW1:1")
@@ -3226,7 +3134,7 @@ static INPUT_PORTS_START( mjelctrn )
PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_COIN1 ) // Coin
PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_SERVICE1 ) // Service
- PORT_INCLUDE( dynax_mahjong_keys_bet )
+ PORT_INCLUDE( mahjong_matrix_2p_bet )
PORT_START("SW1") // port 85
PORT_DIPUNKNOWN_DIPLOC(0x01, 0x01, "SW1:1")
@@ -3406,7 +3314,7 @@ static INPUT_PORTS_START( majxtal7 )
PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_COIN1 ) // Coin
PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_SERVICE1 ) // Service
- PORT_INCLUDE( dynax_mahjong_keys_bet )
+ PORT_INCLUDE( mahjong_matrix_2p_bet )
PORT_START("DSW2") /* select = 80 */
PORT_DIPNAME( 0x07, 0x07, "YAKUMAN Bonus" )
@@ -3668,7 +3576,7 @@ static INPUT_PORTS_START( tenkai )
MAHJONG_COIN_TEST("DSW2", 0x01)
- PORT_INCLUDE( dynax_mahjong_keys_bet )
+ PORT_INCLUDE( mahjong_matrix_2p_bet )
INPUT_PORTS_END
@@ -3872,7 +3780,7 @@ static INPUT_PORTS_START( mjreach )
PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_COIN1 ) // Coin
PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_SERVICE1 ) // Service
- PORT_INCLUDE( dynax_mahjong_keys_bet )
+ PORT_INCLUDE( mahjong_matrix_2p_bet )
INPUT_PORTS_END
static INPUT_PORTS_START( gekisha )
@@ -3964,7 +3872,7 @@ static INPUT_PORTS_START( gekisha )
PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_COIN1 ) // Coin
PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNKNOWN )
- PORT_INCLUDE( dynax_mahjong_keys_bet )
+ PORT_INCLUDE( mahjong_matrix_2p_bet )
INPUT_PORTS_END
diff --git a/src/mame/dynax/dynax.h b/src/mame/dynax/dynax.h
index 2bd18221997..061a660a6b3 100644
--- a/src/mame/dynax/dynax.h
+++ b/src/mame/dynax/dynax.h
@@ -460,7 +460,6 @@ private:
INPUT_PORTS_EXTERN(dynax_mahjong_keys);
-INPUT_PORTS_EXTERN(dynax_mahjong_keys_bet);
INPUT_PORTS_EXTERN(dynax_hanafuda_keys_bet);
#endif // MAME_DYNAX_DYNAX_H
diff --git a/src/mame/igs/igs017.cpp b/src/mame/igs/igs017.cpp
index 59e5ac9b6a1..0083fe0724f 100644
--- a/src/mame/igs/igs017.cpp
+++ b/src/mame/igs/igs017.cpp
@@ -82,7 +82,7 @@ Notes:
#include "igs017_igs031.h"
#include "igs022.h"
-#include "mahjong.h"
+#include "igsmahjong.h"
#include "cpu/m68000/m68000.h"
#include "cpu/z180/z180.h"
diff --git a/src/mame/igs/igs_m027.cpp b/src/mame/igs/igs_m027.cpp
index 031b3e4578d..354012f5304 100644
--- a/src/mame/igs/igs_m027.cpp
+++ b/src/mame/igs/igs_m027.cpp
@@ -87,7 +87,7 @@
#include "igs017_igs031.h"
#include "igs027a.h"
-#include "mahjong.h"
+#include "igsmahjong.h"
#include "pgmcrypt.h"
#include "machine/i8255.h"
diff --git a/src/mame/igs/igs_m027_023vid.cpp b/src/mame/igs/igs_m027_023vid.cpp
index bf690cec2b2..25cd409e683 100644
--- a/src/mame/igs/igs_m027_023vid.cpp
+++ b/src/mame/igs/igs_m027_023vid.cpp
@@ -31,7 +31,7 @@ Notes:
#include "igs023_video.h"
#include "igs027a.h"
-#include "mahjong.h"
+#include "igsmahjong.h"
#include "pgmcrypt.h"
#include "machine/i8255.h"
diff --git a/src/mame/igs/igsmahjong.cpp b/src/mame/igs/igsmahjong.cpp
new file mode 100644
index 00000000000..1e25adec847
--- /dev/null
+++ b/src/mame/igs/igsmahjong.cpp
@@ -0,0 +1,27 @@
+// license:BSD-3-Clause
+// copyright-holders:Luca Elia, Vas Crabb
+#include "emu.h"
+#include "igsmahjong.h"
+
+#include "mahjong.h"
+
+
+INPUT_PORTS_START( igs_mahjong_matrix )
+ PORT_INCLUDE(mahjong_matrix_1p_bet)
+
+ PORT_MODIFY("KEY0")
+ PORT_BIT(0xc0, IP_ACTIVE_LOW, IPT_UNKNOWN)
+
+ PORT_MODIFY("KEY1")
+ PORT_BIT(0xc0, IP_ACTIVE_LOW, IPT_UNKNOWN)
+
+ PORT_MODIFY("KEY2")
+ PORT_BIT(0xc0, IP_ACTIVE_LOW, IPT_UNKNOWN)
+
+ PORT_MODIFY("KEY3")
+ PORT_BIT(0xc0, IP_ACTIVE_LOW, IPT_UNKNOWN)
+
+ PORT_MODIFY("KEY4")
+ PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_UNUSED) // no Flip Flop key
+ PORT_BIT(0xc0, IP_ACTIVE_LOW, IPT_UNKNOWN)
+INPUT_PORTS_END
diff --git a/src/mame/igs/mahjong.h b/src/mame/igs/igsmahjong.h
index 2a50bd8a4a7..741144b5738 100644
--- a/src/mame/igs/mahjong.h
+++ b/src/mame/igs/igsmahjong.h
@@ -1,7 +1,7 @@
// license:BSD-3-Clause
// copyright-holders:Luca Elia, Vas Crabb
-#ifndef MAME_IGS_MAHJONG_H
-#define MAME_IGS_MAHJONG_H
+#ifndef MAME_IGS_IGSMAHJONG_H
+#define MAME_IGS_IGSMAHJONG_H
#define IGS_MAHJONG_MATRIX_CONDITIONAL(port, mask, on) \
PORT_START("KEY0") \
@@ -50,4 +50,4 @@
INPUT_PORTS_EXTERN(igs_mahjong_matrix);
-#endif // MAME_IGS_MAHJONG_H
+#endif // MAME_IGS_IGSMAHJONG_H
diff --git a/src/mame/igs/mahjong.cpp b/src/mame/igs/mahjong.cpp
deleted file mode 100644
index fe619a7c03c..00000000000
--- a/src/mame/igs/mahjong.cpp
+++ /dev/null
@@ -1,51 +0,0 @@
-// license:BSD-3-Clause
-// copyright-holders:Luca Elia, Vas Crabb
-#include "emu.h"
-#include "mahjong.h"
-
-
-INPUT_PORTS_START( igs_mahjong_matrix )
- // // Traditional Simplified English
-
- PORT_START("KEY0")
- PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_MAHJONG_A)
- PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_MAHJONG_E)
- PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_MAHJONG_I)
- PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_MAHJONG_M)
- PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_MAHJONG_KAN) // 槓 杠 GUN
- PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_START1) // 開始 开始 START
- PORT_BIT(0xc0, IP_ACTIVE_LOW, IPT_UNKNOWN)
-
- PORT_START("KEY1")
- PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_MAHJONG_B)
- PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_MAHJONG_F)
- PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_MAHJONG_J)
- PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_MAHJONG_N)
- PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_MAHJONG_REACH) // 聽 听 LISTEN
- PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_MAHJONG_BET) // 押注/押 押注/押 BET
- PORT_BIT(0xc0, IP_ACTIVE_LOW, IPT_UNKNOWN)
-
- PORT_START("KEY2")
- PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_MAHJONG_C)
- PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_MAHJONG_G)
- PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_MAHJONG_K)
- PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_MAHJONG_CHI) // 吃 吃 EAT
- PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_MAHJONG_RON) // 胡 胡 WHO
- PORT_BIT(0xe0, IP_ACTIVE_LOW, IPT_UNKNOWN)
-
- PORT_START("KEY3")
- PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_MAHJONG_D)
- PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_MAHJONG_H)
- PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_MAHJONG_L)
- PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_MAHJONG_PON) // 碰 碰 PON
- PORT_BIT(0xf0, IP_ACTIVE_LOW, IPT_UNKNOWN)
-
- PORT_START("KEY4")
- PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_MAHJONG_LAST_CHANCE) // 海底 海底
- PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_MAHJONG_SCORE) // 得分 續玩 TAKE
- PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_MAHJONG_DOUBLE_UP) // 比倍/續玩 比倍/续玩 DUP
- PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_UNKNOWN)
- PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_MAHJONG_BIG) // 大/左 大/左 BIG
- PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_MAHJONG_SMALL) // 小/右 小/右 SMALL
- PORT_BIT(0xc0, IP_ACTIVE_LOW, IPT_UNKNOWN)
-INPUT_PORTS_END
diff --git a/src/mame/jaleco/ms32.cpp b/src/mame/jaleco/ms32.cpp
index bcd25792b6c..008bd2c20a1 100644
--- a/src/mame/jaleco/ms32.cpp
+++ b/src/mame/jaleco/ms32.cpp
@@ -473,6 +473,8 @@ Notes from Charles MacDonald
#include "ms32.h"
#include "jalcrpt.h"
+#include "mahjong.h"
+
#include "cpu/z80/z80.h"
#include "cpu/v60/v60.h"
#include "speaker.h"
@@ -492,7 +494,7 @@ ioport_value ms32_state::mahjong_ctrl_r()
mj_input &= m_io_mj[i]->read();
}
- return mj_input;
+ return bitswap<8>(mj_input, 6, 5, 4, 2, 3, 1, 0, 7);
}
void ms32_base_state::sound_command_w(u32 data)
@@ -960,55 +962,23 @@ static INPUT_PORTS_START( ms32_mahjong )
PORT_BIT( 0x00400000, IP_ACTIVE_LOW, IPT_UNKNOWN )
PORT_BIT( 0x00800000, IP_ACTIVE_LOW, IPT_UNKNOWN )
- PORT_START("MJ0")
- PORT_BIT( 0x00000001, IP_ACTIVE_LOW, IPT_START1 )
- PORT_BIT( 0x00000002, IP_ACTIVE_LOW, IPT_MAHJONG_A )
- PORT_BIT( 0x00000004, IP_ACTIVE_LOW, IPT_MAHJONG_E )
- PORT_BIT( 0x00000008, IP_ACTIVE_LOW, IPT_MAHJONG_M )
- PORT_BIT( 0x00000010, IP_ACTIVE_LOW, IPT_MAHJONG_I )
- PORT_BIT( 0x00000020, IP_ACTIVE_LOW, IPT_MAHJONG_KAN )
- PORT_BIT( 0x00000040, IP_ACTIVE_LOW, IPT_UNKNOWN )
- PORT_BIT( 0x00000080, IP_ACTIVE_LOW, IPT_UNKNOWN )
-
- PORT_START("MJ1")
- PORT_BIT( 0x00000001, IP_ACTIVE_LOW, IPT_UNKNOWN )
- PORT_BIT( 0x00000002, IP_ACTIVE_LOW, IPT_MAHJONG_B )
- PORT_BIT( 0x00000004, IP_ACTIVE_LOW, IPT_MAHJONG_F )
- PORT_BIT( 0x00000008, IP_ACTIVE_LOW, IPT_MAHJONG_N )
- PORT_BIT( 0x00000010, IP_ACTIVE_LOW, IPT_MAHJONG_J )
- PORT_BIT( 0x00000020, IP_ACTIVE_LOW, IPT_MAHJONG_REACH )
- PORT_BIT( 0x00000040, IP_ACTIVE_LOW, IPT_UNKNOWN )
- PORT_BIT( 0x00000080, IP_ACTIVE_LOW, IPT_UNKNOWN )
-
- PORT_START("MJ2")
- PORT_BIT( 0x00000001, IP_ACTIVE_LOW, IPT_UNKNOWN )
- PORT_BIT( 0x00000002, IP_ACTIVE_LOW, IPT_MAHJONG_C )
- PORT_BIT( 0x00000004, IP_ACTIVE_LOW, IPT_MAHJONG_G )
- PORT_BIT( 0x00000008, IP_ACTIVE_LOW, IPT_MAHJONG_CHI )
- PORT_BIT( 0x00000010, IP_ACTIVE_LOW, IPT_MAHJONG_K )
- PORT_BIT( 0x00000020, IP_ACTIVE_LOW, IPT_MAHJONG_RON )
- PORT_BIT( 0x00000040, IP_ACTIVE_LOW, IPT_UNKNOWN )
- PORT_BIT( 0x00000080, IP_ACTIVE_LOW, IPT_UNKNOWN )
-
- PORT_START("MJ3")
- PORT_BIT( 0x00000001, IP_ACTIVE_LOW, IPT_UNKNOWN )
- PORT_BIT( 0x00000002, IP_ACTIVE_LOW, IPT_MAHJONG_D )
- PORT_BIT( 0x00000004, IP_ACTIVE_LOW, IPT_MAHJONG_H )
- PORT_BIT( 0x00000008, IP_ACTIVE_LOW, IPT_MAHJONG_PON )
- PORT_BIT( 0x00000010, IP_ACTIVE_LOW, IPT_MAHJONG_L )
- PORT_BIT( 0x00000020, IP_ACTIVE_LOW, IPT_UNKNOWN )
- PORT_BIT( 0x00000040, IP_ACTIVE_LOW, IPT_UNKNOWN )
- PORT_BIT( 0x00000080, IP_ACTIVE_LOW, IPT_UNKNOWN )
-
- PORT_START("MJ4")
- PORT_BIT( 0x00000001, IP_ACTIVE_LOW, IPT_UNKNOWN )
- PORT_BIT( 0x00000002, IP_ACTIVE_LOW, IPT_UNKNOWN )
- PORT_BIT( 0x00000004, IP_ACTIVE_LOW, IPT_UNKNOWN )
- PORT_BIT( 0x00000008, IP_ACTIVE_LOW, IPT_UNKNOWN )
- PORT_BIT( 0x00000010, IP_ACTIVE_LOW, IPT_UNKNOWN )
- PORT_BIT( 0x00000020, IP_ACTIVE_LOW, IPT_UNKNOWN )
- PORT_BIT( 0x00000040, IP_ACTIVE_LOW, IPT_UNKNOWN )
- PORT_BIT( 0x00000080, IP_ACTIVE_LOW, IPT_UNKNOWN )
+ PORT_INCLUDE(mahjong_matrix_1p)
+
+ PORT_MODIFY("KEY0")
+ PORT_BIT( 0x00000060, IP_ACTIVE_LOW, IPT_UNUSED )
+ PORT_BIT( 0x00000080, IP_ACTIVE_LOW, IPT_START1 ) // rotated into LSB
+
+ PORT_MODIFY("KEY1")
+ PORT_BIT( 0x000000c0, IP_ACTIVE_LOW, IPT_UNUSED )
+
+ PORT_MODIFY("KEY2")
+ PORT_BIT( 0x000000c0, IP_ACTIVE_LOW, IPT_UNUSED )
+
+ PORT_MODIFY("KEY3")
+ PORT_BIT( 0x000000c0, IP_ACTIVE_LOW, IPT_UNUSED )
+
+ PORT_MODIFY("KEY4")
+ PORT_BIT( 0x000000c0, IP_ACTIVE_LOW, IPT_UNUSED )
INPUT_PORTS_END
/*************************************
diff --git a/src/mame/jaleco/ms32.h b/src/mame/jaleco/ms32.h
index 6591ee88947..4ae4a7021cc 100644
--- a/src/mame/jaleco/ms32.h
+++ b/src/mame/jaleco/ms32.h
@@ -80,7 +80,7 @@ public:
, m_sprram(*this, "sprram", 0x10000, ENDIANNESS_LITTLE)
, m_txram(*this, "txram", 0x4000, ENDIANNESS_LITTLE)
, m_bgram(*this, "bgram", 0x4000, ENDIANNESS_LITTLE)
- , m_io_mj(*this, "MJ%u", 0U)
+ , m_io_mj(*this, "KEY%u", 0U)
{ }
void ms32(machine_config &config);
diff --git a/src/mame/nichibutsu/nb1413m3.cpp b/src/mame/nichibutsu/nb1413m3.cpp
index d0d1e7d90a9..7fb227deb74 100644
--- a/src/mame/nichibutsu/nb1413m3.cpp
+++ b/src/mame/nichibutsu/nb1413m3.cpp
@@ -635,7 +635,8 @@ void nb1413m3_device::vcrctrl_w(uint8_t data)
}
}
-/* Nichibutsu Mahjong games share a common control panel */
+// Nichibutsu Mahjong games share a common control panel
+// The bit order is the opposite of Dynax/IGS
INPUT_PORTS_START( nbmjcontrols )
PORT_START("KEY0")
PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_START1 )
diff --git a/src/mame/seta/ssv.cpp b/src/mame/seta/ssv.cpp
index 13745eb33a0..f89c365af2b 100644
--- a/src/mame/seta/ssv.cpp
+++ b/src/mame/seta/ssv.cpp
@@ -165,6 +165,8 @@ Notes:
#include "emu.h"
#include "ssv.h"
+#include "mahjong.h"
+
#include "cpu/v810/v810.h"
#include "cpu/v60/v60.h"
#include "machine/nvram.h"
@@ -511,12 +513,12 @@ uint16_t ssv_state::hypreact_input_r()
{
const uint16_t input_sel = *m_input_sel;
- uint16_t result = 0xffff;
+ uint16_t result = 0x3f;
if (BIT(input_sel, 0)) result &= m_io_key[0]->read();
if (BIT(input_sel, 1)) result &= m_io_key[1]->read();
if (BIT(input_sel, 2)) result &= m_io_key[2]->read();
if (BIT(input_sel, 3)) result &= m_io_key[3]->read();
- return result;
+ return result | 0x00c0;
}
void ssv_state::hypreact_map(address_map &map)
@@ -1019,45 +1021,9 @@ INPUT_PORTS_END
static INPUT_PORTS_START( ssv_mahjong )
PORT_INCLUDE(ssv_joystick)
- PORT_START("KEY0") // IN5 - $800002(0)
- PORT_BIT( 0x0001, IP_ACTIVE_LOW, IPT_UNKNOWN )
- PORT_BIT( 0x0002, IP_ACTIVE_LOW, IPT_UNKNOWN )
- PORT_BIT( 0x0004, IP_ACTIVE_LOW, IPT_MAHJONG_PON )
- PORT_BIT( 0x0008, IP_ACTIVE_LOW, IPT_MAHJONG_L )
- PORT_BIT( 0x0010, IP_ACTIVE_LOW, IPT_MAHJONG_H )
- PORT_BIT( 0x0020, IP_ACTIVE_LOW, IPT_MAHJONG_D )
- PORT_BIT( 0x0040, IP_ACTIVE_LOW, IPT_UNKNOWN )
- PORT_BIT( 0x0080, IP_ACTIVE_LOW, IPT_UNKNOWN )
-
- PORT_START("KEY1") // IN6 - $800002(1)
- PORT_BIT( 0x0001, IP_ACTIVE_LOW, IPT_UNKNOWN )
- PORT_BIT( 0x0002, IP_ACTIVE_LOW, IPT_MAHJONG_RON )
- PORT_BIT( 0x0004, IP_ACTIVE_LOW, IPT_MAHJONG_CHI )
- PORT_BIT( 0x0008, IP_ACTIVE_LOW, IPT_MAHJONG_K )
- PORT_BIT( 0x0010, IP_ACTIVE_LOW, IPT_MAHJONG_G )
- PORT_BIT( 0x0020, IP_ACTIVE_LOW, IPT_MAHJONG_C )
- PORT_BIT( 0x0040, IP_ACTIVE_LOW, IPT_UNKNOWN )
- PORT_BIT( 0x0080, IP_ACTIVE_LOW, IPT_UNKNOWN )
-
- PORT_START("KEY2") // IN7 - $800002(2)
- PORT_BIT( 0x0001, IP_ACTIVE_LOW, IPT_MAHJONG_BET )
- PORT_BIT( 0x0002, IP_ACTIVE_LOW, IPT_MAHJONG_REACH )
- PORT_BIT( 0x0004, IP_ACTIVE_LOW, IPT_MAHJONG_N )
- PORT_BIT( 0x0008, IP_ACTIVE_LOW, IPT_MAHJONG_J )
- PORT_BIT( 0x0010, IP_ACTIVE_LOW, IPT_MAHJONG_F )
- PORT_BIT( 0x0020, IP_ACTIVE_LOW, IPT_MAHJONG_B )
- PORT_BIT( 0x0040, IP_ACTIVE_LOW, IPT_UNKNOWN )
- PORT_BIT( 0x0080, IP_ACTIVE_LOW, IPT_UNKNOWN )
-
- PORT_START("KEY3") // IN8 - $800002(3)
- PORT_BIT( 0x0001, IP_ACTIVE_LOW, IPT_START1 )
- PORT_BIT( 0x0002, IP_ACTIVE_LOW, IPT_MAHJONG_KAN )
- PORT_BIT( 0x0004, IP_ACTIVE_LOW, IPT_MAHJONG_M )
- PORT_BIT( 0x0008, IP_ACTIVE_LOW, IPT_MAHJONG_I )
- PORT_BIT( 0x0010, IP_ACTIVE_LOW, IPT_MAHJONG_E )
- PORT_BIT( 0x0020, IP_ACTIVE_LOW, IPT_MAHJONG_A )
- PORT_BIT( 0x0040, IP_ACTIVE_LOW, IPT_UNKNOWN )
- PORT_BIT( 0x0080, IP_ACTIVE_LOW, IPT_UNKNOWN )
+ PORT_INCLUDE(mahjong_matrix_1p) // IN5-IN8 - $800002
+ PORT_MODIFY("KEY2")
+ PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_MAHJONG_BET ) // uses bet button, but not the rest of the gambling controls
INPUT_PORTS_END
diff --git a/src/mame/shared/mahjong.cpp b/src/mame/shared/mahjong.cpp
new file mode 100644
index 00000000000..e4ccdf3eb90
--- /dev/null
+++ b/src/mame/shared/mahjong.cpp
@@ -0,0 +1,177 @@
+// license:BSD-3-Clause
+// copyright-holders:Vas Crabb
+/*
+ "Standard" 5*6 mahjong keyboard matrix used for numerous arcade games.
+
+ Key names
+ MAME Japanese (alt) Dynax IGS TW (alt) IGS CN (alt) IGS EN
+ --------------------------------------------------------------------------------------------
+ Flip Flop フリップフロップ F.F F
+ Start スタート S 開始 开始 START
+ Bet ベット B 押注 押 押注 押 BET
+ Take Score テイクスコアー T 得分 得分 TAKE
+ Double Up ダブルアップ W 比倍 續玩 比倍 续玩 DUP
+ Big ビッグ B 大 左 大 左 BIG
+ Small スモール S 小 右 小 右 SMALL
+ Last Chance ラストチャンス L 海底 海底
+ Kan カン K 槓 杠 GUN
+ Pon ポン P 碰 碰 PON
+ Chi チー T 吃 吃 EAT
+ Reach リーチ R 聽 听 LISTEN
+ Ron ロン N 胡 胡 WHO
+
+ Keys present
+ Name Jaleco Sega Dynax IGS
+ -----------------------------------------
+ Flip Flop * * *
+ Start * * * *
+ Bet * * *
+ Take Score * *
+ Double Up * *
+ Big * *
+ Small * *
+ Last Chance * * *
+ Kan * * * *
+ Pon * * * *
+ Chi * * * *
+ Reach * * * *
+ Ron * * * *
+
+ */
+#include "emu.h"
+#include "mahjong.h"
+
+
+INPUT_PORTS_START(mahjong_matrix_1p)
+ PORT_START("KEY0")
+ PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_MAHJONG_A)
+ PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_MAHJONG_E)
+ PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_MAHJONG_I)
+ PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_MAHJONG_M)
+ PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_MAHJONG_KAN)
+ PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_START1)
+
+ PORT_START("KEY1")
+ PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_MAHJONG_B)
+ PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_MAHJONG_F)
+ PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_MAHJONG_J)
+ PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_MAHJONG_N)
+ PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_MAHJONG_REACH)
+ PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_UNUSED)
+
+ PORT_START("KEY2")
+ PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_MAHJONG_C)
+ PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_MAHJONG_G)
+ PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_MAHJONG_K)
+ PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_MAHJONG_CHI)
+ PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_MAHJONG_RON)
+ PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_UNUSED)
+
+ PORT_START("KEY3")
+ PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_MAHJONG_D)
+ PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_MAHJONG_H)
+ PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_MAHJONG_L)
+ PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_MAHJONG_PON)
+ PORT_BIT(0x30, IP_ACTIVE_LOW, IPT_UNUSED)
+
+ PORT_START("KEY4")
+ PORT_BIT(0x3f, IP_ACTIVE_LOW, IPT_UNUSED)
+INPUT_PORTS_END
+
+
+INPUT_PORTS_START(mahjong_matrix_1p_ff)
+ PORT_INCLUDE(mahjong_matrix_1p)
+
+ PORT_MODIFY("KEY4")
+ PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_MAHJONG_FLIP_FLOP)
+INPUT_PORTS_END
+
+
+INPUT_PORTS_START(mahjong_matrix_1p_bet)
+ PORT_INCLUDE(mahjong_matrix_1p_ff)
+
+ PORT_MODIFY("KEY1")
+ PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_MAHJONG_BET)
+
+ PORT_MODIFY("KEY4")
+ PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_MAHJONG_LAST_CHANCE)
+ PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_MAHJONG_SCORE)
+ PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_MAHJONG_DOUBLE_UP)
+ PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_MAHJONG_BIG)
+ PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_MAHJONG_SMALL)
+INPUT_PORTS_END
+
+
+INPUT_PORTS_START(mahjong_matrix_2p)
+ PORT_INCLUDE(mahjong_matrix_1p)
+
+ PORT_START("KEY5")
+ PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_MAHJONG_A) PORT_PLAYER(2)
+ PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_MAHJONG_E) PORT_PLAYER(2)
+ PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_MAHJONG_I) PORT_PLAYER(2)
+ PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_MAHJONG_M) PORT_PLAYER(2)
+ PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_MAHJONG_KAN) PORT_PLAYER(2)
+ PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_START2)
+
+ PORT_START("KEY6")
+ PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_MAHJONG_B) PORT_PLAYER(2)
+ PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_MAHJONG_F) PORT_PLAYER(2)
+ PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_MAHJONG_J) PORT_PLAYER(2)
+ PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_MAHJONG_N) PORT_PLAYER(2)
+ PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_MAHJONG_REACH) PORT_PLAYER(2)
+ PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_UNUSED)
+
+ PORT_START("KEY7")
+ PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_MAHJONG_C) PORT_PLAYER(2)
+ PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_MAHJONG_G) PORT_PLAYER(2)
+ PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_MAHJONG_K) PORT_PLAYER(2)
+ PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_MAHJONG_CHI) PORT_PLAYER(2)
+ PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_MAHJONG_RON) PORT_PLAYER(2)
+ PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_UNUSED)
+
+ PORT_START("KEY8")
+ PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_MAHJONG_D) PORT_PLAYER(2)
+ PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_MAHJONG_H) PORT_PLAYER(2)
+ PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_MAHJONG_L) PORT_PLAYER(2)
+ PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_MAHJONG_PON) PORT_PLAYER(2)
+ PORT_BIT(0x30, IP_ACTIVE_LOW, IPT_UNUSED)
+
+ PORT_START("KEY9")
+ PORT_BIT(0x3f, IP_ACTIVE_LOW, IPT_UNUSED)
+INPUT_PORTS_END
+
+
+INPUT_PORTS_START(mahjong_matrix_2p_ff)
+ PORT_INCLUDE(mahjong_matrix_2p)
+
+ PORT_MODIFY("KEY4")
+ PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_MAHJONG_FLIP_FLOP)
+
+ PORT_MODIFY("KEY9")
+ PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_MAHJONG_FLIP_FLOP) PORT_PLAYER(2)
+INPUT_PORTS_END
+
+
+INPUT_PORTS_START(mahjong_matrix_2p_bet)
+ PORT_INCLUDE(mahjong_matrix_2p_ff)
+
+ PORT_MODIFY("KEY1")
+ PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_MAHJONG_BET)
+
+ PORT_MODIFY("KEY4")
+ PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_MAHJONG_LAST_CHANCE)
+ PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_MAHJONG_SCORE)
+ PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_MAHJONG_DOUBLE_UP)
+ PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_MAHJONG_BIG)
+ PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_MAHJONG_SMALL)
+
+ PORT_MODIFY("KEY6")
+ PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_MAHJONG_BET) PORT_PLAYER(2)
+
+ PORT_MODIFY("KEY9")
+ PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_MAHJONG_LAST_CHANCE) PORT_PLAYER(2)
+ PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_MAHJONG_SCORE) PORT_PLAYER(2)
+ PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_MAHJONG_DOUBLE_UP) PORT_PLAYER(2)
+ PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_MAHJONG_BIG) PORT_PLAYER(2)
+ PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_MAHJONG_SMALL) PORT_PLAYER(2)
+INPUT_PORTS_END
diff --git a/src/mame/shared/mahjong.h b/src/mame/shared/mahjong.h
new file mode 100644
index 00000000000..d32eca66179
--- /dev/null
+++ b/src/mame/shared/mahjong.h
@@ -0,0 +1,17 @@
+// license:BSD-3-Clause
+// copyright-holders:Vas Crabb
+#ifndef MAME_SHARED_MAHJONG_H
+#define MAME_SHARED_MAHJONG_H
+
+#pragma once
+
+
+INPUT_PORTS_EXTERN(mahjong_matrix_1p); // letters, start, kan/pon/chi/reach/ron
+INPUT_PORTS_EXTERN(mahjong_matrix_1p_ff); // adds flip flop
+INPUT_PORTS_EXTERN(mahjong_matrix_1p_bet); // adds bet/take/double/big/small/last chance
+
+INPUT_PORTS_EXTERN(mahjong_matrix_2p); // letters, start, kan/pon/chi/reach/ron
+INPUT_PORTS_EXTERN(mahjong_matrix_2p_ff); // adds flip flop
+INPUT_PORTS_EXTERN(mahjong_matrix_2p_bet); // adds bet/take/double/big/small/last chance
+
+#endif // MAME_SHARED_MAHJONG_H