diff --git a/src/mess/drivers/hh_hmcs40.c b/src/mess/drivers/hh_hmcs40.c index a523bb6e16c..14ccef23591 100644 --- a/src/mess/drivers/hh_hmcs40.c +++ b/src/mess/drivers/hh_hmcs40.c @@ -745,7 +745,7 @@ public: : hh_hmcs40_state(mconfig, type, tag) { } - void cdkong_display(); + void prepare_display(); DECLARE_WRITE8_MEMBER(plate_w); DECLARE_WRITE16_MEMBER(grid_w); @@ -772,7 +772,7 @@ TIMER_DEVICE_CALLBACK_MEMBER(cdkong_state::speaker_decay_sim) } -void cdkong_state::cdkong_display() +void cdkong_state::prepare_display() { UINT32 plate = BITSWAP32(m_plate,31,30,29,24,0,16,8,1,23,17,9,2,18,10,25,27,26,3,15,27,11,11,14,22,6,13,21,5,19,12,20,4); display_matrix(29, 11, plate, m_grid); @@ -787,7 +787,7 @@ WRITE8_MEMBER(cdkong_state::plate_w) // R0x-R6x: vfd matrix plate int shift = offset * 4; m_plate = (m_plate & ~(0xf << shift)) | (data << shift); - cdkong_display(); + prepare_display(); } WRITE16_MEMBER(cdkong_state::grid_w) @@ -797,7 +797,7 @@ WRITE16_MEMBER(cdkong_state::grid_w) // D4-D14: vfd matrix grid m_grid = data >> 4 & 0x7ff; - cdkong_display(); + prepare_display(); } @@ -879,7 +879,7 @@ public: : hh_hmcs40_state(mconfig, type, tag) { } - void cgalaxn_display(); + void prepare_display(); DECLARE_WRITE16_MEMBER(plate_w); DECLARE_WRITE8_MEMBER(grid_w); DECLARE_READ8_MEMBER(input_r); @@ -887,7 +887,7 @@ public: // handlers -void cgalaxn_state::cgalaxn_display() +void cgalaxn_state::prepare_display() { UINT16 grid = BITSWAP16(m_grid,15,14,13,12,1,2,0,11,10,9,8,7,6,5,4,3); UINT16 plate = BITSWAP16(m_plate,15,14,5,4,3,2,1,0,7,11,12,9,8,10,6,13); @@ -903,7 +903,7 @@ WRITE8_MEMBER(cgalaxn_state::grid_w) // D2-D15: vfd matrix plate m_plate = data >> 2 & 0x3fff; - cgalaxn_display(); + prepare_display(); } WRITE16_MEMBER(cgalaxn_state::plate_w) @@ -915,7 +915,7 @@ WRITE16_MEMBER(cgalaxn_state::plate_w) // R1x-R3x: vfd matrix grid int shift = (offset - HMCS40_PORT_R1X) * 4; m_grid = (m_grid & ~(0xf << shift)) | (data << shift); - cgalaxn_display(); + prepare_display(); } READ8_MEMBER(cgalaxn_state::input_r) @@ -1225,7 +1225,7 @@ public: : hh_hmcs40_state(mconfig, type, tag) { } - void egalaxn2_display(); + void prepare_display(); DECLARE_WRITE8_MEMBER(plate_w); DECLARE_WRITE16_MEMBER(grid_w); DECLARE_READ8_MEMBER(input_r); @@ -1233,7 +1233,7 @@ public: // handlers -void egalaxn2_state::egalaxn2_display() +void egalaxn2_state::prepare_display() { 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); @@ -1250,7 +1250,7 @@ WRITE16_MEMBER(egalaxn2_state::grid_w) // D1-D15: vfd matrix grid m_grid = data >> 1; - egalaxn2_display(); + prepare_display(); } WRITE8_MEMBER(egalaxn2_state::plate_w) @@ -1258,7 +1258,7 @@ WRITE8_MEMBER(egalaxn2_state::plate_w) // R1x-R6x: vfd matrix plate int shift = (offset - HMCS40_PORT_R1X) * 4; m_plate = (m_plate & ~(0xf << shift)) | (data << shift); - egalaxn2_display(); + prepare_display(); } READ8_MEMBER(egalaxn2_state::input_r) @@ -1345,7 +1345,6 @@ public: epacman2_state(const machine_config &mconfig, device_type type, const char *tag) : egalaxn2_state(mconfig, type, tag) { } - }; // handlers are identical to Galaxian 2, so we can use those @@ -1515,7 +1514,7 @@ public: : hh_hmcs40_state(mconfig, type, tag) { } - void kingman_display(); + void prepare_display(); DECLARE_WRITE8_MEMBER(plate_w); DECLARE_WRITE16_MEMBER(grid_w); @@ -1525,7 +1524,7 @@ public: // handlers -void kingman_state::kingman_display() +void kingman_state::prepare_display() { UINT16 grid = BITSWAP16(m_grid,15,14,13,12,11,10,9,0,1,2,3,4,5,6,7,8); UINT32 plate = BITSWAP24(m_plate,23,6,7,5,4,3,2,1,0,13,12,20,19,18,17,16,10,11,9,8,14,15,13,12); @@ -1537,7 +1536,7 @@ WRITE8_MEMBER(kingman_state::plate_w) // R0x-R3x: vfd matrix plate int shift = offset * 4; m_plate = (m_plate & ~(0xf << shift)) | (data << shift); - kingman_display(); + prepare_display(); } WRITE16_MEMBER(kingman_state::grid_w) @@ -1558,7 +1557,7 @@ WRITE16_MEMBER(kingman_state::grid_w) // D0-D4: more plates m_plate = (m_plate & 0x00ffff) | (data << 16 & 0x1f0000); - kingman_display(); + prepare_display(); } void kingman_state::update_int0() @@ -1636,7 +1635,7 @@ public: : hh_hmcs40_state(mconfig, type, tag) { } - void tmtron_display(); + void prepare_display(); DECLARE_WRITE8_MEMBER(plate_w); DECLARE_WRITE16_MEMBER(grid_w); @@ -1646,7 +1645,7 @@ public: // handlers -void tmtron_state::tmtron_display() +void tmtron_state::prepare_display() { UINT16 grid = BITSWAP16(m_grid,15,14,13,12,11,10,1,2,3,4,5,6,7,8,9,0); UINT32 plate = BITSWAP24(m_plate,23,5,2,21,1,6,7,9,10,11,21,0,19,3,4,8,3,18,17,16,12,13,14,15); @@ -1658,7 +1657,7 @@ WRITE8_MEMBER(tmtron_state::plate_w) // R0x-R3x: vfd matrix plate int shift = offset * 4; m_plate = (m_plate & ~(0xf << shift)) | (data << shift); - tmtron_display(); + prepare_display(); } WRITE16_MEMBER(tmtron_state::grid_w) @@ -1679,7 +1678,7 @@ WRITE16_MEMBER(tmtron_state::grid_w) // D0-D3,D5: more plates m_plate = (m_plate & 0x00ffff) | (data << 16 & 0x2f0000); - tmtron_display(); + prepare_display(); } void tmtron_state::update_int1() diff --git a/src/mess/drivers/hh_tms1k.c b/src/mess/drivers/hh_tms1k.c index cb00cf87eac..5a1008f8a15 100644 --- a/src/mess/drivers/hh_tms1k.c +++ b/src/mess/drivers/hh_tms1k.c @@ -272,7 +272,7 @@ INPUT_CHANGED_MEMBER(hh_tms1k_state::power_button) /*************************************************************************** - Minidrivers (I/O, Inputs, Machine Config) + Minidrivers (subclass, I/O, Inputs, Machine Config) ***************************************************************************/ @@ -299,7 +299,22 @@ INPUT_CHANGED_MEMBER(hh_tms1k_state::power_button) ***************************************************************************/ -void hh_tms1k_state::mathmagi_display() +class mathmagi_state : public hh_tms1k_state +{ +public: + mathmagi_state(const machine_config &mconfig, device_type type, const char *tag) + : hh_tms1k_state(mconfig, type, tag) + { } + + void prepare_display(); + DECLARE_WRITE16_MEMBER(write_r); + DECLARE_WRITE16_MEMBER(write_o); + DECLARE_READ8_MEMBER(read_k); +}; + +// handlers + +void mathmagi_state::prepare_display() { // R0-R7: 7seg leds for (int y = 0; y < 8; y++) @@ -318,17 +333,17 @@ void hh_tms1k_state::mathmagi_display() display_update(); } -WRITE16_MEMBER(hh_tms1k_state::mathmagi_write_r) +WRITE16_MEMBER(mathmagi_state::write_r) { // R3,R5-R7,R9,R10: input mux m_inp_mux = (data >> 3 & 1) | (data >> 4 & 0xe) | (data >> 5 & 0x30); // +others: m_r = data; - mathmagi_display(); + prepare_display(); } -WRITE16_MEMBER(hh_tms1k_state::mathmagi_write_o) +WRITE16_MEMBER(mathmagi_state::write_o) { // O1-O7: led segments A-G // O0: N/C @@ -336,12 +351,14 @@ WRITE16_MEMBER(hh_tms1k_state::mathmagi_write_o) m_o = data; } -READ8_MEMBER(hh_tms1k_state::mathmagi_read_k) +READ8_MEMBER(mathmagi_state::read_k) { return read_inputs(6); } +// config + /* physical button layout and labels is like this: ON ONE [SEL] [NXT] [?] [/] @@ -391,6 +408,7 @@ static INPUT_PORTS_START( mathmagi ) PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_UNUSED ) INPUT_PORTS_END + // output PLA is not dumped static const UINT16 mathmagi_output_pla[0x20] = { @@ -428,14 +446,14 @@ static const UINT16 mathmagi_output_pla[0x20] = lA+lF+lE+lD+lC // G }; -static MACHINE_CONFIG_START( mathmagi, hh_tms1k_state ) +static MACHINE_CONFIG_START( mathmagi, mathmagi_state ) /* basic machine hardware */ MCFG_CPU_ADD("maincpu", TMS1100, 175000) // RC osc. R=68K, C=82pf -> ~175kHz MCFG_TMS1XXX_OUTPUT_PLA(mathmagi_output_pla) - MCFG_TMS1XXX_READ_K_CB(READ8(hh_tms1k_state, mathmagi_read_k)) - MCFG_TMS1XXX_WRITE_R_CB(WRITE16(hh_tms1k_state, mathmagi_write_r)) - MCFG_TMS1XXX_WRITE_O_CB(WRITE16(hh_tms1k_state, mathmagi_write_o)) + MCFG_TMS1XXX_READ_K_CB(READ8(mathmagi_state, read_k)) + MCFG_TMS1XXX_WRITE_R_CB(WRITE16(mathmagi_state, write_r)) + MCFG_TMS1XXX_WRITE_O_CB(WRITE16(mathmagi_state, write_o)) MCFG_TIMER_DRIVER_ADD_PERIODIC("display_decay", hh_tms1k_state, display_decay_tick, attotime::from_msec(1)) MCFG_DEFAULT_LAYOUT(layout_mathmagi) @@ -462,7 +480,22 @@ MACHINE_CONFIG_END ***************************************************************************/ -void hh_tms1k_state::amaztron_display() +class amaztron_state : public hh_tms1k_state +{ +public: + amaztron_state(const machine_config &mconfig, device_type type, const char *tag) + : hh_tms1k_state(mconfig, type, tag) + { } + + void prepare_display(); + DECLARE_WRITE16_MEMBER(write_r); + DECLARE_WRITE16_MEMBER(write_o); + DECLARE_READ8_MEMBER(read_k); +}; + +// handlers + +void amaztron_state::prepare_display() { // R8,R9: select digit for (int y = 0; y < 2; y++) @@ -478,7 +511,7 @@ void hh_tms1k_state::amaztron_display() display_update(); } -WRITE16_MEMBER(hh_tms1k_state::amaztron_write_r) +WRITE16_MEMBER(amaztron_state::write_r) { // R0-R5: input mux m_inp_mux = data & 0x3f; @@ -488,18 +521,18 @@ WRITE16_MEMBER(hh_tms1k_state::amaztron_write_r) // other bits: m_r = data; - amaztron_display(); + prepare_display(); } -WRITE16_MEMBER(hh_tms1k_state::amaztron_write_o) +WRITE16_MEMBER(amaztron_state::write_o) { // O0-O6: digit segments // O7: N/C m_o = data & 0x7f; - amaztron_display(); + prepare_display(); } -READ8_MEMBER(hh_tms1k_state::amaztron_read_k) +READ8_MEMBER(amaztron_state::read_k) { UINT8 k = read_inputs(6); @@ -509,6 +542,8 @@ READ8_MEMBER(hh_tms1k_state::amaztron_read_k) } +// config + static INPUT_PORTS_START( amaztron ) PORT_START("IN.0") // R0 PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_CODE(KEYCODE_1) PORT_NAME("Button 1") @@ -553,14 +588,13 @@ static INPUT_PORTS_START( amaztron ) PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_UNUSED) INPUT_PORTS_END - -static MACHINE_CONFIG_START( amaztron, hh_tms1k_state ) +static MACHINE_CONFIG_START( amaztron, amaztron_state ) /* basic machine hardware */ MCFG_CPU_ADD("maincpu", TMS1100, 350000) // RC osc. R=33K?, C=100pf -> ~350kHz - MCFG_TMS1XXX_READ_K_CB(READ8(hh_tms1k_state, amaztron_read_k)) - MCFG_TMS1XXX_WRITE_R_CB(WRITE16(hh_tms1k_state, amaztron_write_r)) - MCFG_TMS1XXX_WRITE_O_CB(WRITE16(hh_tms1k_state, amaztron_write_o)) + MCFG_TMS1XXX_READ_K_CB(READ8(amaztron_state, read_k)) + MCFG_TMS1XXX_WRITE_R_CB(WRITE16(amaztron_state, write_r)) + MCFG_TMS1XXX_WRITE_O_CB(WRITE16(amaztron_state, write_o)) MCFG_TIMER_DRIVER_ADD_PERIODIC("display_decay", hh_tms1k_state, display_decay_tick, attotime::from_msec(1)) MCFG_DEFAULT_LAYOUT(layout_amaztron) @@ -609,7 +643,22 @@ MACHINE_CONFIG_END ***************************************************************************/ -void hh_tms1k_state::tc4_display() +class tc4_state : public hh_tms1k_state +{ +public: + tc4_state(const machine_config &mconfig, device_type type, const char *tag) + : hh_tms1k_state(mconfig, type, tag) + { } + + void prepare_display(); + DECLARE_WRITE16_MEMBER(write_r); + DECLARE_WRITE16_MEMBER(write_o); + DECLARE_READ8_MEMBER(read_k); +}; + +// handlers + +void tc4_state::prepare_display() { m_display_wait = 50; @@ -622,7 +671,7 @@ void hh_tms1k_state::tc4_display() display_matrix(9, 10, (m_o | (m_r << 2 & 0x100)), m_r); } -WRITE16_MEMBER(hh_tms1k_state::tc4_write_r) +WRITE16_MEMBER(tc4_state::write_r) { // R10: speaker out m_speaker->level_w(data >> 10 & 1); @@ -634,17 +683,17 @@ WRITE16_MEMBER(hh_tms1k_state::tc4_write_r) // R6: led column 8 // +other columns m_r = data; - tc4_display(); + prepare_display(); } -WRITE16_MEMBER(hh_tms1k_state::tc4_write_o) +WRITE16_MEMBER(tc4_state::write_o) { // O0-O7: led row m_o = data; - tc4_display(); + prepare_display(); } -READ8_MEMBER(hh_tms1k_state::tc4_read_k) +READ8_MEMBER(tc4_state::read_k) { UINT8 k = read_inputs(6); @@ -656,6 +705,8 @@ READ8_MEMBER(hh_tms1k_state::tc4_read_k) } +// config + static INPUT_PORTS_START( tc4 ) PORT_START("IN.0") // R0 PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_BUTTON3 ) PORT_NAME("P1 Pass/Shoot Button 3") // right @@ -701,14 +752,13 @@ static INPUT_PORTS_START( tc4 ) PORT_CONFSETTING( 0x08, "Football" ) INPUT_PORTS_END - -static MACHINE_CONFIG_START( tc4, hh_tms1k_state ) +static MACHINE_CONFIG_START( tc4, tc4_state ) /* basic machine hardware */ MCFG_CPU_ADD("maincpu", TMS1400, 450000) // approximation - RC osc. R=27.3K, C=100pf, but unknown RC curve - MCFG_TMS1XXX_READ_K_CB(READ8(hh_tms1k_state, tc4_read_k)) - MCFG_TMS1XXX_WRITE_R_CB(WRITE16(hh_tms1k_state, tc4_write_r)) - MCFG_TMS1XXX_WRITE_O_CB(WRITE16(hh_tms1k_state, tc4_write_o)) + MCFG_TMS1XXX_READ_K_CB(READ8(tc4_state, read_k)) + MCFG_TMS1XXX_WRITE_R_CB(WRITE16(tc4_state, write_r)) + MCFG_TMS1XXX_WRITE_O_CB(WRITE16(tc4_state, write_o)) MCFG_TIMER_DRIVER_ADD_PERIODIC("display_decay", hh_tms1k_state, display_decay_tick, attotime::from_msec(1)) MCFG_DEFAULT_LAYOUT(layout_tc4) @@ -757,7 +807,22 @@ MACHINE_CONFIG_END ***************************************************************************/ -void hh_tms1k_state::ebball_display() +class ebball_state : public hh_tms1k_state +{ +public: + ebball_state(const machine_config &mconfig, device_type type, const char *tag) + : hh_tms1k_state(mconfig, type, tag) + { } + + void prepare_display(); + DECLARE_WRITE16_MEMBER(write_r); + DECLARE_WRITE16_MEMBER(write_o); + DECLARE_READ8_MEMBER(read_k); +}; + +// handlers + +void ebball_state::prepare_display() { // R8 is a 7seg m_display_segmask[8] = 0x7f; @@ -765,7 +830,7 @@ void hh_tms1k_state::ebball_display() display_matrix(7, 9, ~m_o, m_r); } -WRITE16_MEMBER(hh_tms1k_state::ebball_write_r) +WRITE16_MEMBER(ebball_state::write_r) { // R1-R5: input mux m_inp_mux = data >> 1 & 0x1f; @@ -775,24 +840,26 @@ WRITE16_MEMBER(hh_tms1k_state::ebball_write_r) // R0-R8: led columns m_r = data; - ebball_display(); + prepare_display(); } -WRITE16_MEMBER(hh_tms1k_state::ebball_write_o) +WRITE16_MEMBER(ebball_state::write_o) { // O0-O6: led row // O7: N/C m_o = data; - ebball_display(); + prepare_display(); } -READ8_MEMBER(hh_tms1k_state::ebball_read_k) +READ8_MEMBER(ebball_state::read_k) { // note: K8(Vss row) is always on return m_inp_matrix[5]->read() | read_inputs(5); } +// config + static INPUT_PORTS_START( ebball ) PORT_START("IN.0") // R1 PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_BUTTON2 ) PORT_PLAYER(2) PORT_NAME("P2 Change Up") @@ -823,14 +890,13 @@ static INPUT_PORTS_START( ebball ) PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_BUTTON1 ) PORT_NAME("P1 Batter") INPUT_PORTS_END - -static MACHINE_CONFIG_START( ebball, hh_tms1k_state ) +static MACHINE_CONFIG_START( ebball, ebball_state ) /* basic machine hardware */ MCFG_CPU_ADD("maincpu", TMS1000, 375000) // RC osc. R=43K, C=47pf -> ~375kHz - MCFG_TMS1XXX_READ_K_CB(READ8(hh_tms1k_state, ebball_read_k)) - MCFG_TMS1XXX_WRITE_R_CB(WRITE16(hh_tms1k_state, ebball_write_r)) - MCFG_TMS1XXX_WRITE_O_CB(WRITE16(hh_tms1k_state, ebball_write_o)) + MCFG_TMS1XXX_READ_K_CB(READ8(ebball_state, read_k)) + MCFG_TMS1XXX_WRITE_R_CB(WRITE16(ebball_state, write_r)) + MCFG_TMS1XXX_WRITE_O_CB(WRITE16(ebball_state, write_o)) MCFG_TIMER_DRIVER_ADD_PERIODIC("display_decay", hh_tms1k_state, display_decay_tick, attotime::from_msec(1)) MCFG_DEFAULT_LAYOUT(layout_ebball) @@ -875,7 +941,22 @@ MACHINE_CONFIG_END ***************************************************************************/ -void hh_tms1k_state::ebball2_display() +class ebball2_state : public hh_tms1k_state +{ +public: + ebball2_state(const machine_config &mconfig, device_type type, const char *tag) + : hh_tms1k_state(mconfig, type, tag) + { } + + void prepare_display(); + DECLARE_WRITE16_MEMBER(write_r); + DECLARE_WRITE16_MEMBER(write_o); + DECLARE_READ8_MEMBER(read_k); +}; + +// handlers + +void ebball2_state::prepare_display() { // the first 3 are 7segs for (int y = 0; y < 3; y++) @@ -884,7 +965,7 @@ void hh_tms1k_state::ebball2_display() display_matrix(8, 10, ~m_o, m_r ^ 0x7f); } -WRITE16_MEMBER(hh_tms1k_state::ebball2_write_r) +WRITE16_MEMBER(ebball2_state::write_r) { // R3-R6: input mux m_inp_mux = data >> 3 & 0xf; @@ -894,22 +975,24 @@ WRITE16_MEMBER(hh_tms1k_state::ebball2_write_r) // R0-R9: led columns m_r = data; - ebball2_display(); + prepare_display(); } -WRITE16_MEMBER(hh_tms1k_state::ebball2_write_o) +WRITE16_MEMBER(ebball2_state::write_o) { // O0-O7: led row/segment m_o = data; - ebball2_display(); + prepare_display(); } -READ8_MEMBER(hh_tms1k_state::ebball2_read_k) +READ8_MEMBER(ebball2_state::read_k) { return read_inputs(4); } +// config + static INPUT_PORTS_START( ebball2 ) PORT_START("IN.0") // R3 PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_UNUSED ) @@ -934,14 +1017,13 @@ static INPUT_PORTS_START( ebball2 ) PORT_BIT( 0x0a, IP_ACTIVE_HIGH, IPT_UNUSED ) INPUT_PORTS_END - -static MACHINE_CONFIG_START( ebball2, hh_tms1k_state ) +static MACHINE_CONFIG_START( ebball2, ebball2_state ) /* basic machine hardware */ MCFG_CPU_ADD("maincpu", TMS1000, 350000) // RC osc. R=47K, C=47pf -> ~350kHz - MCFG_TMS1XXX_READ_K_CB(READ8(hh_tms1k_state, ebball2_read_k)) - MCFG_TMS1XXX_WRITE_R_CB(WRITE16(hh_tms1k_state, ebball2_write_r)) - MCFG_TMS1XXX_WRITE_O_CB(WRITE16(hh_tms1k_state, ebball2_write_o)) + MCFG_TMS1XXX_READ_K_CB(READ8(ebball2_state, read_k)) + MCFG_TMS1XXX_WRITE_R_CB(WRITE16(ebball2_state, write_r)) + MCFG_TMS1XXX_WRITE_O_CB(WRITE16(ebball2_state, write_o)) MCFG_TIMER_DRIVER_ADD_PERIODIC("display_decay", hh_tms1k_state, display_decay_tick, attotime::from_msec(1)) MCFG_DEFAULT_LAYOUT(layout_ebball2) @@ -991,7 +1073,28 @@ MACHINE_CONFIG_END ***************************************************************************/ -void hh_tms1k_state::ebball3_display() +class ebball3_state : public hh_tms1k_state +{ +public: + ebball3_state(const machine_config &mconfig, device_type type, const char *tag) + : hh_tms1k_state(mconfig, type, tag) + { } + + void prepare_display(); + DECLARE_WRITE16_MEMBER(write_r); + DECLARE_WRITE16_MEMBER(write_o); + DECLARE_READ8_MEMBER(read_k); + + void set_clock(); + DECLARE_INPUT_CHANGED_MEMBER(difficulty_switch); + +protected: + virtual void machine_reset(); +}; + +// handlers + +void ebball3_state::prepare_display() { // update current state for (int y = 0; y < 10; y++) @@ -1009,7 +1112,7 @@ void hh_tms1k_state::ebball3_display() display_update(); } -WRITE16_MEMBER(hh_tms1k_state::ebball3_write_r) +WRITE16_MEMBER(ebball3_state::write_r) { // R0-R2: input mux m_inp_mux = data & 7; @@ -1019,23 +1122,25 @@ WRITE16_MEMBER(hh_tms1k_state::ebball3_write_r) // R0-R9: led columns m_r = data; - ebball3_display(); + prepare_display(); } -WRITE16_MEMBER(hh_tms1k_state::ebball3_write_o) +WRITE16_MEMBER(ebball3_state::write_o) { // O0-O6: led row // O7: N/C m_o = data & 0x7f; - ebball3_display(); + prepare_display(); } -READ8_MEMBER(hh_tms1k_state::ebball3_read_k) +READ8_MEMBER(ebball3_state::read_k) { return read_inputs(3); } +// config + /* physical button layout and labels is like this: main device (batter side): remote pitcher: @@ -1070,13 +1175,18 @@ static INPUT_PORTS_START( ebball3 ) PORT_BIT( 0x0c, IP_ACTIVE_HIGH, IPT_UNUSED ) PORT_START("IN.3") // fake - PORT_CONFNAME( 0x01, 0x00, DEF_STR( Difficulty ) ) PORT_CHANGED_MEMBER(DEVICE_SELF, hh_tms1k_state, ebball3_difficulty_switch, NULL) + PORT_CONFNAME( 0x01, 0x00, DEF_STR( Difficulty ) ) PORT_CHANGED_MEMBER(DEVICE_SELF, ebball3_state, difficulty_switch, NULL) PORT_CONFSETTING( 0x00, "Amateur" ) PORT_CONFSETTING( 0x01, "Professional" ) INPUT_PORTS_END +INPUT_CHANGED_MEMBER(ebball3_state::difficulty_switch) +{ + set_clock(); +} -void hh_tms1k_state::ebball3_set_clock() + +void ebball3_state::set_clock() { // MCU clock is from an RC circuit(R=47K, C=33pf) oscillating by default at ~340kHz, // but on PRO, the difficulty switch adds an extra 150K resistor to Vdd to speed @@ -1084,30 +1194,23 @@ void hh_tms1k_state::ebball3_set_clock() m_maincpu->set_unscaled_clock((m_inp_matrix[3]->read() & 1) ? 440000 : 340000); } -INPUT_CHANGED_MEMBER(hh_tms1k_state::ebball3_difficulty_switch) +void ebball3_state::machine_reset() { - ebball3_set_clock(); + hh_tms1k_state::machine_reset(); + set_clock(); } -MACHINE_RESET_MEMBER(hh_tms1k_state, ebball3) -{ - machine_reset(); - ebball3_set_clock(); -} - -static MACHINE_CONFIG_START( ebball3, hh_tms1k_state ) +static MACHINE_CONFIG_START( ebball3, ebball3_state ) /* basic machine hardware */ - MCFG_CPU_ADD("maincpu", TMS1100, 340000) // see ebball3_set_clock - MCFG_TMS1XXX_READ_K_CB(READ8(hh_tms1k_state, ebball3_read_k)) - MCFG_TMS1XXX_WRITE_R_CB(WRITE16(hh_tms1k_state, ebball3_write_r)) - MCFG_TMS1XXX_WRITE_O_CB(WRITE16(hh_tms1k_state, ebball3_write_o)) + MCFG_CPU_ADD("maincpu", TMS1100, 340000) // see set_clock + MCFG_TMS1XXX_READ_K_CB(READ8(ebball3_state, read_k)) + MCFG_TMS1XXX_WRITE_R_CB(WRITE16(ebball3_state, write_r)) + MCFG_TMS1XXX_WRITE_O_CB(WRITE16(ebball3_state, write_o)) MCFG_TIMER_DRIVER_ADD_PERIODIC("display_decay", hh_tms1k_state, display_decay_tick, attotime::from_msec(1)) MCFG_DEFAULT_LAYOUT(layout_ebball3) - MCFG_MACHINE_RESET_OVERRIDE(hh_tms1k_state, ebball3) - /* no video! */ /* sound hardware */ @@ -1135,7 +1238,21 @@ MACHINE_CONFIG_END ***************************************************************************/ -WRITE16_MEMBER(hh_tms1k_state::elecdet_write_r) +class elecdet_state : public hh_tms1k_state +{ +public: + elecdet_state(const machine_config &mconfig, device_type type, const char *tag) + : hh_tms1k_state(mconfig, type, tag) + { } + + DECLARE_WRITE16_MEMBER(write_r); + DECLARE_WRITE16_MEMBER(write_o); + DECLARE_READ8_MEMBER(read_k); +}; + +// handlers + +WRITE16_MEMBER(elecdet_state::write_r) { // R7,R8: speaker on m_speaker->level_w((data & 0x180 && m_o & 0x80) ? 1 : 0); @@ -1147,7 +1264,7 @@ WRITE16_MEMBER(hh_tms1k_state::elecdet_write_r) display_matrix(7, 7, BITSWAP8(m_o,7,5,2,1,4,0,6,3), data); } -WRITE16_MEMBER(hh_tms1k_state::elecdet_write_o) +WRITE16_MEMBER(elecdet_state::write_o) { // O0,O1,O4,O6: input mux m_inp_mux = (data & 3) | (data >> 2 & 4) | (data >> 3 & 8); @@ -1157,13 +1274,15 @@ WRITE16_MEMBER(hh_tms1k_state::elecdet_write_o) m_o = data; } -READ8_MEMBER(hh_tms1k_state::elecdet_read_k) +READ8_MEMBER(elecdet_state::read_k) { // note: the Vss row is always on return m_inp_matrix[4]->read() | read_inputs(4); } +// config + /* physical button layout and labels is like this: [1] [2] [3] [SUSPECT] @@ -1211,14 +1330,13 @@ static INPUT_PORTS_START( elecdet ) PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_PGDN) PORT_NAME("Off") PORT_CHANGED_MEMBER(DEVICE_SELF, hh_tms1k_state, power_button, (void *)false) INPUT_PORTS_END - -static MACHINE_CONFIG_START( elecdet, hh_tms1k_state ) +static MACHINE_CONFIG_START( elecdet, elecdet_state ) /* basic machine hardware */ MCFG_CPU_ADD("maincpu", TMS0980, 425000) // approximation - unknown freq - MCFG_TMS1XXX_READ_K_CB(READ8(hh_tms1k_state, elecdet_read_k)) - MCFG_TMS1XXX_WRITE_R_CB(WRITE16(hh_tms1k_state, elecdet_write_r)) - MCFG_TMS1XXX_WRITE_O_CB(WRITE16(hh_tms1k_state, elecdet_write_o)) + MCFG_TMS1XXX_READ_K_CB(READ8(elecdet_state, read_k)) + MCFG_TMS1XXX_WRITE_R_CB(WRITE16(elecdet_state, write_r)) + MCFG_TMS1XXX_WRITE_O_CB(WRITE16(elecdet_state, write_o)) MCFG_TMS1XXX_POWER_OFF_CB(WRITELINE(hh_tms1k_state, auto_power_off)) MCFG_TIMER_DRIVER_ADD_PERIODIC("display_decay", hh_tms1k_state, display_decay_tick, attotime::from_msec(1)) @@ -1248,15 +1366,29 @@ MACHINE_CONFIG_END ***************************************************************************/ -void hh_tms1k_state::starwbc_display() +class starwbc_state : public hh_tms1k_state +{ +public: + starwbc_state(const machine_config &mconfig, device_type type, const char *tag) + : hh_tms1k_state(mconfig, type, tag) + { } + + void prepare_display(); + DECLARE_WRITE16_MEMBER(write_r); + DECLARE_WRITE16_MEMBER(write_o); + DECLARE_READ8_MEMBER(read_k); +}; + +// handlers + +void starwbc_state::prepare_display() { // R6,R8 are 7segs m_display_segmask[6] = m_display_segmask[8] = 0x7f; - display_matrix(8, 10, m_o, m_r); } -WRITE16_MEMBER(hh_tms1k_state::starwbc_write_r) +WRITE16_MEMBER(starwbc_state::write_r) { // R0,R1,R3,R5,R7: input mux m_inp_mux = (data & 3) | (data >> 1 & 4) | (data >> 2 & 8) | (data >> 3 & 0x10); @@ -1266,22 +1398,24 @@ WRITE16_MEMBER(hh_tms1k_state::starwbc_write_r) // R0,R2,R4,R6,R8: led columns m_r = data & 0x155; - starwbc_display(); + prepare_display(); } -WRITE16_MEMBER(hh_tms1k_state::starwbc_write_o) +WRITE16_MEMBER(starwbc_state::write_o) { // O0-O7: led row m_o = (data << 4 & 0xf0) | (data >> 4 & 0x0f); - starwbc_display(); + prepare_display(); } -READ8_MEMBER(hh_tms1k_state::starwbc_read_k) +READ8_MEMBER(starwbc_state::read_k) { return read_inputs(5); } +// config + /* physical button layout and labels is like this: (reconnnaissance=yellow) (tactical reaction=green) @@ -1324,13 +1458,13 @@ static INPUT_PORTS_START( starwbc ) PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_CODE(KEYCODE_RIGHT) PORT_NAME("Right") INPUT_PORTS_END -static MACHINE_CONFIG_START( starwbc, hh_tms1k_state ) +static MACHINE_CONFIG_START( starwbc, starwbc_state ) /* basic machine hardware */ MCFG_CPU_ADD("maincpu", TMS1100, 325000) // RC osc. R=51K, C=47pf -> ~325kHz - MCFG_TMS1XXX_READ_K_CB(READ8(hh_tms1k_state, starwbc_read_k)) - MCFG_TMS1XXX_WRITE_R_CB(WRITE16(hh_tms1k_state, starwbc_write_r)) - MCFG_TMS1XXX_WRITE_O_CB(WRITE16(hh_tms1k_state, starwbc_write_o)) + MCFG_TMS1XXX_READ_K_CB(READ8(starwbc_state, read_k)) + MCFG_TMS1XXX_WRITE_R_CB(WRITE16(starwbc_state, write_r)) + MCFG_TMS1XXX_WRITE_O_CB(WRITE16(starwbc_state, write_o)) MCFG_TIMER_DRIVER_ADD_PERIODIC("display_decay", hh_tms1k_state, display_decay_tick, attotime::from_msec(1)) MCFG_DEFAULT_LAYOUT(layout_starwbc) @@ -1358,7 +1492,22 @@ MACHINE_CONFIG_END ***************************************************************************/ -void hh_tms1k_state::astro_display() +class astro_state : public hh_tms1k_state +{ +public: + astro_state(const machine_config &mconfig, device_type type, const char *tag) + : hh_tms1k_state(mconfig, type, tag) + { } + + void prepare_display(); + DECLARE_WRITE16_MEMBER(write_r); + DECLARE_WRITE16_MEMBER(write_o); + DECLARE_READ8_MEMBER(read_k); +}; + +// handlers + +void astro_state::prepare_display() { // declare 7segs for (int y = 0; y < 9; y++) @@ -1367,29 +1516,31 @@ void hh_tms1k_state::astro_display() display_matrix(8, 10, m_o, m_r); } -WRITE16_MEMBER(hh_tms1k_state::astro_write_r) +WRITE16_MEMBER(astro_state::write_r) { // R0-R7: input mux m_inp_mux = data & 0xff; // R0-R9: select digit/leds m_r = data; - astro_display(); + prepare_display(); } -WRITE16_MEMBER(hh_tms1k_state::astro_write_o) +WRITE16_MEMBER(astro_state::write_o) { // O0-O7: digit segments/leds m_o = data; - astro_display(); + prepare_display(); } -READ8_MEMBER(hh_tms1k_state::astro_read_k) +READ8_MEMBER(astro_state::read_k) { return read_inputs(8); } +// config + static INPUT_PORTS_START( astro ) PORT_START("IN.0") // R0 PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_0) PORT_CODE(KEYCODE_0_PAD) PORT_NAME("0") @@ -1438,14 +1589,13 @@ static INPUT_PORTS_START( astro ) PORT_CONFSETTING( 0x08, "Astro" ) INPUT_PORTS_END - -static MACHINE_CONFIG_START( astro, hh_tms1k_state ) +static MACHINE_CONFIG_START( astro, astro_state ) /* basic machine hardware */ MCFG_CPU_ADD("maincpu", TMS1470, 450000) // approximation - RC osc. R=4.7K, C=33pf, but unknown RC curve - MCFG_TMS1XXX_READ_K_CB(READ8(hh_tms1k_state, astro_read_k)) - MCFG_TMS1XXX_WRITE_R_CB(WRITE16(hh_tms1k_state, astro_write_r)) - MCFG_TMS1XXX_WRITE_O_CB(WRITE16(hh_tms1k_state, astro_write_o)) + MCFG_TMS1XXX_READ_K_CB(READ8(astro_state, read_k)) + MCFG_TMS1XXX_WRITE_R_CB(WRITE16(astro_state, write_r)) + MCFG_TMS1XXX_WRITE_O_CB(WRITE16(astro_state, write_o)) MCFG_TIMER_DRIVER_ADD_PERIODIC("display_decay", hh_tms1k_state, display_decay_tick, attotime::from_msec(1)) MCFG_DEFAULT_LAYOUT(layout_astro) @@ -1474,7 +1624,21 @@ MACHINE_CONFIG_END ***************************************************************************/ -WRITE16_MEMBER(hh_tms1k_state::comp4_write_r) +class comp4_state : public hh_tms1k_state +{ +public: + comp4_state(const machine_config &mconfig, device_type type, const char *tag) + : hh_tms1k_state(mconfig, type, tag) + { } + + DECLARE_WRITE16_MEMBER(write_r); + DECLARE_WRITE16_MEMBER(write_o); + DECLARE_READ8_MEMBER(read_k); +}; + +// handlers + +WRITE16_MEMBER(comp4_state::write_r) { // leds: // R4 R9 @@ -1486,7 +1650,7 @@ WRITE16_MEMBER(hh_tms1k_state::comp4_write_r) display_matrix(11, 1, m_r, m_o); } -WRITE16_MEMBER(hh_tms1k_state::comp4_write_o) +WRITE16_MEMBER(comp4_state::write_o) { // O1-O3: input mux m_inp_mux = data >> 1 & 7; @@ -1497,12 +1661,14 @@ WRITE16_MEMBER(hh_tms1k_state::comp4_write_o) display_matrix(11, 1, m_r, m_o); } -READ8_MEMBER(hh_tms1k_state::comp4_read_k) +READ8_MEMBER(comp4_state::read_k) { return read_inputs(3); } +// config + static INPUT_PORTS_START( comp4 ) PORT_START("IN.0") // O1 PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_R) PORT_CODE(KEYCODE_DEL) PORT_CODE(KEYCODE_DEL_PAD) PORT_NAME("R") @@ -1523,13 +1689,13 @@ static INPUT_PORTS_START( comp4 ) PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_9) PORT_CODE(KEYCODE_9_PAD) PORT_NAME("9") INPUT_PORTS_END -static MACHINE_CONFIG_START( comp4, hh_tms1k_state ) +static MACHINE_CONFIG_START( comp4, comp4_state ) /* basic machine hardware */ MCFG_CPU_ADD("maincpu", TMS0970, 250000) // approximation - unknown freq - MCFG_TMS1XXX_READ_K_CB(READ8(hh_tms1k_state, comp4_read_k)) - MCFG_TMS1XXX_WRITE_R_CB(WRITE16(hh_tms1k_state, comp4_write_r)) - MCFG_TMS1XXX_WRITE_O_CB(WRITE16(hh_tms1k_state, comp4_write_o)) + MCFG_TMS1XXX_READ_K_CB(READ8(comp4_state, read_k)) + MCFG_TMS1XXX_WRITE_R_CB(WRITE16(comp4_state, write_r)) + MCFG_TMS1XXX_WRITE_O_CB(WRITE16(comp4_state, write_o)) MCFG_TIMER_DRIVER_ADD_PERIODIC("display_decay", hh_tms1k_state, display_decay_tick, attotime::from_msec(1)) MCFG_DEFAULT_LAYOUT(layout_comp4) @@ -1558,7 +1724,21 @@ MACHINE_CONFIG_END ***************************************************************************/ -WRITE16_MEMBER(hh_tms1k_state::simon_write_r) +class simon_state : public hh_tms1k_state +{ +public: + simon_state(const machine_config &mconfig, device_type type, const char *tag) + : hh_tms1k_state(mconfig, type, tag) + { } + + DECLARE_WRITE16_MEMBER(write_r); + DECLARE_WRITE16_MEMBER(write_o); + DECLARE_READ8_MEMBER(read_k); +}; + +// handlers + +WRITE16_MEMBER(simon_state::write_r) { // R4-R8 go through an 75494 IC first: // R4 -> 75494 IN6 -> green lamp @@ -1576,17 +1756,19 @@ WRITE16_MEMBER(hh_tms1k_state::simon_write_r) m_inp_mux = (data & 7) | (data >> 6 & 8); } -WRITE16_MEMBER(hh_tms1k_state::simon_write_o) +WRITE16_MEMBER(simon_state::write_o) { // N/C } -READ8_MEMBER(hh_tms1k_state::simon_read_k) +READ8_MEMBER(simon_state::read_k) { return read_inputs(4); } +// config + static INPUT_PORTS_START( simon ) PORT_START("IN.0") // R0 PORT_CONFNAME( 0x07, 0x02, "Game Select") @@ -1615,14 +1797,13 @@ static INPUT_PORTS_START( simon ) PORT_CONFSETTING( 0x01, "4" ) INPUT_PORTS_END - -static MACHINE_CONFIG_START( simon, hh_tms1k_state ) +static MACHINE_CONFIG_START( simon, simon_state ) /* basic machine hardware */ MCFG_CPU_ADD("maincpu", TMS1000, 350000) // RC osc. R=33K, C=100pf -> ~350kHz - MCFG_TMS1XXX_READ_K_CB(READ8(hh_tms1k_state, simon_read_k)) - MCFG_TMS1XXX_WRITE_R_CB(WRITE16(hh_tms1k_state, simon_write_r)) - MCFG_TMS1XXX_WRITE_O_CB(WRITE16(hh_tms1k_state, simon_write_o)) + MCFG_TMS1XXX_READ_K_CB(READ8(simon_state, read_k)) + MCFG_TMS1XXX_WRITE_R_CB(WRITE16(simon_state, write_r)) + MCFG_TMS1XXX_WRITE_O_CB(WRITE16(simon_state, write_o)) MCFG_TIMER_DRIVER_ADD_PERIODIC("display_decay", hh_tms1k_state, display_decay_tick, attotime::from_msec(1)) MCFG_DEFAULT_LAYOUT(layout_simon) @@ -1650,7 +1831,27 @@ MACHINE_CONFIG_END ***************************************************************************/ -WRITE16_MEMBER(hh_tms1k_state::ssimon_write_r) +class ssimon_state : public hh_tms1k_state +{ +public: + ssimon_state(const machine_config &mconfig, device_type type, const char *tag) + : hh_tms1k_state(mconfig, type, tag) + { } + + DECLARE_WRITE16_MEMBER(write_r); + DECLARE_WRITE16_MEMBER(write_o); + DECLARE_READ8_MEMBER(read_k); + + void set_clock(); + DECLARE_INPUT_CHANGED_MEMBER(speed_switch); + +protected: + virtual void machine_reset(); +}; + +// handlers + +WRITE16_MEMBER(ssimon_state::write_r) { // R0-R3,R9,R10: input mux m_inp_mux = (data & 0xf) | (data >> 5 & 0x30); @@ -1665,17 +1866,19 @@ WRITE16_MEMBER(hh_tms1k_state::ssimon_write_r) m_speaker->level_w(data >> 8 & 1); } -WRITE16_MEMBER(hh_tms1k_state::ssimon_write_o) +WRITE16_MEMBER(ssimon_state::write_o) { // N/C } -READ8_MEMBER(hh_tms1k_state::ssimon_read_k) +READ8_MEMBER(ssimon_state::read_k) { return read_inputs(6); } +// config + static INPUT_PORTS_START( ssimon ) PORT_START("IN.0") // R0 PORT_CONFNAME( 0x0f, 0x01, "Game Select") @@ -1717,14 +1920,19 @@ static INPUT_PORTS_START( ssimon ) PORT_BIT( 0x0d, IP_ACTIVE_HIGH, IPT_UNUSED ) PORT_START("IN.6") // fake - PORT_CONFNAME( 0x03, 0x01, "Speed" ) PORT_CHANGED_MEMBER(DEVICE_SELF, hh_tms1k_state, ssimon_speed_switch, NULL) + PORT_CONFNAME( 0x03, 0x01, "Speed" ) PORT_CHANGED_MEMBER(DEVICE_SELF, ssimon_state, speed_switch, NULL) PORT_CONFSETTING( 0x00, "Simple" ) PORT_CONFSETTING( 0x01, "Normal" ) PORT_CONFSETTING( 0x02, "Super" ) INPUT_PORTS_END +INPUT_CHANGED_MEMBER(ssimon_state::speed_switch) +{ + set_clock(); +} -void hh_tms1k_state::ssimon_set_clock() + +void ssimon_state::set_clock() { // MCU clock is from an RC circuit with C=100pf, R=x depending on speed switch: // 0 Simple: R=51K -> ~200kHz @@ -1734,30 +1942,23 @@ void hh_tms1k_state::ssimon_set_clock() m_maincpu->set_unscaled_clock((inp & 2) ? 400000 : ((inp & 1) ? 275000 : 200000)); } -INPUT_CHANGED_MEMBER(hh_tms1k_state::ssimon_speed_switch) +void ssimon_state::machine_reset() { - ssimon_set_clock(); + hh_tms1k_state::machine_reset(); + set_clock(); } -MACHINE_RESET_MEMBER(hh_tms1k_state, ssimon) -{ - machine_reset(); - ssimon_set_clock(); -} - -static MACHINE_CONFIG_START( ssimon, hh_tms1k_state ) +static MACHINE_CONFIG_START( ssimon, ssimon_state ) /* basic machine hardware */ - MCFG_CPU_ADD("maincpu", TMS1100, 275000) // see ssimon_set_clock - MCFG_TMS1XXX_READ_K_CB(READ8(hh_tms1k_state, ssimon_read_k)) - MCFG_TMS1XXX_WRITE_R_CB(WRITE16(hh_tms1k_state, ssimon_write_r)) - MCFG_TMS1XXX_WRITE_O_CB(WRITE16(hh_tms1k_state, ssimon_write_o)) + MCFG_CPU_ADD("maincpu", TMS1100, 275000) // see set_clock + MCFG_TMS1XXX_READ_K_CB(READ8(ssimon_state, read_k)) + MCFG_TMS1XXX_WRITE_R_CB(WRITE16(ssimon_state, write_r)) + MCFG_TMS1XXX_WRITE_O_CB(WRITE16(ssimon_state, write_o)) MCFG_TIMER_DRIVER_ADD_PERIODIC("display_decay", hh_tms1k_state, display_decay_tick, attotime::from_msec(1)) MCFG_DEFAULT_LAYOUT(layout_ssimon) - MCFG_MACHINE_RESET_OVERRIDE(hh_tms1k_state, ssimon) - /* no video! */ /* sound hardware */ @@ -1782,7 +1983,21 @@ MACHINE_CONFIG_END ***************************************************************************/ -WRITE16_MEMBER(hh_tms1k_state::cnsector_write_r) +class cnsector_state : public hh_tms1k_state +{ +public: + cnsector_state(const machine_config &mconfig, device_type type, const char *tag) + : hh_tms1k_state(mconfig, type, tag) + { } + + DECLARE_WRITE16_MEMBER(write_r); + DECLARE_WRITE16_MEMBER(write_o); + DECLARE_READ8_MEMBER(read_k); +}; + +// handlers + +WRITE16_MEMBER(cnsector_state::write_r) { // R0-R5: select digit (right-to-left) for (int y = 0; y < 6; y++) @@ -1798,7 +2013,7 @@ WRITE16_MEMBER(hh_tms1k_state::cnsector_write_r) display_update(); } -WRITE16_MEMBER(hh_tms1k_state::cnsector_write_o) +WRITE16_MEMBER(cnsector_state::write_o) { // O0-O4: input mux m_inp_mux = data & 0x1f; @@ -1807,12 +2022,14 @@ WRITE16_MEMBER(hh_tms1k_state::cnsector_write_o) m_o = data; } -READ8_MEMBER(hh_tms1k_state::cnsector_read_k) +READ8_MEMBER(cnsector_state::read_k) { return read_inputs(5); } +// config + static INPUT_PORTS_START( cnsector ) PORT_START("IN.0") // O0 PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_Q) PORT_NAME("Next Ship") @@ -1845,14 +2062,13 @@ static INPUT_PORTS_START( cnsector ) PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_T) PORT_NAME("Move Ship") INPUT_PORTS_END - -static MACHINE_CONFIG_START( cnsector, hh_tms1k_state ) +static MACHINE_CONFIG_START( cnsector, cnsector_state ) /* basic machine hardware */ MCFG_CPU_ADD("maincpu", TMS0970, 250000) // approximation - unknown freq - MCFG_TMS1XXX_READ_K_CB(READ8(hh_tms1k_state, cnsector_read_k)) - MCFG_TMS1XXX_WRITE_R_CB(WRITE16(hh_tms1k_state, cnsector_write_r)) - MCFG_TMS1XXX_WRITE_O_CB(WRITE16(hh_tms1k_state, cnsector_write_o)) + MCFG_TMS1XXX_READ_K_CB(READ8(cnsector_state, read_k)) + MCFG_TMS1XXX_WRITE_R_CB(WRITE16(cnsector_state, write_r)) + MCFG_TMS1XXX_WRITE_O_CB(WRITE16(cnsector_state, write_o)) MCFG_TIMER_DRIVER_ADD_PERIODIC("display_decay", hh_tms1k_state, display_decay_tick, attotime::from_msec(1)) MCFG_DEFAULT_LAYOUT(layout_cnsector) @@ -1870,7 +2086,7 @@ MACHINE_CONFIG_END Parker Bros Merlin handheld game, by Bob Doyle * TMS1100NLL MP3404A-N2 - * 11 LEDs behind buttons, 1bit sound + * 11 LEDs behind buttons, 2bit sound Also published in Japan by Tomy as "Dr. Smith", white case instead of red. The one with dark-blue case is the rare sequel Master Merlin. More sequels @@ -1888,7 +2104,21 @@ MACHINE_CONFIG_END ***************************************************************************/ -WRITE16_MEMBER(hh_tms1k_state::merlin_write_r) +class merlin_state : public hh_tms1k_state +{ +public: + merlin_state(const machine_config &mconfig, device_type type, const char *tag) + : hh_tms1k_state(mconfig, type, tag) + { } + + DECLARE_WRITE16_MEMBER(write_r); + DECLARE_WRITE16_MEMBER(write_o); + DECLARE_READ8_MEMBER(read_k); +}; + +// handlers + +WRITE16_MEMBER(merlin_state::write_r) { /* leds: @@ -1901,7 +2131,7 @@ WRITE16_MEMBER(hh_tms1k_state::merlin_write_r) display_matrix(11, 1, data, 1); } -WRITE16_MEMBER(hh_tms1k_state::merlin_write_o) +WRITE16_MEMBER(merlin_state::write_o) { // O4-O6: speaker out (paralleled for increased current driving capability) static const int count[8] = { 0, 1, 1, 2, 1, 2, 2, 3 }; @@ -1912,12 +2142,14 @@ WRITE16_MEMBER(hh_tms1k_state::merlin_write_o) m_inp_mux = data & 0xf; } -READ8_MEMBER(hh_tms1k_state::merlin_read_k) +READ8_MEMBER(merlin_state::read_k) { return read_inputs(4); } +// config + static INPUT_PORTS_START( merlin ) PORT_START("IN.0") // O0 PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_CODE(KEYCODE_0) PORT_CODE(KEYCODE_SLASH_PAD) PORT_NAME("Button 0") @@ -1947,13 +2179,13 @@ INPUT_PORTS_END static const INT16 merlin_speaker_levels[] = { 0, 10922, 21845, 32767 }; -static MACHINE_CONFIG_START( merlin, hh_tms1k_state ) +static MACHINE_CONFIG_START( merlin, merlin_state ) /* basic machine hardware */ MCFG_CPU_ADD("maincpu", TMS1100, 350000) // RC osc. R=33K, C=100pf -> ~350kHz - MCFG_TMS1XXX_READ_K_CB(READ8(hh_tms1k_state, merlin_read_k)) - MCFG_TMS1XXX_WRITE_R_CB(WRITE16(hh_tms1k_state, merlin_write_r)) - MCFG_TMS1XXX_WRITE_O_CB(WRITE16(hh_tms1k_state, merlin_write_o)) + MCFG_TMS1XXX_READ_K_CB(READ8(merlin_state, read_k)) + MCFG_TMS1XXX_WRITE_R_CB(WRITE16(merlin_state, write_r)) + MCFG_TMS1XXX_WRITE_O_CB(WRITE16(merlin_state, write_o)) MCFG_TIMER_DRIVER_ADD_PERIODIC("display_decay", hh_tms1k_state, display_decay_tick, attotime::from_msec(1)) MCFG_DEFAULT_LAYOUT(layout_merlin) @@ -1983,7 +2215,21 @@ MACHINE_CONFIG_END ***************************************************************************/ -WRITE16_MEMBER(hh_tms1k_state::stopthief_write_r) +class stopthief_state : public hh_tms1k_state +{ +public: + stopthief_state(const machine_config &mconfig, device_type type, const char *tag) + : hh_tms1k_state(mconfig, type, tag) + { } + + DECLARE_WRITE16_MEMBER(write_r); + DECLARE_WRITE16_MEMBER(write_o); + DECLARE_READ8_MEMBER(read_k); +}; + +// handlers + +WRITE16_MEMBER(stopthief_state::write_r) { // R0-R2: select digit UINT8 o = BITSWAP8(m_o,3,5,2,1,4,0,6,7) & 0x7f; @@ -2000,7 +2246,7 @@ WRITE16_MEMBER(hh_tms1k_state::stopthief_write_r) m_speaker->level_w((data & 0x1f8 && m_o & 8) ? 1 : 0); } -WRITE16_MEMBER(hh_tms1k_state::stopthief_write_o) +WRITE16_MEMBER(stopthief_state::write_o) { // O0,O6: input mux m_inp_mux = (data & 1) | (data >> 5 & 2); @@ -2010,13 +2256,15 @@ WRITE16_MEMBER(hh_tms1k_state::stopthief_write_o) m_o = data; } -READ8_MEMBER(hh_tms1k_state::stopthief_read_k) +READ8_MEMBER(stopthief_state::read_k) { // note: the Vss row is always on return m_inp_matrix[2]->read() | read_inputs(2); } +// config + /* physical button layout and labels is like this: [1] [2] [OFF] @@ -2050,13 +2298,13 @@ static INPUT_PORTS_START( stopthief ) PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_PGDN) PORT_NAME("Off") PORT_CHANGED_MEMBER(DEVICE_SELF, hh_tms1k_state, power_button, (void *)false) INPUT_PORTS_END -static MACHINE_CONFIG_START( stopthief, hh_tms1k_state ) +static MACHINE_CONFIG_START( stopthief, stopthief_state ) /* basic machine hardware */ MCFG_CPU_ADD("maincpu", TMS0980, 425000) // approximation - unknown freq - MCFG_TMS1XXX_READ_K_CB(READ8(hh_tms1k_state, stopthief_read_k)) - MCFG_TMS1XXX_WRITE_R_CB(WRITE16(hh_tms1k_state, stopthief_write_r)) - MCFG_TMS1XXX_WRITE_O_CB(WRITE16(hh_tms1k_state, stopthief_write_o)) + MCFG_TMS1XXX_READ_K_CB(READ8(stopthief_state, read_k)) + MCFG_TMS1XXX_WRITE_R_CB(WRITE16(stopthief_state, write_r)) + MCFG_TMS1XXX_WRITE_O_CB(WRITE16(stopthief_state, write_o)) MCFG_TMS1XXX_POWER_OFF_CB(WRITELINE(hh_tms1k_state, auto_power_off)) MCFG_TIMER_DRIVER_ADD_PERIODIC("display_decay", hh_tms1k_state, display_decay_tick, attotime::from_msec(1)) @@ -2090,7 +2338,21 @@ MACHINE_CONFIG_END ***************************************************************************/ -WRITE16_MEMBER(hh_tms1k_state::bankshot_write_r) +class bankshot_state : public hh_tms1k_state +{ +public: + bankshot_state(const machine_config &mconfig, device_type type, const char *tag) + : hh_tms1k_state(mconfig, type, tag) + { } + + DECLARE_WRITE16_MEMBER(write_r); + DECLARE_WRITE16_MEMBER(write_o); + DECLARE_READ8_MEMBER(read_k); +}; + +// handlers + +WRITE16_MEMBER(bankshot_state::write_r) { // R0: speaker out m_speaker->level_w(data & 1); @@ -2103,7 +2365,7 @@ WRITE16_MEMBER(hh_tms1k_state::bankshot_write_r) display_matrix(7, 11, m_o, m_r); } -WRITE16_MEMBER(hh_tms1k_state::bankshot_write_o) +WRITE16_MEMBER(bankshot_state::write_o) { // O0-O6: led row // O7: N/C @@ -2111,12 +2373,14 @@ WRITE16_MEMBER(hh_tms1k_state::bankshot_write_o) display_matrix(7, 11, m_o, m_r); } -READ8_MEMBER(hh_tms1k_state::bankshot_read_k) +READ8_MEMBER(bankshot_state::read_k) { return read_inputs(2); } +// config + /* physical button layout and labels is like this: (note: remember that you can rotate the display in MESS) @@ -2143,13 +2407,13 @@ static INPUT_PORTS_START( bankshot ) PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_UNUSED ) INPUT_PORTS_END -static MACHINE_CONFIG_START( bankshot, hh_tms1k_state ) +static MACHINE_CONFIG_START( bankshot, bankshot_state ) /* basic machine hardware */ MCFG_CPU_ADD("maincpu", TMS1400, 475000) // approximation - RC osc. R=24K, C=100pf, but unknown RC curve - MCFG_TMS1XXX_READ_K_CB(READ8(hh_tms1k_state, bankshot_read_k)) - MCFG_TMS1XXX_WRITE_R_CB(WRITE16(hh_tms1k_state, bankshot_write_r)) - MCFG_TMS1XXX_WRITE_O_CB(WRITE16(hh_tms1k_state, bankshot_write_o)) + MCFG_TMS1XXX_READ_K_CB(READ8(bankshot_state, read_k)) + MCFG_TMS1XXX_WRITE_R_CB(WRITE16(bankshot_state, write_r)) + MCFG_TMS1XXX_WRITE_O_CB(WRITE16(bankshot_state, write_o)) MCFG_TIMER_DRIVER_ADD_PERIODIC("display_decay", hh_tms1k_state, display_decay_tick, attotime::from_msec(1)) MCFG_DEFAULT_LAYOUT(layout_bankshot) @@ -2198,7 +2462,21 @@ MACHINE_CONFIG_END ***************************************************************************/ -WRITE16_MEMBER(hh_tms1k_state::splitsec_write_r) +class splitsec_state : public hh_tms1k_state +{ +public: + splitsec_state(const machine_config &mconfig, device_type type, const char *tag) + : hh_tms1k_state(mconfig, type, tag) + { } + + DECLARE_WRITE16_MEMBER(write_r); + DECLARE_WRITE16_MEMBER(write_o); + DECLARE_READ8_MEMBER(read_k); +}; + +// handlers + +WRITE16_MEMBER(splitsec_state::write_r) { // R8: speaker out m_speaker->level_w(data >> 8 & 1); @@ -2211,7 +2489,7 @@ WRITE16_MEMBER(hh_tms1k_state::splitsec_write_r) display_matrix(7, 8, m_o, m_r); } -WRITE16_MEMBER(hh_tms1k_state::splitsec_write_o) +WRITE16_MEMBER(splitsec_state::write_o) { // O0-O6: led row // O7: N/C @@ -2219,12 +2497,14 @@ WRITE16_MEMBER(hh_tms1k_state::splitsec_write_o) display_matrix(7, 8, m_o, m_r); } -READ8_MEMBER(hh_tms1k_state::splitsec_read_k) +READ8_MEMBER(splitsec_state::read_k) { return read_inputs(2); } +// config + static INPUT_PORTS_START( splitsec ) PORT_START("IN.0") // R9 PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_JOYSTICK_RIGHT ) PORT_16WAY // 4 separate directional buttons, hence 16way @@ -2239,13 +2519,13 @@ static INPUT_PORTS_START( splitsec ) PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_UNUSED ) INPUT_PORTS_END -static MACHINE_CONFIG_START( splitsec, hh_tms1k_state ) +static MACHINE_CONFIG_START( splitsec, splitsec_state ) /* basic machine hardware */ MCFG_CPU_ADD("maincpu", TMS1400, 475000) // approximation - RC osc. R=24K, C=100pf, but unknown RC curve - MCFG_TMS1XXX_READ_K_CB(READ8(hh_tms1k_state, splitsec_read_k)) - MCFG_TMS1XXX_WRITE_R_CB(WRITE16(hh_tms1k_state, splitsec_write_r)) - MCFG_TMS1XXX_WRITE_O_CB(WRITE16(hh_tms1k_state, splitsec_write_o)) + MCFG_TMS1XXX_READ_K_CB(READ8(splitsec_state, read_k)) + MCFG_TMS1XXX_WRITE_R_CB(WRITE16(splitsec_state, write_r)) + MCFG_TMS1XXX_WRITE_O_CB(WRITE16(splitsec_state, write_o)) MCFG_TIMER_DRIVER_ADD_PERIODIC("display_decay", hh_tms1k_state, display_decay_tick, attotime::from_msec(1)) MCFG_DEFAULT_LAYOUT(layout_splitsec) @@ -2284,13 +2564,28 @@ MACHINE_CONFIG_END ***************************************************************************/ -void hh_tms1k_state::tandy12_display() +class tandy12_state : public hh_tms1k_state +{ +public: + tandy12_state(const machine_config &mconfig, device_type type, const char *tag) + : hh_tms1k_state(mconfig, type, tag) + { } + + void prepare_display(); + DECLARE_WRITE16_MEMBER(write_r); + DECLARE_WRITE16_MEMBER(write_o); + DECLARE_READ8_MEMBER(read_k); +}; + +// handlers + +void tandy12_state::prepare_display() { // O0-O7: button lamps 1-8, R0-R3: button lamps 9-12 display_matrix(13, 1, (m_o << 1 & 0x1fe) | (m_r << 9 & 0x1e00), 1); } -WRITE16_MEMBER(hh_tms1k_state::tandy12_write_r) +WRITE16_MEMBER(tandy12_state::write_r) { // R10: speaker out m_speaker->level_w(data >> 10 & 1); @@ -2300,21 +2595,23 @@ WRITE16_MEMBER(hh_tms1k_state::tandy12_write_r) // other bits: m_r = data; - tandy12_display(); + prepare_display(); } -WRITE16_MEMBER(hh_tms1k_state::tandy12_write_o) +WRITE16_MEMBER(tandy12_state::write_o) { m_o = data; - tandy12_display(); + prepare_display(); } -READ8_MEMBER(hh_tms1k_state::tandy12_read_k) +READ8_MEMBER(tandy12_state::read_k) { return read_inputs(5); } +// config + /* physical button layout and labels is like this: REPEAT-2 SPACE-2 @@ -2381,14 +2678,14 @@ static const UINT16 tandy12_output_pla[0x20] = 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }; -static MACHINE_CONFIG_START( tandy12, hh_tms1k_state ) +static MACHINE_CONFIG_START( tandy12, tandy12_state ) /* basic machine hardware */ MCFG_CPU_ADD("maincpu", TMS1100, 400000) // RC osc. R=39K, C=47pf -> ~400kHz MCFG_TMS1XXX_OUTPUT_PLA(tandy12_output_pla) - MCFG_TMS1XXX_READ_K_CB(READ8(hh_tms1k_state, tandy12_read_k)) - MCFG_TMS1XXX_WRITE_R_CB(WRITE16(hh_tms1k_state, tandy12_write_r)) - MCFG_TMS1XXX_WRITE_O_CB(WRITE16(hh_tms1k_state, tandy12_write_o)) + MCFG_TMS1XXX_READ_K_CB(READ8(tandy12_state, read_k)) + MCFG_TMS1XXX_WRITE_R_CB(WRITE16(tandy12_state, write_r)) + MCFG_TMS1XXX_WRITE_O_CB(WRITE16(tandy12_state, write_o)) MCFG_TIMER_DRIVER_ADD_PERIODIC("display_decay", hh_tms1k_state, display_decay_tick, attotime::from_msec(1)) MCFG_DEFAULT_LAYOUT(layout_tandy12) diff --git a/src/mess/drivers/hh_ucom4.c b/src/mess/drivers/hh_ucom4.c index 778b019c12f..faf59c83205 100644 --- a/src/mess/drivers/hh_ucom4.c +++ b/src/mess/drivers/hh_ucom4.c @@ -254,7 +254,7 @@ public: : hh_ucom4_state(mconfig, type, tag) { } - void ssfball_display(); + void prepare_display(); DECLARE_WRITE8_MEMBER(grid_w); DECLARE_WRITE8_MEMBER(plate_w); DECLARE_READ8_MEMBER(input_b_r); @@ -262,7 +262,7 @@ public: // handlers -void ssfball_state::ssfball_display() +void ssfball_state::prepare_display() { UINT32 plate = BITSWAP24(m_plate,23,22,21,20,19,11,7,3,12,17,13,18,16,14,15,10,9,8,0,1,2,4,5,6); display_matrix(16, 9, plate, m_grid); @@ -273,7 +273,7 @@ WRITE8_MEMBER(ssfball_state::grid_w) // C,D(,E3): vfd matrix grid 0-7(,8) int shift = (offset - NEC_UCOM4_PORTC) * 4; m_grid = (m_grid & ~(0xf << shift)) | (data << shift); - ssfball_display(); + prepare_display(); } WRITE8_MEMBER(ssfball_state::plate_w) @@ -292,7 +292,7 @@ WRITE8_MEMBER(ssfball_state::plate_w) if (offset == NEC_UCOM4_PORTE) grid_w(space, offset, data >> 3 & 1); else - ssfball_display(); + prepare_display(); } READ8_MEMBER(ssfball_state::input_b_r) @@ -379,7 +379,7 @@ public: : hh_ucom4_state(mconfig, type, tag) { } - void splasfgt_display(); + void prepare_display(); DECLARE_WRITE8_MEMBER(grid_w); DECLARE_WRITE8_MEMBER(plate_w); DECLARE_READ8_MEMBER(input_b_r); @@ -387,7 +387,7 @@ public: // handlers -void splasfgt_state::splasfgt_display() +void splasfgt_state::prepare_display() { UINT32 plate = BITSWAP24(m_plate,23,22,21,20,19,18,17,13,1,0,8,6,0,10,11,14,15,16,9,5,7,4,2,3); display_matrix(16, 9, plate, m_grid); @@ -406,7 +406,7 @@ WRITE8_MEMBER(splasfgt_state::grid_w) if (offset == NEC_UCOM4_PORTI) plate_w(space, 4 + NEC_UCOM4_PORTC, data >> 2 & 1); else - splasfgt_display(); + prepare_display(); } WRITE8_MEMBER(splasfgt_state::plate_w) @@ -418,7 +418,7 @@ WRITE8_MEMBER(splasfgt_state::plate_w) // C,D,E,F23(,I2): vfd matrix plate int shift = (offset - NEC_UCOM4_PORTC) * 4; m_plate = (m_plate & ~(0xf << shift)) | (data << shift); - splasfgt_display(); + prepare_display(); } READ8_MEMBER(splasfgt_state::input_b_r) @@ -533,14 +533,14 @@ public: : hh_ucom4_state(mconfig, type, tag) { } - void astrocmd_display(); + void prepare_display(); DECLARE_WRITE8_MEMBER(grid_w); DECLARE_WRITE8_MEMBER(plate_w); }; // handlers -void astrocmd_state::astrocmd_display() +void astrocmd_state::prepare_display() { UINT16 grid = BITSWAP16(m_grid,15,14,13,12,11,10,9,8,4,5,6,7,0,1,2,3); UINT32 plate = BITSWAP24(m_plate,23,22,21,20,19,3,2,12,13,14,15,16,17,18,0,1,4,8,5,9,7,11,6,10); @@ -552,7 +552,7 @@ WRITE8_MEMBER(astrocmd_state::grid_w) // C,D(,E3): vfd matrix grid int shift = (offset - NEC_UCOM4_PORTC) * 4; m_grid = (m_grid & ~(0xf << shift)) | (data << shift); - astrocmd_display(); + prepare_display(); } WRITE8_MEMBER(astrocmd_state::plate_w) @@ -570,7 +570,7 @@ WRITE8_MEMBER(astrocmd_state::plate_w) grid_w(space, offset, data >> 3 & 1); } else - astrocmd_display(); + prepare_display(); } @@ -901,14 +901,14 @@ public: : hh_ucom4_state(mconfig, type, tag) { } - void tmpacman_display(); + void prepare_display(); DECLARE_WRITE8_MEMBER(grid_w); DECLARE_WRITE8_MEMBER(plate_w); }; // handlers -void tmpacman_state::tmpacman_display() +void tmpacman_state::prepare_display() { UINT16 grid = BITSWAP8(m_grid,0,1,2,3,4,5,6,7); UINT32 plate = BITSWAP24(m_plate,23,22,21,20,19,16,17,18,11,10,9,8,0,2,3,1,4,5,6,7,12,13,14,15); @@ -920,7 +920,7 @@ WRITE8_MEMBER(tmpacman_state::grid_w) // C,D: vfd matrix grid int shift = (offset - NEC_UCOM4_PORTC) * 4; m_grid = (m_grid & ~(0xf << shift)) | (data << shift); - tmpacman_display(); + prepare_display(); } WRITE8_MEMBER(tmpacman_state::plate_w) @@ -932,7 +932,7 @@ WRITE8_MEMBER(tmpacman_state::plate_w) // E023,F,G,H,I: vfd matrix plate int shift = (offset - NEC_UCOM4_PORTE) * 4; m_plate = (m_plate & ~(0xf << shift)) | (data << shift); - tmpacman_display(); + prepare_display(); } diff --git a/src/mess/drivers/mbdtower.c b/src/mess/drivers/mbdtower.c index 70aa569678a..1db1a8eaede 100644 --- a/src/mess/drivers/mbdtower.c +++ b/src/mess/drivers/mbdtower.c @@ -8,7 +8,7 @@ * TMS1400NLL MP7332-N1.U1(Rev. B) or MP7332-N2LL(Rev. C), die labeled MP7332 (assume same ROM contents between revisions) * SN75494N MOS-to-LED digit driver - * rotating reel + lightsensor + * rotating reel + lightsensor, 1bit-sound This is a board game, it obviously requires game pieces and the board. The emulated part is the centerpiece, a black tower with a rotating card @@ -32,7 +32,7 @@ public: : hh_tms1k_state(mconfig, type, tag) { } - void mbdtower_display(); + void prepare_display(); bool sensor_led_on() { return m_display_decay[0][0] != 0; } int m_motor_pos; @@ -58,7 +58,7 @@ protected: ***************************************************************************/ -void mbdtower_state::mbdtower_display() +void mbdtower_state::prepare_display() { // declare display matrix size and the 2 7segs set_display_size(7, 3); @@ -148,7 +148,7 @@ WRITE16_MEMBER(mbdtower_state::write_r) // R5-R7: tower lamps // R8: rotation sensor led m_r = data; - mbdtower_display(); + prepare_display(); // R10: speaker out m_speaker->level_w(~data >> 4 & data >> 10 & 1); @@ -159,7 +159,7 @@ WRITE16_MEMBER(mbdtower_state::write_o) // O0-O6: led segments A-G // O7: digit select m_o = data; - mbdtower_display(); + prepare_display(); } READ8_MEMBER(mbdtower_state::read_k) @@ -226,13 +226,14 @@ void mbdtower_state::machine_start() { hh_tms1k_state::machine_start(); - // zerofill/register for savestates + // zerofill m_motor_pos = 0; m_motor_pos_prev = -1; m_motor_decay = 0; m_motor_on = false; m_sensor_blind = false; + // register for savestates save_item(NAME(m_motor_pos)); /* save_item(NAME(m_motor_pos_prev)); */ // don't save! save_item(NAME(m_motor_decay)); diff --git a/src/mess/drivers/ticalc1x.c b/src/mess/drivers/ticalc1x.c index 81713a9f042..cfeac323e8b 100644 --- a/src/mess/drivers/ticalc1x.c +++ b/src/mess/drivers/ticalc1x.c @@ -31,35 +31,6 @@ public: : hh_tms1k_state(mconfig, type, tag) { } - // calculator-specific handlers - void tisr16_display(); - DECLARE_WRITE16_MEMBER(tisr16_write_o); - DECLARE_WRITE16_MEMBER(tisr16_write_r); - DECLARE_READ8_MEMBER(tisr16_read_k); - - DECLARE_WRITE16_MEMBER(ti1270_write_o); - DECLARE_WRITE16_MEMBER(ti1270_write_r); - DECLARE_READ8_MEMBER(ti1270_read_k); - - DECLARE_WRITE16_MEMBER(ti1000_write_o); - DECLARE_WRITE16_MEMBER(ti1000_write_r); - DECLARE_READ8_MEMBER(ti1000_read_k); - - DECLARE_WRITE16_MEMBER(wizatron_write_o); - DECLARE_WRITE16_MEMBER(wizatron_write_r); - DECLARE_READ8_MEMBER(wizatron_read_k); - - DECLARE_WRITE16_MEMBER(lilprof_write_o); - DECLARE_READ8_MEMBER(lilprof_read_k); - - DECLARE_WRITE16_MEMBER(lilprof78_write_o); - DECLARE_WRITE16_MEMBER(lilprof78_write_r); - DECLARE_READ8_MEMBER(lilprof78_read_k); - - DECLARE_WRITE16_MEMBER(ti30_write_o); - DECLARE_WRITE16_MEMBER(ti30_write_r); - DECLARE_READ8_MEMBER(ti30_read_k); - protected: virtual void machine_start(); }; @@ -75,19 +46,37 @@ void ticalc1x_state::machine_start() /*************************************************************************** - Minidrivers (I/O, Inputs, Machine Config) + Minidrivers (subclass, I/O, Inputs, Machine Config) ***************************************************************************/ /*************************************************************************** - TI SR-16 - * TMS1000 MCU labeled TMS1001NL. die labeled 1000, 1001A + TI SR-16, SR-16 II + * SR-16: TMS1000 MCU labeled TMS1001NL. die labeled 1000, 1001A + * SR-16 II: TMS1000 MCU labeled TMS1016NL. die labeled 1000B, 1016A * 12-digit 7seg LED display + SR-16 II is a cost-reduced 'sequel', [10^x] was removed, and [pi] was added. + ***************************************************************************/ -void ticalc1x_state::tisr16_display() +class tisr16_state : public ticalc1x_state +{ +public: + tisr16_state(const machine_config &mconfig, device_type type, const char *tag) + : ticalc1x_state(mconfig, type, tag) + { } + + void prepare_display(); + DECLARE_WRITE16_MEMBER(write_o); + DECLARE_WRITE16_MEMBER(write_r); + DECLARE_READ8_MEMBER(read_k); +}; + +// handlers + +void tisr16_state::prepare_display() { // update leds state for (int y = 0; y < 11; y++) @@ -101,27 +90,29 @@ void ticalc1x_state::tisr16_display() display_update(); } -WRITE16_MEMBER(ticalc1x_state::tisr16_write_r) +WRITE16_MEMBER(tisr16_state::write_r) { // R0-R10: input mux // R0-R10: select digit (right-to-left) m_r = m_inp_mux = data; - tisr16_display(); + prepare_display(); } -WRITE16_MEMBER(ticalc1x_state::tisr16_write_o) +WRITE16_MEMBER(tisr16_state::write_o) { // O0-O7: digit segments m_o = data; - tisr16_display(); + prepare_display(); } -READ8_MEMBER(ticalc1x_state::tisr16_read_k) +READ8_MEMBER(tisr16_state::read_k) { return read_inputs(11); } +// config + static INPUT_PORTS_START( tisr16 ) PORT_START("IN.0") // R0 PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_UNUSED ) @@ -191,38 +182,6 @@ static INPUT_PORTS_START( tisr16 ) INPUT_PORTS_END -static MACHINE_CONFIG_START( tisr16, ticalc1x_state ) - - /* basic machine hardware */ - MCFG_CPU_ADD("maincpu", TMS1000, 300000) // RC osc. R=43K, C=68pf -> ~300kHz - MCFG_TMS1XXX_READ_K_CB(READ8(ticalc1x_state, tisr16_read_k)) - MCFG_TMS1XXX_WRITE_O_CB(WRITE16(ticalc1x_state, tisr16_write_o)) - MCFG_TMS1XXX_WRITE_R_CB(WRITE16(ticalc1x_state, tisr16_write_r)) - - MCFG_TIMER_DRIVER_ADD_PERIODIC("display_decay", hh_tms1k_state, display_decay_tick, attotime::from_msec(1)) - MCFG_DEFAULT_LAYOUT(layout_tisr16) - - /* no video! */ - - /* no sound! */ -MACHINE_CONFIG_END - - - - - -/*************************************************************************** - - TI SR-16 II - * TMS1000 MCU labeled TMS1016NL. die labeled 1000B, 1016A - * 12-digit 7seg LED display - - A cost-reduced 'sequel', [10^x] was removed, and [pi] was added. - -***************************************************************************/ - -// hardware is nearly identical to TI SR-16 above, so we simply use those handlers - static INPUT_PORTS_START( tisr16ii ) PORT_START("IN.0") // R0 PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_UNUSED ) @@ -292,10 +251,20 @@ static INPUT_PORTS_START( tisr16ii ) INPUT_PORTS_END -static MACHINE_CONFIG_DERIVED( tisr16ii, tisr16 ) +static MACHINE_CONFIG_START( tisr16, tisr16_state ) /* basic machine hardware */ - // the MCU RC osc. is different: R=30K, C=100pf -> ~300kHz(same freq as tisr16, no change needed) + MCFG_CPU_ADD("maincpu", TMS1000, 300000) // RC osc. R=43K, C=68pf -> ~300kHz (note: tisr16ii MCU RC osc. is different: R=30K, C=100pf -> also ~300kHz) + MCFG_TMS1XXX_READ_K_CB(READ8(tisr16_state, read_k)) + MCFG_TMS1XXX_WRITE_O_CB(WRITE16(tisr16_state, write_o)) + MCFG_TMS1XXX_WRITE_R_CB(WRITE16(tisr16_state, write_r)) + + MCFG_TIMER_DRIVER_ADD_PERIODIC("display_decay", hh_tms1k_state, display_decay_tick, attotime::from_msec(1)) + MCFG_DEFAULT_LAYOUT(layout_tisr16) + + /* no video! */ + + /* no sound! */ MACHINE_CONFIG_END @@ -310,13 +279,27 @@ MACHINE_CONFIG_END ***************************************************************************/ -WRITE16_MEMBER(ticalc1x_state::ti1270_write_r) +class ti1270_state : public ticalc1x_state +{ +public: + ti1270_state(const machine_config &mconfig, device_type type, const char *tag) + : ticalc1x_state(mconfig, type, tag) + { } + + DECLARE_WRITE16_MEMBER(write_o); + DECLARE_WRITE16_MEMBER(write_r); + DECLARE_READ8_MEMBER(read_k); +}; + +// handlers + +WRITE16_MEMBER(ti1270_state::write_r) { // R0-R7: select digit (right-to-left) display_matrix_seg(8, 8, m_o, data, 0xff); } -WRITE16_MEMBER(ticalc1x_state::ti1270_write_o) +WRITE16_MEMBER(ti1270_state::write_o) { // O1-O5,O7: input mux // O0-O7: digit segments @@ -324,12 +307,14 @@ WRITE16_MEMBER(ticalc1x_state::ti1270_write_o) m_o = data; } -READ8_MEMBER(ticalc1x_state::ti1270_read_k) +READ8_MEMBER(ti1270_state::read_k) { return read_inputs(6); } +// config + static INPUT_PORTS_START( ti1270 ) PORT_START("IN.0") // O1 PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_BACKSPACE) PORT_CODE(KEYCODE_DEL) PORT_NAME("CE/C") @@ -368,14 +353,13 @@ static INPUT_PORTS_START( ti1270 ) PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_MINUS) PORT_NAME("+/-") INPUT_PORTS_END - -static MACHINE_CONFIG_START( ti1270, ticalc1x_state ) +static MACHINE_CONFIG_START( ti1270, ti1270_state ) /* basic machine hardware */ MCFG_CPU_ADD("maincpu", TMS0970, 250000) // guessed - MCFG_TMS1XXX_READ_K_CB(READ8(ticalc1x_state, ti1270_read_k)) - MCFG_TMS1XXX_WRITE_O_CB(WRITE16(ticalc1x_state, ti1270_write_o)) - MCFG_TMS1XXX_WRITE_R_CB(WRITE16(ticalc1x_state, ti1270_write_r)) + MCFG_TMS1XXX_READ_K_CB(READ8(ti1270_state, read_k)) + MCFG_TMS1XXX_WRITE_O_CB(WRITE16(ti1270_state, write_o)) + MCFG_TMS1XXX_WRITE_R_CB(WRITE16(ti1270_state, write_r)) MCFG_TIMER_DRIVER_ADD_PERIODIC("display_decay", hh_tms1k_state, display_decay_tick, attotime::from_msec(1)) MCFG_DEFAULT_LAYOUT(layout_ti1270) @@ -397,14 +381,28 @@ MACHINE_CONFIG_END ***************************************************************************/ -WRITE16_MEMBER(ticalc1x_state::ti1000_write_r) +class ti1000_state : public ticalc1x_state +{ +public: + ti1000_state(const machine_config &mconfig, device_type type, const char *tag) + : ticalc1x_state(mconfig, type, tag) + { } + + DECLARE_WRITE16_MEMBER(write_o); + DECLARE_WRITE16_MEMBER(write_r); + DECLARE_READ8_MEMBER(read_k); +}; + +// handlers + +WRITE16_MEMBER(ti1000_state::write_r) { // R0-R7: select digit (right-to-left) UINT8 o = BITSWAP8(m_o,7,4,3,2,1,0,6,5); display_matrix_seg(8, 8, o, data, 0xff); } -WRITE16_MEMBER(ticalc1x_state::ti1000_write_o) +WRITE16_MEMBER(ti1000_state::write_o) { // O0-O3,O5(?): input mux // O0-O7: digit segments @@ -412,12 +410,14 @@ WRITE16_MEMBER(ticalc1x_state::ti1000_write_o) m_o = data; } -READ8_MEMBER(ticalc1x_state::ti1000_read_k) +READ8_MEMBER(ti1000_state::read_k) { return read_inputs(5); } +// config + static INPUT_PORTS_START( ti1000 ) PORT_START("IN.0") // O0 PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_1) PORT_CODE(KEYCODE_1_PAD) PORT_NAME("1") @@ -451,14 +451,13 @@ static INPUT_PORTS_START( ti1000 ) PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_ENTER) PORT_CODE(KEYCODE_ENTER_PAD) PORT_NAME("=") INPUT_PORTS_END - -static MACHINE_CONFIG_START( ti1000, ticalc1x_state ) +static MACHINE_CONFIG_START( ti1000, ti1000_state ) /* basic machine hardware */ MCFG_CPU_ADD("maincpu", TMS1990, 250000) // guessed - MCFG_TMS1XXX_READ_K_CB(READ8(ticalc1x_state, ti1000_read_k)) - MCFG_TMS1XXX_WRITE_O_CB(WRITE16(ticalc1x_state, ti1000_write_o)) - MCFG_TMS1XXX_WRITE_R_CB(WRITE16(ticalc1x_state, ti1000_write_r)) + MCFG_TMS1XXX_READ_K_CB(READ8(ti1000_state, read_k)) + MCFG_TMS1XXX_WRITE_O_CB(WRITE16(ti1000_state, write_o)) + MCFG_TMS1XXX_WRITE_R_CB(WRITE16(ti1000_state, write_r)) MCFG_TIMER_DRIVER_ADD_PERIODIC("display_decay", hh_tms1k_state, display_decay_tick, attotime::from_msec(1)) MCFG_DEFAULT_LAYOUT(layout_ti1270) @@ -480,7 +479,21 @@ MACHINE_CONFIG_END ***************************************************************************/ -WRITE16_MEMBER(ticalc1x_state::wizatron_write_r) +class wizatron_state : public ticalc1x_state +{ +public: + wizatron_state(const machine_config &mconfig, device_type type, const char *tag) + : ticalc1x_state(mconfig, type, tag) + { } + + virtual DECLARE_WRITE16_MEMBER(write_o); + virtual DECLARE_WRITE16_MEMBER(write_r); + virtual DECLARE_READ8_MEMBER(read_k); +}; + +// handlers + +WRITE16_MEMBER(wizatron_state::write_r) { // 6th digit is custom(not 7seg), for math symbols, like this: // \./ GAB @@ -495,7 +508,7 @@ WRITE16_MEMBER(ticalc1x_state::wizatron_write_r) display_matrix_seg(7, 9, m_o, data, 0x7f); } -WRITE16_MEMBER(ticalc1x_state::wizatron_write_o) +WRITE16_MEMBER(wizatron_state::write_o) { // O1-O4: input mux // O0-O6: digit segments A-G @@ -504,12 +517,14 @@ WRITE16_MEMBER(ticalc1x_state::wizatron_write_o) m_o = data & 0x7f; } -READ8_MEMBER(ticalc1x_state::wizatron_read_k) +READ8_MEMBER(wizatron_state::read_k) { return read_inputs(4); } +// config + static INPUT_PORTS_START( wizatron ) PORT_START("IN.0") // O1 PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_DEL) PORT_NAME("Clear") @@ -536,14 +551,13 @@ static INPUT_PORTS_START( wizatron ) PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_SLASH_PAD) PORT_NAME(UTF8_DIVIDE) INPUT_PORTS_END - -static MACHINE_CONFIG_START( wizatron, ticalc1x_state ) +static MACHINE_CONFIG_START( wizatron, wizatron_state ) /* basic machine hardware */ MCFG_CPU_ADD("maincpu", TMS0970, 250000) // guessed - MCFG_TMS1XXX_READ_K_CB(READ8(ticalc1x_state, wizatron_read_k)) - MCFG_TMS1XXX_WRITE_O_CB(WRITE16(ticalc1x_state, wizatron_write_o)) - MCFG_TMS1XXX_WRITE_R_CB(WRITE16(ticalc1x_state, wizatron_write_r)) + MCFG_TMS1XXX_READ_K_CB(READ8(wizatron_state, read_k)) + MCFG_TMS1XXX_WRITE_O_CB(WRITE16(wizatron_state, write_o)) + MCFG_TMS1XXX_WRITE_R_CB(WRITE16(wizatron_state, write_r)) MCFG_TIMER_DRIVER_ADD_PERIODIC("display_decay", hh_tms1k_state, display_decay_tick, attotime::from_msec(1)) MCFG_DEFAULT_LAYOUT(layout_wizatron) @@ -568,7 +582,20 @@ MACHINE_CONFIG_END ***************************************************************************/ -WRITE16_MEMBER(ticalc1x_state::lilprof_write_o) +class lilprof_state : public wizatron_state +{ +public: + lilprof_state(const machine_config &mconfig, device_type type, const char *tag) + : wizatron_state(mconfig, type, tag) + { } + + virtual DECLARE_WRITE16_MEMBER(write_o); + virtual DECLARE_READ8_MEMBER(read_k); +}; + +// handlers + +WRITE16_MEMBER(lilprof_state::write_o) { // O1-O4,O7: input mux // O0-O6: digit segments A-G @@ -576,12 +603,14 @@ WRITE16_MEMBER(ticalc1x_state::lilprof_write_o) m_o = data; } -READ8_MEMBER(ticalc1x_state::lilprof_read_k) +READ8_MEMBER(lilprof_state::read_k) { return read_inputs(5); } +// config + static INPUT_PORTS_START( lilprof ) PORT_INCLUDE( wizatron ) @@ -597,14 +626,13 @@ static INPUT_PORTS_START( lilprof ) PORT_CONFSETTING( 0x08, "4" ) INPUT_PORTS_END - -static MACHINE_CONFIG_START( lilprof, ticalc1x_state ) +static MACHINE_CONFIG_START( lilprof, lilprof_state ) /* basic machine hardware */ MCFG_CPU_ADD("maincpu", TMS0970, 250000) // guessed - MCFG_TMS1XXX_READ_K_CB(READ8(ticalc1x_state, lilprof_read_k)) - MCFG_TMS1XXX_WRITE_O_CB(WRITE16(ticalc1x_state, lilprof_write_o)) - MCFG_TMS1XXX_WRITE_R_CB(WRITE16(ticalc1x_state, wizatron_write_r)) + MCFG_TMS1XXX_READ_K_CB(READ8(lilprof_state, read_k)) + MCFG_TMS1XXX_WRITE_O_CB(WRITE16(lilprof_state, write_o)) + MCFG_TMS1XXX_WRITE_R_CB(WRITE16(wizatron_state, write_r)) MCFG_TIMER_DRIVER_ADD_PERIODIC("display_decay", hh_tms1k_state, display_decay_tick, attotime::from_msec(1)) MCFG_DEFAULT_LAYOUT(layout_wizatron) @@ -629,7 +657,21 @@ MACHINE_CONFIG_END ***************************************************************************/ -WRITE16_MEMBER(ticalc1x_state::lilprof78_write_r) +class lilprof78_state : public ticalc1x_state +{ +public: + lilprof78_state(const machine_config &mconfig, device_type type, const char *tag) + : ticalc1x_state(mconfig, type, tag) + { } + + DECLARE_WRITE16_MEMBER(write_o); + DECLARE_WRITE16_MEMBER(write_r); + DECLARE_READ8_MEMBER(read_k); +}; + +// handlers + +WRITE16_MEMBER(lilprof78_state::write_r) { // update leds state UINT8 o = BITSWAP8(m_o,7,4,3,2,1,0,6,5) & 0x7f; @@ -641,14 +683,14 @@ WRITE16_MEMBER(ticalc1x_state::lilprof78_write_r) // 3rd digit A/G(equals sign) is from O7 m_display_state[3] = (m_o & 0x80) ? 0x41 : 0; - // 6th digit is a custom 7seg for math symbols (see wizatron_write_r) + // 6th digit is a custom 7seg for math symbols (see wizatron_state write_r) m_display_state[6] = BITSWAP8(m_display_state[6],7,6,1,4,2,3,5,0); set_display_size(7, 9); display_update(); } -WRITE16_MEMBER(ticalc1x_state::lilprof78_write_o) +WRITE16_MEMBER(lilprof78_state::write_o) { // O0-O3,O5(?): input mux // O0-O6: digit segments A-G @@ -657,12 +699,14 @@ WRITE16_MEMBER(ticalc1x_state::lilprof78_write_o) m_o = data; } -READ8_MEMBER(ticalc1x_state::lilprof78_read_k) +READ8_MEMBER(lilprof78_state::read_k) { return read_inputs(5); } +// config + static INPUT_PORTS_START( lilprof78 ) PORT_START("IN.0") // O0 PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_1) PORT_CODE(KEYCODE_1_PAD) PORT_NAME("1") @@ -696,14 +740,13 @@ static INPUT_PORTS_START( lilprof78 ) PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYPAD ) PORT_CODE(KEYCODE_PLUS_PAD) PORT_NAME("+") INPUT_PORTS_END - -static MACHINE_CONFIG_START( lilprof78, ticalc1x_state ) +static MACHINE_CONFIG_START( lilprof78, lilprof78_state ) /* basic machine hardware */ MCFG_CPU_ADD("maincpu", TMS1990, 250000) // guessed - MCFG_TMS1XXX_READ_K_CB(READ8(ticalc1x_state, lilprof78_read_k)) - MCFG_TMS1XXX_WRITE_O_CB(WRITE16(ticalc1x_state, lilprof78_write_o)) - MCFG_TMS1XXX_WRITE_R_CB(WRITE16(ticalc1x_state, lilprof78_write_r)) + MCFG_TMS1XXX_READ_K_CB(READ8(lilprof78_state, read_k)) + MCFG_TMS1XXX_WRITE_O_CB(WRITE16(lilprof78_state, write_o)) + MCFG_TMS1XXX_WRITE_R_CB(WRITE16(lilprof78_state, write_r)) MCFG_TIMER_DRIVER_ADD_PERIODIC("display_decay", hh_tms1k_state, display_decay_tick, attotime::from_msec(1)) MCFG_DEFAULT_LAYOUT(layout_wizatron) @@ -727,7 +770,21 @@ MACHINE_CONFIG_END ***************************************************************************/ -WRITE16_MEMBER(ticalc1x_state::ti30_write_r) +class majestic_state : public ticalc1x_state +{ +public: + majestic_state(const machine_config &mconfig, device_type type, const char *tag) + : ticalc1x_state(mconfig, type, tag) + { } + + DECLARE_WRITE16_MEMBER(write_o); + DECLARE_WRITE16_MEMBER(write_r); + DECLARE_READ8_MEMBER(read_k); +}; + +// handlers + +WRITE16_MEMBER(majestic_state::write_r) { // note: 1st digit only has segments B,F,G,DP m_display_segmask[0] = 0xe2; @@ -737,7 +794,7 @@ WRITE16_MEMBER(ticalc1x_state::ti30_write_r) display_matrix_seg(8, 9, o, data, 0xff); } -WRITE16_MEMBER(ticalc1x_state::ti30_write_o) +WRITE16_MEMBER(majestic_state::write_o) { // O0-O2,O4-O7: input mux // O0-O7: digit segments @@ -745,13 +802,15 @@ WRITE16_MEMBER(ticalc1x_state::ti30_write_o) m_o = data; } -READ8_MEMBER(ticalc1x_state::ti30_read_k) +READ8_MEMBER(majestic_state::read_k) { // note: the Vss row is always on return m_inp_matrix[7]->read() | read_inputs(7); } +// config + static INPUT_PORTS_START( ti30 ) PORT_START("IN.0") // O0 PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_Y) PORT_NAME("y" UTF8_POW_X) @@ -933,14 +992,14 @@ static INPUT_PORTS_START( tibusan1 ) INPUT_PORTS_END -static MACHINE_CONFIG_START( ti30, ticalc1x_state ) +static MACHINE_CONFIG_START( majestic, majestic_state ) /* basic machine hardware */ MCFG_CPU_ADD("maincpu", TMS0980, 400000) // guessed - MCFG_TMS1XXX_READ_K_CB(READ8(ticalc1x_state, ti30_read_k)) - MCFG_TMS1XXX_WRITE_O_CB(WRITE16(ticalc1x_state, ti30_write_o)) - MCFG_TMS1XXX_WRITE_R_CB(WRITE16(ticalc1x_state, ti30_write_r)) - MCFG_TMS1XXX_POWER_OFF_CB(WRITELINE(ticalc1x_state, auto_power_off)) + MCFG_TMS1XXX_READ_K_CB(READ8(majestic_state, read_k)) + MCFG_TMS1XXX_WRITE_O_CB(WRITE16(majestic_state, write_o)) + MCFG_TMS1XXX_WRITE_R_CB(WRITE16(majestic_state, write_r)) + MCFG_TMS1XXX_POWER_OFF_CB(WRITELINE(hh_tms1k_state, auto_power_off)) MCFG_TIMER_DRIVER_ADD_PERIODIC("display_decay", hh_tms1k_state, display_decay_tick, attotime::from_msec(1)) MCFG_DEFAULT_LAYOUT(layout_ti30) @@ -1104,7 +1163,7 @@ ROM_END /* YEAR NAME PARENT COMPAT MACHINE INPUT INIT COMPANY, FULLNAME, FLAGS */ COMP( 1974, tisr16, 0, 0, tisr16, tisr16, driver_device, 0, "Texas Instruments", "SR-16", GAME_SUPPORTS_SAVE | GAME_NO_SOUND_HW ) -COMP( 1975, tisr16ii, 0, 0, tisr16ii, tisr16ii, driver_device, 0, "Texas Instruments", "SR-16 II", GAME_SUPPORTS_SAVE | GAME_NO_SOUND_HW ) +COMP( 1975, tisr16ii, 0, 0, tisr16, tisr16ii, driver_device, 0, "Texas Instruments", "SR-16 II", GAME_SUPPORTS_SAVE | GAME_NO_SOUND_HW ) COMP( 1976, ti1270, 0, 0, ti1270, ti1270, driver_device, 0, "Texas Instruments", "TI-1270", GAME_SUPPORTS_SAVE | GAME_NO_SOUND_HW ) COMP( 1977, ti1000, 0, 0, ti1000, ti1000, driver_device, 0, "Texas Instruments", "TI-1000", GAME_SUPPORTS_SAVE | GAME_NO_SOUND_HW ) @@ -1112,6 +1171,6 @@ COMP( 1977, wizatron, 0, 0, wizatron, wizatron, driver_device, 0, "Tex COMP( 1976, lilprof, 0, 0, lilprof, lilprof, driver_device, 0, "Texas Instruments", "Little Professor (1976 version)", GAME_SUPPORTS_SAVE | GAME_NO_SOUND_HW ) COMP( 1978, lilprof78, lilprof, 0, lilprof78, lilprof78, driver_device, 0, "Texas Instruments", "Little Professor (1978 version)", GAME_SUPPORTS_SAVE | GAME_NO_SOUND_HW ) -COMP( 1976, ti30, 0, 0, ti30, ti30, driver_device, 0, "Texas Instruments", "TI-30", GAME_SUPPORTS_SAVE | GAME_NO_SOUND_HW ) -COMP( 1977, tiprog, 0, 0, ti30, tiprog, driver_device, 0, "Texas Instruments", "TI Programmer", GAME_SUPPORTS_SAVE | GAME_NO_SOUND_HW ) -COMP( 1979, tibusan1, 0, 0, ti30, tibusan1, driver_device, 0, "Texas Instruments", "TI Business Analyst-I", GAME_SUPPORTS_SAVE | GAME_NO_SOUND_HW ) +COMP( 1976, ti30, 0, 0, majestic, ti30, driver_device, 0, "Texas Instruments", "TI-30", GAME_SUPPORTS_SAVE | GAME_NO_SOUND_HW ) +COMP( 1977, tiprog, 0, 0, majestic, tiprog, driver_device, 0, "Texas Instruments", "TI Programmer", GAME_SUPPORTS_SAVE | GAME_NO_SOUND_HW ) +COMP( 1979, tibusan1, 0, 0, majestic, tibusan1, driver_device, 0, "Texas Instruments", "TI Business Analyst-I", GAME_SUPPORTS_SAVE | GAME_NO_SOUND_HW ) diff --git a/src/mess/drivers/tispeak.c b/src/mess/drivers/tispeak.c index 73992331fb3..b8794c98b37 100644 --- a/src/mess/drivers/tispeak.c +++ b/src/mess/drivers/tispeak.c @@ -327,7 +327,7 @@ public: DECLARE_INPUT_CHANGED_MEMBER(snspell_power_button); void snspell_power_off(); - void snspell_display(); + void prepare_display(); protected: virtual void machine_start(); @@ -400,7 +400,7 @@ DRIVER_INIT_MEMBER(tispeak_state, lantutor) // common/snspell -void tispeak_state::snspell_display() +void tispeak_state::prepare_display() { display_matrix_seg(16, 16, m_o, (m_r & 0x8000) ? (m_r & 0x21ff) : 0, 0x3fff); } @@ -415,7 +415,7 @@ WRITE16_MEMBER(tispeak_state::snspell_write_r) // R15: filament on // other bits: MCU internal use m_r = m_inp_mux = data; - snspell_display(); + prepare_display(); } WRITE16_MEMBER(tispeak_state::snspell_write_o) @@ -423,7 +423,7 @@ WRITE16_MEMBER(tispeak_state::snspell_write_o) // reorder opla to led14seg, plus DP as d14 and AP as d15: // E,D,C,G,B,A,I,M,L,K,N,J,[AP],H,F,[DP] (sidenote: TI KLMN = MAME MLNK) m_o = BITSWAP16(data,12,15,10,7,8,9,11,6,13,3,14,0,1,2,4,5); - snspell_display(); + prepare_display(); } READ8_MEMBER(tispeak_state::snspell_read_k) @@ -450,7 +450,7 @@ WRITE16_MEMBER(tispeak_state::snmath_write_o) // reorder opla to led14seg, plus DP as d14 and AP as d15: // [DP],D,C,H,F,B,I,M,L,K,N,J,[AP],E,G,A (sidenote: TI KLMN = MAME MLNK) m_o = BITSWAP16(data,12,0,10,7,8,9,11,6,3,14,4,13,1,2,5,15); - snspell_display(); + prepare_display(); } @@ -460,7 +460,7 @@ WRITE16_MEMBER(tispeak_state::lantutor_write_r) { // same as default, except R13 is used for an extra digit m_r = m_inp_mux = data; - snspell_display(); + prepare_display(); } diff --git a/src/mess/includes/hh_tms1k.h b/src/mess/includes/hh_tms1k.h index 19699528b2c..27cf20279d2 100644 --- a/src/mess/includes/hh_tms1k.h +++ b/src/mess/includes/hh_tms1k.h @@ -59,94 +59,6 @@ public: void display_matrix(int maxx, int maxy, UINT32 setx, UINT32 sety); void display_matrix_seg(int maxx, int maxy, UINT32 setx, UINT32 sety, UINT16 segmask); - // game-specific handlers - void mathmagi_display(); - DECLARE_WRITE16_MEMBER(mathmagi_write_r); - DECLARE_WRITE16_MEMBER(mathmagi_write_o); - DECLARE_READ8_MEMBER(mathmagi_read_k); - - void amaztron_display(); - DECLARE_WRITE16_MEMBER(amaztron_write_r); - DECLARE_WRITE16_MEMBER(amaztron_write_o); - DECLARE_READ8_MEMBER(amaztron_read_k); - - void tc4_display(); - DECLARE_WRITE16_MEMBER(tc4_write_r); - DECLARE_WRITE16_MEMBER(tc4_write_o); - DECLARE_READ8_MEMBER(tc4_read_k); - - void ebball_display(); - DECLARE_WRITE16_MEMBER(ebball_write_r); - DECLARE_WRITE16_MEMBER(ebball_write_o); - DECLARE_READ8_MEMBER(ebball_read_k); - - void ebball2_display(); - DECLARE_WRITE16_MEMBER(ebball2_write_r); - DECLARE_WRITE16_MEMBER(ebball2_write_o); - DECLARE_READ8_MEMBER(ebball2_read_k); - - void ebball3_display(); - DECLARE_WRITE16_MEMBER(ebball3_write_r); - DECLARE_WRITE16_MEMBER(ebball3_write_o); - DECLARE_READ8_MEMBER(ebball3_read_k); - void ebball3_set_clock(); - DECLARE_INPUT_CHANGED_MEMBER(ebball3_difficulty_switch); - DECLARE_MACHINE_RESET(ebball3); - - DECLARE_WRITE16_MEMBER(elecdet_write_r); - DECLARE_WRITE16_MEMBER(elecdet_write_o); - DECLARE_READ8_MEMBER(elecdet_read_k); - - void starwbc_display(); - DECLARE_WRITE16_MEMBER(starwbc_write_r); - DECLARE_WRITE16_MEMBER(starwbc_write_o); - DECLARE_READ8_MEMBER(starwbc_read_k); - - void astro_display(); - DECLARE_WRITE16_MEMBER(astro_write_r); - DECLARE_WRITE16_MEMBER(astro_write_o); - DECLARE_READ8_MEMBER(astro_read_k); - - DECLARE_WRITE16_MEMBER(comp4_write_r); - DECLARE_WRITE16_MEMBER(comp4_write_o); - DECLARE_READ8_MEMBER(comp4_read_k); - - DECLARE_WRITE16_MEMBER(simon_write_r); - DECLARE_WRITE16_MEMBER(simon_write_o); - DECLARE_READ8_MEMBER(simon_read_k); - - DECLARE_WRITE16_MEMBER(ssimon_write_r); - DECLARE_WRITE16_MEMBER(ssimon_write_o); - DECLARE_READ8_MEMBER(ssimon_read_k); - void ssimon_set_clock(); - DECLARE_INPUT_CHANGED_MEMBER(ssimon_speed_switch); - DECLARE_MACHINE_RESET(ssimon); - - DECLARE_WRITE16_MEMBER(cnsector_write_r); - DECLARE_WRITE16_MEMBER(cnsector_write_o); - DECLARE_READ8_MEMBER(cnsector_read_k); - - DECLARE_WRITE16_MEMBER(merlin_write_r); - DECLARE_WRITE16_MEMBER(merlin_write_o); - DECLARE_READ8_MEMBER(merlin_read_k); - - DECLARE_WRITE16_MEMBER(stopthief_write_r); - DECLARE_WRITE16_MEMBER(stopthief_write_o); - DECLARE_READ8_MEMBER(stopthief_read_k); - - DECLARE_WRITE16_MEMBER(bankshot_write_r); - DECLARE_WRITE16_MEMBER(bankshot_write_o); - DECLARE_READ8_MEMBER(bankshot_read_k); - - DECLARE_WRITE16_MEMBER(splitsec_write_r); - DECLARE_WRITE16_MEMBER(splitsec_write_o); - DECLARE_READ8_MEMBER(splitsec_read_k); - - void tandy12_display(); - DECLARE_WRITE16_MEMBER(tandy12_write_r); - DECLARE_WRITE16_MEMBER(tandy12_write_o); - DECLARE_READ8_MEMBER(tandy12_read_k); - protected: virtual void machine_start(); virtual void machine_reset();