trunk/src/mame/drivers/mjkjidai.c
| r242173 | r242174 | |
| 26 | 26 | #include "sound/sn76496.h" |
| 27 | 27 | #include "includes/mjkjidai.h" |
| 28 | 28 | |
| 29 | | /* Start of ADPCM custom chip code */ |
| 30 | 29 | |
| 31 | | const device_type MJKJIDAI = &device_creator<mjkjidai_adpcm_device>; |
| 32 | | |
| 33 | | mjkjidai_adpcm_device::mjkjidai_adpcm_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) |
| 34 | | : device_t(mconfig, MJKJIDAI, "Mahjong Kyou Jidai ADPCM Custom", tag, owner, clock, "mjkjidai_adpcm", __FILE__), |
| 35 | | device_sound_interface(mconfig, *this), |
| 36 | | m_stream(NULL), |
| 37 | | m_current(0), |
| 38 | | m_end(0), |
| 39 | | m_nibble(0), |
| 40 | | m_playing(0), |
| 41 | | m_base(NULL) |
| 30 | WRITE8_MEMBER(mjkjidai_state::adpcm_w) |
| 42 | 31 | { |
| 32 | m_adpcm_pos = (data & 0x07) * 0x1000 * 2; |
| 33 | m_adpcm_end = m_adpcm_pos + 0x1000 * 2; |
| 34 | m_msm->reset_w(0); |
| 43 | 35 | } |
| 44 | 36 | |
| 45 | | //------------------------------------------------- |
| 46 | | // device_config_complete - perform any |
| 47 | | // operations now that the configuration is |
| 48 | | // complete |
| 49 | | //------------------------------------------------- |
| 50 | | |
| 51 | | void mjkjidai_adpcm_device::device_config_complete() |
| 37 | WRITE_LINE_MEMBER(mjkjidai_state::adpcm_int) |
| 52 | 38 | { |
| 53 | | } |
| 54 | | |
| 55 | | //------------------------------------------------- |
| 56 | | // device_start - device-specific startup |
| 57 | | //------------------------------------------------- |
| 58 | | |
| 59 | | void mjkjidai_adpcm_device::device_start() |
| 60 | | { |
| 61 | | m_playing = 0; |
| 62 | | m_stream = machine().sound().stream_alloc(*this, 0, 1, clock()); |
| 63 | | m_base = machine().root_device().memregion("adpcm")->base(); |
| 64 | | m_adpcm.reset(); |
| 65 | | |
| 66 | | save_item(NAME(m_current)); |
| 67 | | save_item(NAME(m_end)); |
| 68 | | save_item(NAME(m_nibble)); |
| 69 | | save_item(NAME(m_playing)); |
| 70 | | } |
| 71 | | |
| 72 | | //------------------------------------------------- |
| 73 | | // sound_stream_update - handle a stream update |
| 74 | | //------------------------------------------------- |
| 75 | | |
| 76 | | void mjkjidai_adpcm_device::sound_stream_update(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int samples) |
| 77 | | { |
| 78 | | stream_sample_t *dest = outputs[0]; |
| 79 | | |
| 80 | | while (m_playing && samples > 0) |
| 39 | if (m_adpcm_pos >= m_adpcm_end) |
| 81 | 40 | { |
| 82 | | int val = (m_base[m_current] >> m_nibble) & 15; |
| 83 | | |
| 84 | | m_nibble ^= 4; |
| 85 | | if (m_nibble == 4) |
| 86 | | { |
| 87 | | m_current++; |
| 88 | | if (m_current >= m_end) |
| 89 | | m_playing = 0; |
| 90 | | } |
| 91 | | |
| 92 | | *dest++ = m_adpcm.clock(val) << 4; |
| 93 | | samples--; |
| 41 | m_msm->reset_w(1); |
| 94 | 42 | } |
| 95 | | while (samples > 0) |
| 43 | else |
| 96 | 44 | { |
| 97 | | *dest++ = 0; |
| 98 | | samples--; |
| 45 | UINT8 const data = m_adpcmrom[m_adpcm_pos / 2]; |
| 46 | m_msm->data_w(m_adpcm_pos & 1 ? data & 0xf : data >> 4); |
| 47 | m_adpcm_pos++; |
| 99 | 48 | } |
| 100 | 49 | } |
| 101 | 50 | |
| 102 | | void mjkjidai_adpcm_device::mjkjidai_adpcm_play (int offset, int length) |
| 51 | CUSTOM_INPUT_MEMBER(mjkjidai_state::keyboard_r) |
| 103 | 52 | { |
| 104 | | m_current = offset; |
| 105 | | m_end = offset + length/2; |
| 106 | | m_nibble = 4; |
| 107 | | m_playing = 1; |
| 108 | | } |
| 53 | int res = 0x3f; |
| 109 | 54 | |
| 110 | | WRITE8_MEMBER(mjkjidai_state::adpcm_w) |
| 111 | | { |
| 112 | | m_mjk_adpcm->mjkjidai_adpcm_play ((data & 0x07) * 0x1000, 0x1000 * 2); |
| 113 | | } |
| 114 | | /* End of ADPCM custom chip code */ |
| 115 | | |
| 116 | | |
| 117 | | READ8_MEMBER(mjkjidai_state::keyboard_r) |
| 118 | | { |
| 119 | | int res = 0x3f,i; |
| 120 | | static const char *const keynames[] = { "PL2_1", "PL2_2", "PL2_3", "PL2_4", "PL2_5", "PL2_6", "PL1_1", "PL1_2", "PL1_3", "PL1_4", "PL1_5", "PL1_6" }; |
| 121 | | |
| 122 | | // logerror("%04x: keyboard_r\n", space.device().safe_pc()); |
| 123 | | |
| 124 | | for (i = 0; i < 12; i++) |
| 55 | for (int i = 0; i < 12; i++) |
| 125 | 56 | { |
| 126 | | if (~m_keyb & (1 << i)) |
| 57 | if (~m_keyb & (0x800 >> i)) |
| 127 | 58 | { |
| 128 | | res = ioport(keynames[i])->read() & 0x3f; |
| 59 | res = m_row[i]->read(); |
| 129 | 60 | break; |
| 130 | 61 | } |
| 131 | 62 | } |
| 132 | 63 | |
| 133 | | res |= (ioport("IN3")->read() & 0xc0); |
| 134 | | |
| 135 | 64 | return res; |
| 136 | 65 | } |
| 137 | 66 | |
| r242173 | r242174 | |
| 152 | 81 | AM_RANGE(0x8000, 0xbfff) AM_ROMBANK("bank1") |
| 153 | 82 | AM_RANGE(0xc000, 0xcfff) AM_RAM |
| 154 | 83 | AM_RANGE(0xd000, 0xdfff) AM_RAM AM_SHARE("nvram") // cleared and initialized on startup if bit 6 of port 00 is 0 |
| 155 | | AM_RANGE(0xe000, 0xe01f) AM_RAM AM_SHARE("spriteram1") // shared with tilemap ram |
| 156 | | AM_RANGE(0xe800, 0xe81f) AM_RAM AM_SHARE("spriteram2") // shared with tilemap ram |
| 157 | | AM_RANGE(0xf000, 0xf01f) AM_RAM AM_SHARE("spriteram3") // shared with tilemap ram |
| 158 | 84 | AM_RANGE(0xe000, 0xf7ff) AM_RAM_WRITE(mjkjidai_videoram_w) AM_SHARE("videoram") |
| 159 | 85 | ADDRESS_MAP_END |
| 160 | 86 | |
| 161 | 87 | static ADDRESS_MAP_START( mjkjidai_io_map, AS_IO, 8, mjkjidai_state ) |
| 162 | 88 | ADDRESS_MAP_GLOBAL_MASK(0xff) |
| 163 | | AM_RANGE(0x00, 0x00) AM_READ(keyboard_r) |
| 89 | AM_RANGE(0x00, 0x00) AM_READ_PORT("KEYBOARD") |
| 164 | 90 | AM_RANGE(0x01, 0x01) AM_READNOP // ??? |
| 165 | 91 | AM_RANGE(0x02, 0x02) AM_READ_PORT("IN2") |
| 166 | 92 | AM_RANGE(0x01, 0x02) AM_WRITE(keyboard_select_w) |
| 167 | 93 | AM_RANGE(0x10, 0x10) AM_WRITE(mjkjidai_ctrl_w) // rom bank, coin counter, flip screen etc |
| 168 | | AM_RANGE(0x11, 0x11) AM_READ_PORT("IN0") |
| 169 | | AM_RANGE(0x12, 0x12) AM_READ_PORT("IN1") |
| 94 | AM_RANGE(0x11, 0x11) AM_READ_PORT("DSW1") |
| 95 | AM_RANGE(0x12, 0x12) AM_READ_PORT("DSW2") |
| 170 | 96 | AM_RANGE(0x20, 0x20) AM_DEVWRITE("sn1", sn76489_device, write) |
| 171 | 97 | AM_RANGE(0x30, 0x30) AM_DEVWRITE("sn2", sn76489_device, write) |
| 172 | 98 | AM_RANGE(0x40, 0x40) AM_WRITE(adpcm_w) |
| r242173 | r242174 | |
| 174 | 100 | |
| 175 | 101 | |
| 176 | 102 | static INPUT_PORTS_START( mjkjidai ) |
| 177 | | PORT_START("IN0") |
| 178 | | PORT_DIPNAME( 0x01, 0x01, DEF_STR( Unknown ) ) |
| 179 | | PORT_DIPSETTING( 0x01, DEF_STR( Off ) ) |
| 103 | PORT_START("DSW1") |
| 104 | PORT_DIPNAME( 0x80, 0x80, DEF_STR( Flip_Screen ) ) PORT_DIPLOCATION("SW1:1") |
| 105 | PORT_DIPSETTING( 0x80, DEF_STR( Off ) ) |
| 180 | 106 | PORT_DIPSETTING( 0x00, DEF_STR( On ) ) |
| 181 | | PORT_DIPNAME( 0x02, 0x02, DEF_STR( Unknown ) ) |
| 182 | | PORT_DIPSETTING( 0x02, DEF_STR( Off ) ) |
| 107 | PORT_DIPNAME( 0x40, 0x40, DEF_STR( Unknown ) ) PORT_DIPLOCATION("SW1:2") |
| 108 | PORT_DIPSETTING( 0x40, DEF_STR( Off ) ) |
| 183 | 109 | PORT_DIPSETTING( 0x00, DEF_STR( On ) ) |
| 184 | | PORT_SERVICE( 0x04, IP_ACTIVE_LOW ) |
| 185 | | PORT_DIPNAME( 0x08, 0x08, DEF_STR( Unknown ) ) |
| 186 | | PORT_DIPSETTING( 0x08, DEF_STR( Off ) ) |
| 110 | PORT_DIPNAME( 0x20, 0x20, DEF_STR( Unknown ) ) PORT_DIPLOCATION("SW1:3") |
| 111 | PORT_DIPSETTING( 0x20, DEF_STR( Off ) ) |
| 187 | 112 | PORT_DIPSETTING( 0x00, DEF_STR( On ) ) |
| 188 | | PORT_DIPNAME( 0x10, 0x10, DEF_STR( Unknown ) ) |
| 113 | PORT_DIPNAME( 0x10, 0x10, DEF_STR( Unknown ) ) PORT_DIPLOCATION("SW1:4") |
| 189 | 114 | PORT_DIPSETTING( 0x10, DEF_STR( Off ) ) |
| 190 | 115 | PORT_DIPSETTING( 0x00, DEF_STR( On ) ) |
| 191 | | PORT_DIPNAME( 0x20, 0x20, DEF_STR( Unknown ) ) |
| 192 | | PORT_DIPSETTING( 0x20, DEF_STR( Off ) ) |
| 116 | PORT_DIPNAME( 0x08, 0x08, DEF_STR( Unknown ) ) PORT_DIPLOCATION("SW1:5") |
| 117 | PORT_DIPSETTING( 0x08, DEF_STR( Off ) ) |
| 193 | 118 | PORT_DIPSETTING( 0x00, DEF_STR( On ) ) |
| 194 | | PORT_DIPNAME( 0x40, 0x40, DEF_STR( Unknown ) ) |
| 195 | | PORT_DIPSETTING( 0x40, DEF_STR( Off ) ) |
| 119 | PORT_DIPNAME( 0x04, 0x04, "Test Mode" ) PORT_DIPLOCATION("SW1:6") |
| 120 | PORT_DIPSETTING( 0x04, DEF_STR( Off ) ) |
| 196 | 121 | PORT_DIPSETTING( 0x00, DEF_STR( On ) ) |
| 197 | | PORT_DIPNAME( 0x80, 0x80, DEF_STR( Flip_Screen ) ) |
| 198 | | PORT_DIPSETTING( 0x80, DEF_STR( Off ) ) |
| 122 | PORT_DIPNAME( 0x02, 0x02, DEF_STR( Unknown ) ) PORT_DIPLOCATION("SW1:7") |
| 123 | PORT_DIPSETTING( 0x02, DEF_STR( Off ) ) |
| 199 | 124 | PORT_DIPSETTING( 0x00, DEF_STR( On ) ) |
| 200 | | |
| 201 | | PORT_START("IN1") |
| 202 | | PORT_DIPNAME( 0x01, 0x01, DEF_STR( Unknown ) ) |
| 125 | PORT_DIPNAME( 0x01, 0x01, DEF_STR( Unknown ) ) PORT_DIPLOCATION("SW1:8") |
| 203 | 126 | PORT_DIPSETTING( 0x01, DEF_STR( Off ) ) |
| 204 | 127 | PORT_DIPSETTING( 0x00, DEF_STR( On ) ) |
| 205 | | PORT_DIPNAME( 0x02, 0x02, DEF_STR( Unknown ) ) |
| 206 | | PORT_DIPSETTING( 0x02, DEF_STR( Off ) ) |
| 128 | |
| 129 | PORT_START("DSW2") |
| 130 | PORT_DIPNAME( 0x80, 0x80, DEF_STR( Unknown ) ) PORT_DIPLOCATION("SW2:1") |
| 131 | PORT_DIPSETTING( 0x80, DEF_STR( Off ) ) |
| 207 | 132 | PORT_DIPSETTING( 0x00, DEF_STR( On ) ) |
| 208 | | PORT_DIPNAME( 0x04, 0x04, DEF_STR( Unknown ) ) |
| 209 | | PORT_DIPSETTING( 0x04, DEF_STR( Off ) ) |
| 133 | PORT_DIPNAME( 0x40, 0x40, DEF_STR( Unknown ) ) PORT_DIPLOCATION("SW2:2") |
| 134 | PORT_DIPSETTING( 0x40, DEF_STR( Off ) ) |
| 210 | 135 | PORT_DIPSETTING( 0x00, DEF_STR( On ) ) |
| 211 | | PORT_DIPNAME( 0x08, 0x08, DEF_STR( Unknown ) ) |
| 212 | | PORT_DIPSETTING( 0x08, DEF_STR( Off ) ) |
| 136 | PORT_DIPNAME( 0x20, 0x20, DEF_STR( Unknown ) ) PORT_DIPLOCATION("SW2:3") |
| 137 | PORT_DIPSETTING( 0x20, DEF_STR( Off ) ) |
| 213 | 138 | PORT_DIPSETTING( 0x00, DEF_STR( On ) ) |
| 214 | | PORT_DIPNAME( 0x10, 0x10, DEF_STR( Unknown ) ) |
| 139 | PORT_DIPNAME( 0x10, 0x10, DEF_STR( Unknown ) ) PORT_DIPLOCATION("SW2:4") |
| 215 | 140 | PORT_DIPSETTING( 0x10, DEF_STR( Off ) ) |
| 216 | 141 | PORT_DIPSETTING( 0x00, DEF_STR( On ) ) |
| 217 | | PORT_DIPNAME( 0x20, 0x20, DEF_STR( Unknown ) ) |
| 218 | | PORT_DIPSETTING( 0x20, DEF_STR( Off ) ) |
| 142 | PORT_DIPNAME( 0x08, 0x08, DEF_STR( Unknown ) ) PORT_DIPLOCATION("SW2:5") |
| 143 | PORT_DIPSETTING( 0x08, DEF_STR( Off ) ) |
| 219 | 144 | PORT_DIPSETTING( 0x00, DEF_STR( On ) ) |
| 220 | | PORT_DIPNAME( 0x40, 0x40, DEF_STR( Unknown ) ) |
| 221 | | PORT_DIPSETTING( 0x40, DEF_STR( Off ) ) |
| 145 | PORT_DIPNAME( 0x04, 0x04, DEF_STR( Unknown ) ) PORT_DIPLOCATION("SW2:6") |
| 146 | PORT_DIPSETTING( 0x04, DEF_STR( Off ) ) |
| 222 | 147 | PORT_DIPSETTING( 0x00, DEF_STR( On ) ) |
| 223 | | PORT_DIPNAME( 0x80, 0x80, DEF_STR( Unknown ) ) |
| 224 | | PORT_DIPSETTING( 0x80, DEF_STR( Off ) ) |
| 148 | PORT_DIPNAME( 0x02, 0x02, DEF_STR( Unknown ) ) PORT_DIPLOCATION("SW2:7") |
| 149 | PORT_DIPSETTING( 0x02, DEF_STR( Off ) ) |
| 225 | 150 | PORT_DIPSETTING( 0x00, DEF_STR( On ) ) |
| 151 | PORT_DIPNAME( 0x01, 0x01, DEF_STR( Unknown ) ) PORT_DIPLOCATION("SW2:8") |
| 152 | PORT_DIPSETTING( 0x01, DEF_STR( Off ) ) |
| 153 | PORT_DIPSETTING( 0x00, DEF_STR( On ) ) |
| 226 | 154 | |
| 227 | 155 | PORT_START("IN2") |
| 228 | | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(2) |
| 229 | | PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_PLAYER(2) |
| 230 | | PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_BUTTON3 ) PORT_PLAYER(2) |
| 231 | | PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_BUTTON4 ) PORT_PLAYER(2) |
| 232 | | PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_SERVICE ) // service mode |
| 156 | PORT_BIT( 0x0f, IP_ACTIVE_LOW, IPT_UNUSED ) |
| 157 | PORT_SERVICE( 0x10, IP_ACTIVE_LOW ) |
| 233 | 158 | PORT_DIPNAME( 0x20, 0x20, "Statistics" ) |
| 234 | 159 | PORT_DIPSETTING( 0x20, DEF_STR( Off ) ) |
| 235 | 160 | PORT_DIPSETTING( 0x00, DEF_STR( On ) ) |
| 236 | | PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_START3 ) |
| 237 | | PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_START4 ) |
| 161 | PORT_BIT( 0xc0, IP_ACTIVE_LOW, IPT_UNUSED ) |
| 238 | 162 | |
| 239 | | PORT_START("IN3") |
| 163 | PORT_START("KEYBOARD") |
| 164 | PORT_BIT( 0x3f, IP_ACTIVE_HIGH, IPT_CUSTOM) PORT_CUSTOM_MEMBER(DEVICE_SELF, mjkjidai_state, keyboard_r, NULL) |
| 240 | 165 | PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_TILT ) // reinitialize NVRAM and reset the game |
| 241 | 166 | PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_COIN1 ) |
| 242 | 167 | |
| 243 | | PORT_START("PL1_1") |
| 244 | | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_START1 ) |
| 245 | | PORT_BIT( 0x3e, IP_ACTIVE_LOW, IPT_UNUSED ) |
| 168 | PORT_START("ROW.0") |
| 169 | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_MAHJONG_A ) |
| 170 | PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_MAHJONG_B ) |
| 171 | PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_MAHJONG_C ) |
| 172 | PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_MAHJONG_D ) |
| 173 | PORT_BIT( 0x30, IP_ACTIVE_LOW, IPT_UNUSED ) |
| 246 | 174 | |
| 247 | | PORT_START("PL1_2") |
| 248 | | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_MAHJONG_KAN ) |
| 249 | | PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_MAHJONG_REACH ) |
| 250 | | PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_MAHJONG_RON ) |
| 251 | | PORT_BIT( 0x38, IP_ACTIVE_LOW, IPT_UNUSED ) |
| 252 | | |
| 253 | | PORT_START("PL1_3") |
| 254 | | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_MAHJONG_M ) |
| 255 | | PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_MAHJONG_N ) |
| 256 | | PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_MAHJONG_CHI ) |
| 257 | | PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_MAHJONG_PON ) |
| 175 | PORT_START("ROW.1") |
| 176 | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_MAHJONG_E ) |
| 177 | PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_MAHJONG_F ) |
| 178 | PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_MAHJONG_G ) |
| 179 | PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_MAHJONG_H ) |
| 258 | 180 | PORT_BIT( 0x30, IP_ACTIVE_LOW, IPT_UNUSED ) |
| 259 | 181 | |
| 260 | | PORT_START("PL1_4") |
| 182 | PORT_START("ROW.2") |
| 261 | 183 | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_MAHJONG_I ) |
| 262 | 184 | PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_MAHJONG_J ) |
| 263 | 185 | PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_MAHJONG_K ) |
| 264 | 186 | PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_MAHJONG_L ) |
| 265 | 187 | PORT_BIT( 0x30, IP_ACTIVE_LOW, IPT_UNUSED ) |
| 266 | 188 | |
| 267 | | PORT_START("PL1_5") |
| 268 | | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_MAHJONG_E ) |
| 269 | | PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_MAHJONG_F ) |
| 270 | | PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_MAHJONG_G ) |
| 271 | | PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_MAHJONG_H ) |
| 189 | PORT_START("ROW.3") |
| 190 | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_MAHJONG_M ) |
| 191 | PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_MAHJONG_N ) |
| 192 | PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_MAHJONG_CHI ) |
| 193 | PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_MAHJONG_PON ) |
| 272 | 194 | PORT_BIT( 0x30, IP_ACTIVE_LOW, IPT_UNUSED ) |
| 273 | 195 | |
| 274 | | PORT_START("PL1_6") |
| 275 | | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_MAHJONG_A ) |
| 276 | | PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_MAHJONG_B ) |
| 277 | | PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_MAHJONG_C ) |
| 278 | | PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_MAHJONG_D ) |
| 279 | | PORT_BIT( 0x30, IP_ACTIVE_LOW, IPT_UNUSED ) |
| 196 | PORT_START("ROW.4") |
| 197 | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_MAHJONG_KAN ) |
| 198 | PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_MAHJONG_REACH ) |
| 199 | PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_MAHJONG_RON ) |
| 200 | PORT_BIT( 0x38, IP_ACTIVE_LOW, IPT_UNUSED ) |
| 280 | 201 | |
| 281 | | PORT_START("PL2_1") |
| 282 | | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_START2 ) |
| 202 | PORT_START("ROW.5") |
| 203 | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_START1 ) |
| 283 | 204 | PORT_BIT( 0x3e, IP_ACTIVE_LOW, IPT_UNUSED ) |
| 284 | 205 | |
| 285 | | PORT_START("PL2_2") |
| 286 | | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_MAHJONG_KAN ) PORT_PLAYER(2) |
| 287 | | PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_MAHJONG_REACH ) PORT_PLAYER(2) |
| 288 | | PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_MAHJONG_RON ) PORT_PLAYER(2) |
| 289 | | PORT_BIT( 0x38, IP_ACTIVE_LOW, IPT_UNUSED ) |
| 206 | PORT_START("ROW.6") |
| 207 | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_MAHJONG_A ) PORT_PLAYER(2) |
| 208 | PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_MAHJONG_B ) PORT_PLAYER(2) |
| 209 | PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_MAHJONG_C ) PORT_PLAYER(2) |
| 210 | PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_MAHJONG_D ) PORT_PLAYER(2) |
| 211 | PORT_BIT( 0x30, IP_ACTIVE_LOW, IPT_UNUSED ) |
| 290 | 212 | |
| 291 | | PORT_START("PL2_3") |
| 292 | | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_MAHJONG_M ) PORT_PLAYER(2) |
| 293 | | PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_MAHJONG_N ) PORT_PLAYER(2) |
| 294 | | PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_MAHJONG_CHI ) PORT_PLAYER(2) |
| 295 | | PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_MAHJONG_PON ) PORT_PLAYER(2) |
| 213 | PORT_START("ROW.7") |
| 214 | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_MAHJONG_E ) PORT_PLAYER(2) |
| 215 | PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_MAHJONG_F ) PORT_PLAYER(2) |
| 216 | PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_MAHJONG_G ) PORT_PLAYER(2) |
| 217 | PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_MAHJONG_H ) PORT_PLAYER(2) |
| 296 | 218 | PORT_BIT( 0x30, IP_ACTIVE_LOW, IPT_UNUSED ) |
| 297 | 219 | |
| 298 | | PORT_START("PL2_4") |
| 220 | PORT_START("ROW.8") |
| 299 | 221 | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_MAHJONG_I ) PORT_PLAYER(2) |
| 300 | 222 | PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_MAHJONG_J ) PORT_PLAYER(2) |
| 301 | 223 | PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_MAHJONG_K ) PORT_PLAYER(2) |
| 302 | 224 | PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_MAHJONG_L ) PORT_PLAYER(2) |
| 303 | 225 | PORT_BIT( 0x30, IP_ACTIVE_LOW, IPT_UNUSED ) |
| 304 | 226 | |
| 305 | | PORT_START("PL2_5") |
| 306 | | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_MAHJONG_E ) PORT_PLAYER(2) |
| 307 | | PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_MAHJONG_F ) PORT_PLAYER(2) |
| 308 | | PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_MAHJONG_G ) PORT_PLAYER(2) |
| 309 | | PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_MAHJONG_H ) PORT_PLAYER(2) |
| 227 | PORT_START("ROW.9") |
| 228 | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_MAHJONG_M ) PORT_PLAYER(2) |
| 229 | PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_MAHJONG_N ) PORT_PLAYER(2) |
| 230 | PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_MAHJONG_CHI ) PORT_PLAYER(2) |
| 231 | PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_MAHJONG_PON ) PORT_PLAYER(2) |
| 310 | 232 | PORT_BIT( 0x30, IP_ACTIVE_LOW, IPT_UNUSED ) |
| 311 | 233 | |
| 312 | | PORT_START("PL2_6") |
| 313 | | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_MAHJONG_A ) PORT_PLAYER(2) |
| 314 | | PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_MAHJONG_B ) PORT_PLAYER(2) |
| 315 | | PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_MAHJONG_C ) PORT_PLAYER(2) |
| 316 | | PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_MAHJONG_D ) PORT_PLAYER(2) |
| 317 | | PORT_BIT( 0x30, IP_ACTIVE_LOW, IPT_UNUSED ) |
| 234 | PORT_START("ROW.10") |
| 235 | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_MAHJONG_KAN ) PORT_PLAYER(2) |
| 236 | PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_MAHJONG_REACH ) PORT_PLAYER(2) |
| 237 | PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_MAHJONG_RON ) PORT_PLAYER(2) |
| 238 | PORT_BIT( 0x38, IP_ACTIVE_LOW, IPT_UNUSED ) |
| 239 | |
| 240 | PORT_START("ROW.11") |
| 241 | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_START2 ) |
| 242 | PORT_BIT( 0x3e, IP_ACTIVE_LOW, IPT_UNUSED ) |
| 318 | 243 | INPUT_PORTS_END |
| 319 | 244 | |
| 320 | 245 | |
| r242173 | r242174 | |
| 350 | 275 | |
| 351 | 276 | INTERRUPT_GEN_MEMBER(mjkjidai_state::vblank_irq) |
| 352 | 277 | { |
| 353 | | if(m_nmi_mask) |
| 278 | if(m_nmi_enable) |
| 354 | 279 | device.execute().set_input_line(INPUT_LINE_NMI, PULSE_LINE); |
| 355 | 280 | } |
| 356 | 281 | |
| 282 | void mjkjidai_state::machine_start() |
| 283 | { |
| 284 | membank("bank1")->configure_entries(0, 4, memregion("maincpu")->base() + 0x8000, 0x4000); |
| 285 | } |
| 357 | 286 | |
| 287 | void mjkjidai_state::machine_reset() |
| 288 | { |
| 289 | m_adpcm_pos = m_adpcm_end = 0; |
| 290 | } |
| 291 | |
| 358 | 292 | static MACHINE_CONFIG_START( mjkjidai, mjkjidai_state ) |
| 359 | 293 | |
| 360 | 294 | /* basic machine hardware */ |
| r242173 | r242174 | |
| 386 | 320 | MCFG_SOUND_ADD("sn2", SN76489, 10000000/4) |
| 387 | 321 | MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.50) |
| 388 | 322 | |
| 389 | | MCFG_SOUND_ADD("adpcm", MJKJIDAI, 6000) |
| 323 | MCFG_SOUND_ADD("msm", MSM5205, 384000) |
| 324 | MCFG_MSM5205_VCLK_CB(WRITELINE(mjkjidai_state, adpcm_int)) |
| 325 | MCFG_MSM5205_PRESCALER_SELECTOR(MSM5205_S64_4B) /* 6kHz */ |
| 390 | 326 | MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.0) |
| 391 | 327 | MACHINE_CONFIG_END |
| 392 | 328 | |
| r242173 | r242174 | |
| 399 | 335 | ***************************************************************************/ |
| 400 | 336 | |
| 401 | 337 | ROM_START( mjkjidai ) |
| 402 | | ROM_REGION( 0x1c000, "maincpu", 0 ) |
| 338 | ROM_REGION( 0x18000, "maincpu", 0 ) |
| 403 | 339 | ROM_LOAD( "mkj-00.14g", 0x00000, 0x8000, CRC(188a27e9) SHA1(2306ad112aaf8d9ac77a89d0e4c3a17f36945130) ) |
| 404 | | ROM_LOAD( "mkj-01.15g", 0x08000, 0x4000, CRC(a6a5e9c7) SHA1(974f4343f4347a0065f833c1fdcc47e96d42932d) ) /* banked, there is code flowing from 7fff to this bank */ |
| 405 | | ROM_CONTINUE( 0x10000, 0x4000 ) |
| 406 | | ROM_LOAD( "mkj-02.16g", 0x14000, 0x8000, CRC(fb312927) SHA1(b71db72ba881474f9c2523d0617757889af9f28e) ) |
| 340 | ROM_LOAD( "mkj-01.15g", 0x08000, 0x8000, CRC(a6a5e9c7) SHA1(974f4343f4347a0065f833c1fdcc47e96d42932d) ) |
| 341 | ROM_LOAD( "mkj-02.16g", 0x10000, 0x8000, CRC(fb312927) SHA1(b71db72ba881474f9c2523d0617757889af9f28e) ) |
| 407 | 342 | |
| 408 | 343 | ROM_REGION( 0x30000, "gfx1", 0 ) |
| 409 | 344 | ROM_LOAD( "mkj-20.4e", 0x00000, 0x8000, CRC(8fc66bce) SHA1(4f1006bc5168e39eb7a1f6a4b3c3f5aaa3c1c7dd) ) |