From 6aab489428fe83e68c5350759e80b02386836616 Mon Sep 17 00:00:00 2001 From: hap Date: Tue, 24 Dec 2024 13:13:16 +0100 Subject: hh_ht11xx: make driver source organization a bit more similar to other hh* drivers --- src/mame/handheld/hh_ht11xx.cpp | 189 +++++++++++++++++++++++++--------------- 1 file changed, 118 insertions(+), 71 deletions(-) diff --git a/src/mame/handheld/hh_ht11xx.cpp b/src/mame/handheld/hh_ht11xx.cpp index 05b1910d2ce..bfae4bb60dc 100644 --- a/src/mame/handheld/hh_ht11xx.cpp +++ b/src/mame/handheld/hh_ht11xx.cpp @@ -37,6 +37,8 @@ TODO: namespace { +// base class + class hh_ht11xx_state : public driver_device { public: @@ -53,16 +55,34 @@ protected: required_device m_maincpu; }; -class hh_ht1190_state : public hh_ht11xx_state +INPUT_CHANGED_MEMBER(hh_ht11xx_state::input_wakeup) +{ + m_maincpu->set_input_line(HT1130_EXT_WAKEUP_LINE, newval ? CLEAR_LINE : ASSERT_LINE); +} + +void hh_ht11xx_state::mcfg_svg_screen(machine_config &config, u16 width, u16 height, const char *tag) +{ + screen_device &screen(SCREEN(config, tag, SCREEN_TYPE_SVG)); + screen.set_refresh_hz(60); + screen.set_size(width, height); + screen.set_visarea_full(); + + config.set_default_layout(layout_hh_ht11xx_single); +} + + +// HT1130 class + +class hh_ht1130_state : public hh_ht11xx_state { public: - hh_ht1190_state(const machine_config &mconfig, device_type type, const char *tag) : + hh_ht1130_state(const machine_config &mconfig, device_type type, const char *tag) : hh_ht11xx_state(mconfig, type, tag), m_out_x(*this, "%u.%u", 0U, 0U), m_in(*this, "IN%u", 1) { } - void brke23p2(machine_config &config); + void ga888(machine_config &config); protected: virtual void machine_start() override ATTR_COLD; @@ -70,21 +90,35 @@ protected: void segment_w(offs_t offset, u64 data); private: - output_finder<8, 40> m_out_x; - required_ioport_array<2> m_in; + output_finder<4, 32> m_out_x; + required_ioport_array<3> m_in; }; +void hh_ht1130_state::machine_start() +{ + m_out_x.resolve(); +} -class hh_ht1130_state : public hh_ht11xx_state +void hh_ht1130_state::segment_w(offs_t offset, u64 data) +{ + // output to x.y where x = COM# and y = SEG# + for (int i = 0; i < 32; i++) + m_out_x[offset][i] = BIT(data, i); +} + + +// HT1190 class + +class hh_ht1190_state : public hh_ht11xx_state { public: - hh_ht1130_state(const machine_config &mconfig, device_type type, const char *tag) : + hh_ht1190_state(const machine_config &mconfig, device_type type, const char *tag) : hh_ht11xx_state(mconfig, type, tag), m_out_x(*this, "%u.%u", 0U, 0U), m_in(*this, "IN%u", 1) { } - void ga888(machine_config &config); + void brke23p2(machine_config &config); protected: virtual void machine_start() override ATTR_COLD; @@ -92,8 +126,8 @@ protected: void segment_w(offs_t offset, u64 data); private: - output_finder<4, 32> m_out_x; - required_ioport_array<3> m_in; + output_finder<8, 40> m_out_x; + required_ioport_array<2> m_in; }; void hh_ht1190_state::machine_start() @@ -101,16 +135,30 @@ void hh_ht1190_state::machine_start() m_out_x.resolve(); } -void hh_ht1130_state::machine_start() +void hh_ht1190_state::segment_w(offs_t offset, u64 data) { - m_out_x.resolve(); + // output to x.y where x = COM# and y = SEG# + for (int i = 0; i < 40; i++) + m_out_x[offset][i] = BIT(data, i); } -INPUT_CHANGED_MEMBER(hh_ht11xx_state::input_wakeup) -{ - m_maincpu->set_input_line(HT1130_EXT_WAKEUP_LINE, newval ? CLEAR_LINE : ASSERT_LINE); -} + +/******************************************************************************* + + Minidrivers (optional subclass, I/O, Inputs, Machine Config, ROM Defs) + +*******************************************************************************/ + +/******************************************************************************* + + E-Star Brick Game 96 in 1 (E-23 Plus Mark II) + * Holtek HT1190 + * 10*20 LCD screen + custom segments, 1-bit sound + +*******************************************************************************/ + +// inputs static INPUT_PORTS_START( brke23p2 ) PORT_START("IN1") @@ -126,6 +174,48 @@ static INPUT_PORTS_START( brke23p2 ) PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_BUTTON4 ) PORT_NAME("Left") INPUT_PORTS_END +// config + +void hh_ht1190_state::brke23p2(machine_config &config) +{ + HT1190(config, m_maincpu, 1000000/8); // frequency? + m_maincpu->segment_out_cb().set(FUNC(hh_ht1190_state::segment_w)); + + m_maincpu->ps_in_cb().set_ioport(m_in[0]); + m_maincpu->pp_in_cb().set_ioport(m_in[1]); + + SPEAKER(config, "speaker").front_center(); + + mcfg_svg_screen(config, 755, 1080); +} + +// roms + +ROM_START( brke23p2 ) + ROM_REGION( 0x1000, "maincpu", 0 ) + ROM_LOAD( "brke23p2.bin", 0x0000, 0x1000, CRC(8045fac4) SHA1(a36213309e6add31f31e4248f02f17de9914a5c1) ) // visual decap + + ROM_REGION( 0x280, "melody", 0 ) + ROM_LOAD( "e23plusmarkii96in1.srom", 0x000, 0x280, CRC(591a8a21) SHA1(f039359e8e1d1bf75581a4c852b263c8c140e072) ) + + ROM_REGION( 160500, "screen", 0) + ROM_LOAD( "brke23p2.svg", 0, 160500, CRC(9edf8aab) SHA1(f2ab907d23517612196648f1b5b0cb9b4a1ab3bd) ) +ROM_END + + + + + +/******************************************************************************* + + Block Game & Echo Key GA888 + * Holtek HT1130 + * 8*12 LCD screen + 8 custom segments, 1-bit sound + +*******************************************************************************/ + +// inputs + static INPUT_PORTS_START( ga888 ) // the unit also has an up button, and a reset button, is 'up' connected to anything? PORT_START("IN1") PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_VOLUME_DOWN ) PORT_NAME("Pause / Power") PORT_CHANGED_MEMBER(DEVICE_SELF, FUNC(hh_ht11xx_state::input_wakeup), 0) @@ -146,47 +236,7 @@ static INPUT_PORTS_START( ga888 ) // the unit also has an up button, and a reset PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_BUTTON4 ) PORT_NAME("Left") INPUT_PORTS_END -void hh_ht1190_state::segment_w(offs_t offset, u64 data) -{ - for (int i = 0; i < 40; i++) - { - // output to x.y where x = COM# and y = SEG# - m_out_x[offset][i] = BIT(data, i); - } -} - -void hh_ht1130_state::segment_w(offs_t offset, u64 data) -{ - for (int i = 0; i < 32; i++) - { - // output to x.y where x = COM# and y = SEG# - m_out_x[offset][i] = BIT(data, i); - } -} - - -void hh_ht11xx_state::mcfg_svg_screen(machine_config &config, u16 width, u16 height, const char *tag) -{ - screen_device &screen(SCREEN(config, tag, SCREEN_TYPE_SVG)); - screen.set_refresh_hz(60); - screen.set_size(width, height); - screen.set_visarea_full(); - - config.set_default_layout(layout_hh_ht11xx_single); -} - -void hh_ht1190_state::brke23p2(machine_config &config) -{ - HT1190(config, m_maincpu, 1000000/8); // frequency? - m_maincpu->segment_out_cb().set(FUNC(hh_ht1190_state::segment_w)); - - m_maincpu->ps_in_cb().set_ioport(m_in[0]); - m_maincpu->pp_in_cb().set_ioport(m_in[1]); - - SPEAKER(config, "speaker").front_center(); - - mcfg_svg_screen(config, 755, 1080); -} +// config void hh_ht1130_state::ga888(machine_config &config) { @@ -202,16 +252,7 @@ void hh_ht1130_state::ga888(machine_config &config) mcfg_svg_screen(config, 698, 1080); } -ROM_START( brke23p2 ) - ROM_REGION( 0x1000, "maincpu", 0 ) - ROM_LOAD( "brke23p2.bin", 0x0000, 0x1000, CRC(8045fac4) SHA1(a36213309e6add31f31e4248f02f17de9914a5c1) ) // visual decap - - ROM_REGION( 0x280, "melody", 0 ) - ROM_LOAD( "e23plusmarkii96in1.srom", 0x000, 0x280, CRC(591a8a21) SHA1(f039359e8e1d1bf75581a4c852b263c8c140e072) ) - - ROM_REGION( 160500, "screen", 0) - ROM_LOAD( "brke23p2.svg", 0, 160500, CRC(9edf8aab) SHA1(f2ab907d23517612196648f1b5b0cb9b4a1ab3bd) ) -ROM_END +// roms ROM_START( ga888 ) ROM_REGION( 0x1000, "maincpu", 0 ) @@ -224,11 +265,17 @@ ROM_START( ga888 ) ROM_LOAD( "ga888.svg", 0, 85508, CRC(9ab6dd67) SHA1(a4365a00204bf4e376f28600c0b87289bda0cbb0) ) ROM_END - } // anonymous namespace -// some other dieshots have 1996 on them, it is also possible the software is from Holtek -CONS( 1993, brke23p2, 0, 0, brke23p2, brke23p2, hh_ht1190_state, empty_init, "E-Star", "Brick Game 96 in 1 (E-23 Plus Mark II)", MACHINE_IMPERFECT_TIMING | MACHINE_NO_SOUND ) -CONS( 199?, ga888, 0, 0, ga888, ga888, hh_ht1130_state, empty_init, "", "Block Game & Echo Key GA888", MACHINE_IMPERFECT_TIMING | MACHINE_NO_SOUND ) // clone of Tetris Jr? +/******************************************************************************* + + Game driver(s) + +*******************************************************************************/ + +// YEAR NAME PARENT COMPAT MACHINE INPUT CLASS INIT COMPANY, FULLNAME, FLAGS +CONS( 1993, brke23p2, 0, 0, brke23p2, brke23p2, hh_ht1190_state, empty_init, "E-Star", "Brick Game 96 in 1 (E-23 Plus Mark II)", MACHINE_IMPERFECT_TIMING | MACHINE_NO_SOUND ) // some other dieshots have 1996 on them, it is also possible the software is from Holtek + +CONS( 199?, ga888, 0, 0, ga888, ga888, hh_ht1130_state, empty_init, "", "Block Game & Echo Key GA888", MACHINE_IMPERFECT_TIMING | MACHINE_NO_SOUND ) // clone of Tetris Jr? -- cgit v1.2.3