diff options
Diffstat (limited to 'src/mess/drivers/hh_hmcs40.c')
-rw-r--r-- | src/mess/drivers/hh_hmcs40.c | 158 |
1 files changed, 149 insertions, 9 deletions
diff --git a/src/mess/drivers/hh_hmcs40.c b/src/mess/drivers/hh_hmcs40.c index 1ea775a681b..6ad6a6e1209 100644 --- a/src/mess/drivers/hh_hmcs40.c +++ b/src/mess/drivers/hh_hmcs40.c @@ -101,6 +101,14 @@ public: DECLARE_WRITE16_MEMBER(alnattck_grid_w); DECLARE_READ16_MEMBER(alnattck_input_r); + DECLARE_WRITE8_MEMBER(cpacman_plate_w); + DECLARE_WRITE16_MEMBER(cpacman_grid_w); + DECLARE_READ8_MEMBER(cpacman_input_r); + + DECLARE_WRITE8_MEMBER(cmspacmn_plate_w); + DECLARE_WRITE16_MEMBER(cmspacmn_grid_w); + DECLARE_READ8_MEMBER(cmspacmn_input_r); + void egalaxn2_display(); DECLARE_WRITE8_MEMBER(egalaxn2_plate_w); DECLARE_WRITE16_MEMBER(egalaxn2_grid_w); @@ -257,7 +265,7 @@ WRITE8_MEMBER(hh_hmcs40_state::bambball_plate_w) m_plate = (m_plate & ~(0xf << shift)) | (data << shift); // update display - UINT32 plate = BITSWAP16(m_plate,13,8,4,12,9,10,14,1,7,0,15,11,6,3,5,2); + UINT16 plate = BITSWAP16(m_plate,13,8,4,12,9,10,14,1,7,0,15,11,6,3,5,2); display_matrix(16, 9, plate, m_grid); } @@ -452,7 +460,7 @@ READ16_MEMBER(hh_hmcs40_state::alnattck_input_r) static INPUT_PORTS_START( alnattck ) PORT_START("IN.0") // D5 D7 - PORT_CONFNAME( 0x01, 0x00, "Skill" ) + PORT_CONFNAME( 0x01, 0x00, "Skill Level" ) PORT_CONFSETTING( 0x00, "1" ) PORT_CONFSETTING( 0x01, "2" ) @@ -583,7 +591,65 @@ MACHINE_CONFIG_END ***************************************************************************/ +WRITE8_MEMBER(hh_hmcs40_state::cpacman_plate_w) +{ + // R1x-R6x, D1,D2: vfd matrix plate + int shift = (offset - HMCS40_PORT_R1X) * 4; + m_plate = (m_plate & ~(0xf << shift)) | (data << shift); + + // update display + + // 31,30,29,28,27,13,14, 8,12,11,10, 9,15,16,17,18, 7, 6, 5, 4,19,20,21,22, 0, 1, 2, 3,23,24,25,26 + // 31,30,29,28,27,26,25,24,23,22,21,20,19,18,17,16,15,14,13,12,11,10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0 + // 31,30,29,28,27, 0, 1, 2, 3, 8, 9,10,11,16,17,18,19,25,26,23,22,21,20,24,15,14,13,12, 4, 5, 6, 7 + + UINT16 grid = BITSWAP16(m_grid,15,14,13,12,11,0,1,2,3,4,5,6,7,8,9,10); + UINT32 plate = BITSWAP32(m_plate,31,30,29,28,27,0,1,2,3,8,9,10,11,16,17,18,19,25,26,23,22,21,20,24,15,14,13,12,4,5,6,7); + plate |= 0x2000; // plate 13(maze) is always on + + display_matrix(27, 11, plate, grid); +} + +WRITE16_MEMBER(hh_hmcs40_state::cpacman_grid_w) +{ + // D0: speaker out + m_speaker->level_w(data & 1); + + // D13-D15: input mux + m_inp_mux = data >> 13 & 7; + + // D5-D15: vfd matrix grid + m_grid = data >> 5 & 0x7ff; + + // D1,D2: plate 8,14 (update display there) + cpacman_plate_w(space, 6 + HMCS40_PORT_R1X, data >> 1 & 3); +} + +READ8_MEMBER(hh_hmcs40_state::cpacman_input_r) +{ + // R0x: multiplexed inputs + return read_inputs(3); +} + + static INPUT_PORTS_START( cpacman ) + PORT_START("IN.0") // D13 port R0x + PORT_CONFNAME( 0x01, 0x01, "Skill Level" ) + PORT_CONFSETTING( 0x01, "1" ) + PORT_CONFSETTING( 0x00, "2" ) + PORT_BIT( 0x0e, IP_ACTIVE_HIGH, IPT_UNUSED ) + + PORT_START("IN.1") // D14 port R0x + PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_JOYSTICK_UP ) + PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_JOYSTICK_RIGHT ) + PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_JOYSTICK_DOWN ) + PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_JOYSTICK_LEFT ) + + PORT_START("IN.2") // D15 port R0x + PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_JOYSTICK_UP ) PORT_PLAYER(2) + PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_JOYSTICK_RIGHT ) PORT_PLAYER(2) + PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_JOYSTICK_DOWN ) PORT_PLAYER(2) + PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_JOYSTICK_LEFT ) PORT_PLAYER(2) INPUT_PORTS_END @@ -591,8 +657,16 @@ static MACHINE_CONFIG_START( cpacman, hh_hmcs40_state ) /* basic machine hardware */ MCFG_CPU_ADD("maincpu", HD38820, 400000) // approximation - RC osc. + MCFG_HMCS40_READ_R_CB(0, READ8(hh_hmcs40_state, cpacman_input_r)) + MCFG_HMCS40_WRITE_R_CB(1, WRITE8(hh_hmcs40_state, cpacman_plate_w)) + MCFG_HMCS40_WRITE_R_CB(2, WRITE8(hh_hmcs40_state, cpacman_plate_w)) + MCFG_HMCS40_WRITE_R_CB(3, WRITE8(hh_hmcs40_state, cpacman_plate_w)) + MCFG_HMCS40_WRITE_R_CB(4, WRITE8(hh_hmcs40_state, cpacman_plate_w)) + MCFG_HMCS40_WRITE_R_CB(5, WRITE8(hh_hmcs40_state, cpacman_plate_w)) + MCFG_HMCS40_WRITE_R_CB(6, WRITE8(hh_hmcs40_state, cpacman_plate_w)) + MCFG_HMCS40_WRITE_D_CB(WRITE16(hh_hmcs40_state, cpacman_grid_w)) -// MCFG_TIMER_DRIVER_ADD_PERIODIC("display_decay", hh_hmcs40_state, display_decay_tick, attotime::from_msec(1)) + MCFG_TIMER_DRIVER_ADD_PERIODIC("display_decay", hh_hmcs40_state, display_decay_tick, attotime::from_msec(1)) MCFG_DEFAULT_LAYOUT(layout_hh_hmcs40_test) /* no video! */ @@ -618,7 +692,65 @@ MACHINE_CONFIG_END ***************************************************************************/ +WRITE8_MEMBER(hh_hmcs40_state::cmspacmn_plate_w) +{ + // R1x-R6x, D0,D1: vfd matrix plate + int shift = (offset - HMCS40_PORT_R1X) * 4; + m_plate = (m_plate & ~(0xf << shift)) | (data << shift); + + // update display + // 22,17 18,13 + // 31,30,29,28,27,26, 6,11,23,21,20,19,15, 2, 1, 0,32,31,30,29,12, 9, 4, 8,25,26,27,28,16,10, 3, 5 + // 31,30,29,28,27,26,25,24,23,22,21,20,19,18,17,16,15,14,13,12,11,10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0 + // 14,13,12, 4, 5, 6, 7,24,23,25,22,21,20,13,24, 3,19,14,12,11,24, 2,10, 8, 7,25, 0, 9, 1,18,17,16 + + UINT16 grid = BITSWAP16(m_grid,15,14,13,11,10,9,8,7,6,5,4,3,2,1,1,0); + UINT64 plate = BIT(m_plate,15)<<32 | BITSWAP32(m_plate,14,13,12,4,5,6,7,24,23,25,22,21,20,13,24,3,19,14,12,11,24,2,10,8,7,25,0,9,1,18,17,16); + plate |= 0x1004080; // plates 7,14,24 are always on + + display_matrix(33, 12, plate, grid); +} + +WRITE16_MEMBER(hh_hmcs40_state::cmspacmn_grid_w) +{ + // D2: speaker out + m_speaker->level_w(data >> 2 & 1); + + // D13-D15: input mux + m_inp_mux = data >> 13 & 7; + + // D5-D15: vfd matrix grid + m_grid = data >> 5 & 0x7ff; + + // D0,D1: plate 11+17,6+22 (update display there) + cmspacmn_plate_w(space, 6 + HMCS40_PORT_R1X, data & 3); +} + +READ8_MEMBER(hh_hmcs40_state::cmspacmn_input_r) +{ + // R0x: multiplexed inputs + return read_inputs(3); +} + + static INPUT_PORTS_START( cmspacmn ) + PORT_START("IN.0") // D13 port R0x + PORT_CONFNAME( 0x01, 0x01, "Skill Level" ) + PORT_CONFSETTING( 0x01, "1" ) + PORT_CONFSETTING( 0x00, "2" ) + PORT_BIT( 0x0e, IP_ACTIVE_HIGH, IPT_UNUSED ) + + PORT_START("IN.1") // D14 port R0x + PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_JOYSTICK_UP ) PORT_PLAYER(2) + PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_JOYSTICK_RIGHT ) PORT_PLAYER(2) + PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_JOYSTICK_DOWN ) PORT_PLAYER(2) + PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_JOYSTICK_LEFT ) PORT_PLAYER(2) + + PORT_START("IN.2") // D15 port R0x + PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_JOYSTICK_UP ) + PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_JOYSTICK_RIGHT ) + PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_JOYSTICK_DOWN ) + PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_JOYSTICK_LEFT ) INPUT_PORTS_END @@ -626,8 +758,16 @@ static MACHINE_CONFIG_START( cmspacmn, hh_hmcs40_state ) /* basic machine hardware */ MCFG_CPU_ADD("maincpu", HD38820, 400000) // approximation - RC osc. + MCFG_HMCS40_READ_R_CB(0, READ8(hh_hmcs40_state, cmspacmn_input_r)) + MCFG_HMCS40_WRITE_R_CB(1, WRITE8(hh_hmcs40_state, cmspacmn_plate_w)) + MCFG_HMCS40_WRITE_R_CB(2, WRITE8(hh_hmcs40_state, cmspacmn_plate_w)) + MCFG_HMCS40_WRITE_R_CB(3, WRITE8(hh_hmcs40_state, cmspacmn_plate_w)) + MCFG_HMCS40_WRITE_R_CB(4, WRITE8(hh_hmcs40_state, cmspacmn_plate_w)) + MCFG_HMCS40_WRITE_R_CB(5, WRITE8(hh_hmcs40_state, cmspacmn_plate_w)) + MCFG_HMCS40_WRITE_R_CB(6, WRITE8(hh_hmcs40_state, cmspacmn_plate_w)) + MCFG_HMCS40_WRITE_D_CB(WRITE16(hh_hmcs40_state, cmspacmn_grid_w)) -// MCFG_TIMER_DRIVER_ADD_PERIODIC("display_decay", hh_hmcs40_state, display_decay_tick, attotime::from_msec(1)) + MCFG_TIMER_DRIVER_ADD_PERIODIC("display_decay", hh_hmcs40_state, display_decay_tick, attotime::from_msec(1)) MCFG_DEFAULT_LAYOUT(layout_hh_hmcs40_test) /* no video! */ @@ -654,7 +794,7 @@ MACHINE_CONFIG_END void hh_hmcs40_state::egalaxn2_display() { - UINT32 grid = BITSWAP16(m_grid,15,0,1,2,3,4,5,6,7,8,9,10,11,12,13,14); + UINT16 grid = BITSWAP16(m_grid,15,0,1,2,3,4,5,6,7,8,9,10,11,12,13,14); UINT32 plate = BITSWAP24(m_plate,23,22,21,20,15,14,13,12,7,6,5,4,3,2,1,0,19,18,17,16,11,10,9,8); display_matrix(24, 15, plate, grid); @@ -675,7 +815,7 @@ WRITE16_MEMBER(hh_hmcs40_state::egalaxn2_grid_w) WRITE8_MEMBER(hh_hmcs40_state::egalaxn2_plate_w) { - // R10-R63: vfd matrix plate + // R1x-R6x: vfd matrix plate int shift = (offset - HMCS40_PORT_R1X) * 4; m_plate = (m_plate & ~(0xf << shift)) | (data << shift); @@ -710,7 +850,7 @@ static INPUT_PORTS_START( egalaxn2 ) PORT_START("IN.3") // D4 port R0x PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_UNUSED ) - PORT_CONFNAME( 0x02, 0x02, "Skill" ) + PORT_CONFNAME( 0x02, 0x02, "Skill Level" ) PORT_CONFSETTING( 0x02, "1" ) PORT_CONFSETTING( 0x00, "2" ) PORT_CONFNAME( 0x0c, 0x00, "Players" ) @@ -758,7 +898,7 @@ MACHINE_CONFIG_END ***************************************************************************/ -// hardware is identical to Galaxian 2, so we can use those handlers +// i/o hookup is identical to Galaxian 2, so we can use those handlers // note: plate numbers are 0-23, not 1-24(with 0 always-on) static INPUT_PORTS_START( epacman2 ) @@ -782,7 +922,7 @@ static INPUT_PORTS_START( epacman2 ) PORT_START("IN.3") // D4 port R0x PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_UNUSED ) - PORT_CONFNAME( 0x02, 0x02, "Skill" ) + PORT_CONFNAME( 0x02, 0x02, "Skill Level" ) PORT_CONFSETTING( 0x00, "1" ) PORT_CONFSETTING( 0x02, "2" ) PORT_CONFNAME( 0x0c, 0x04, "Players" ) |