From cc45555809946df83c18621751060d5bcfe6a462 Mon Sep 17 00:00:00 2001 From: hap Date: Fri, 30 Dec 2022 21:13:40 +0100 Subject: ttfball: add volume gate --- src/mame/handheld/hh_pic16.cpp | 154 +++++++++++++++++++++++++++++------------ 1 file changed, 108 insertions(+), 46 deletions(-) diff --git a/src/mame/handheld/hh_pic16.cpp b/src/mame/handheld/hh_pic16.cpp index 90a21a86e72..27d1681b2c0 100644 --- a/src/mame/handheld/hh_pic16.cpp +++ b/src/mame/handheld/hh_pic16.cpp @@ -43,12 +43,12 @@ ROM source notes when dumped from another title, but confident it's the same: - drdunk: Tandy Electronic Basketball - flash: Radio Shack Sound Effects Chassis - hccbaskb: Sears Electronic Basketball +- ttfballa: (no brand) Football - us2pfball: Tandy 2-Player Football - uspbball: Tandy 2-Player Baseball TODO: - tweak MCU frequency for games when video/audio recording surfaces(YouTube etc.) -- ttfball: discrete sound part, for volume gating? - sfxphasor default music mode should have volume decay, I can't get it working without breaking sound effects or command C (volume decay with values 15 and up) - what's the relation between drdunk and hccbaskb? Probably made by the same @@ -62,6 +62,7 @@ TODO: #include "cpu/pic16c5x/pic16c5x.h" #include "video/pwm.h" #include "machine/clock.h" +#include "machine/input_merger.h" #include "machine/timer.h" #include "sound/dac.h" #include "sound/flt_vol.h" @@ -304,14 +305,14 @@ INPUT_PORTS_END void touchme_state::touchme(machine_config &config) { // basic machine hardware - PIC1655(config, m_maincpu, 300000); // approximation - RC osc. R=100K, C=47pF + PIC1655(config, m_maincpu, 250000); // approximation - RC osc. R=100K, C=47pF m_maincpu->read_a().set(FUNC(touchme_state::read_a)); m_maincpu->write_b().set(FUNC(touchme_state::write_b)); m_maincpu->read_c().set_constant(0xff); m_maincpu->write_c().set(FUNC(touchme_state::write_c)); // PIC CLKOUT, tied to RTCC - CLOCK(config, "clock", 300000/4).signal_handler().set_inputline("maincpu", PIC16C5x_RTCC); + CLOCK(config, "clock", 250000/4).signal_handler().set_inputline("maincpu", PIC16C5x_RTCC); // video hardware PWM_DISPLAY(config, m_display).set_size(7, 7); @@ -449,10 +450,11 @@ ROM_END * PIC 1655A-522 * 3-bit sound with volume decay - It's a toy synthesizer. When in music mode, the user can create custom - sounds with the F key, other keys are music notes. To put it briefly, - commands A,B are for vibrato, C is for volume decay, and D,E,F change - the timbre. + It's a toy synthesizer. It included keypad overlays with nursery rhymes. + + When in music mode, the user can create custom sounds with the F key, other + keys are music notes. To put it briefly, commands A,B are for vibrato, + C is for volume decay, and D,E,F change the timbre. Paste example (must be in music mode): F11A F3B F4C F3D F3E F6F @@ -1688,19 +1690,13 @@ ROM_END /*************************************************************************** - Toytronic Football (set 1) + Toytronic Football * PIC 1655A-033 - * 4511 7seg BCD decoder, 7 7seg LEDs + 27 other LEDs, 1-bit sound - - (no brand) Football (set 2) - * PIC 1655-024 - * rest same as above, 1 less button + * 4511 7seg BCD decoder, 7 7seg LEDs + 27 other LEDs + * 1-bit sound through volume gate Hello and welcome to another Mattel Football clone, there are so many of these. - The 1655-024 one came from an unbranded handheld, but comparison suggests that - it's the 'prequel' of 1655A-033. - - The 1655-024 version looks and sounds the same as Conic "Electronic Football". + Comparison suggests that this is the 'sequel' to 1655A-024. ***************************************************************************/ @@ -1713,11 +1709,11 @@ public: void ttfball(machine_config &config); -private: +protected: void update_display(); u8 read_a(); void write_b(u8 data); - void write_c(u8 data); + virtual void write_c(u8 data); }; // handlers @@ -1727,8 +1723,8 @@ void ttfball_state::update_display() // C0-C2: led data // C0-C3: 4511 A-D, C4: digit segment DP // C5: select digits or led matrix - const u8 _4511_map[16] = { 0x3f,0x06,0x5b,0x4f,0x66,0x6d,0x7c,0x07,0x7f,0x67,0,0,0,0,0,0 }; - u16 led_data = (m_c & 0x20) ? (_4511_map[m_c & 0xf] | (~m_c << 3 & 0x80)) : (~m_c << 8 & 0x700); + const u8 cd4511_map[0x10] = { 0x3f,0x06,0x5b,0x4f,0x66,0x6d,0x7c,0x07,0x7f,0x67 }; + u16 led_data = (m_c & 0x20) ? (cd4511_map[m_c & 0xf] | (~m_c << 3 & 0x80)) : (~m_c << 8 & 0x700); m_display->matrix(m_b | (m_c << 1 & 0x100), led_data); } @@ -1754,9 +1750,6 @@ void ttfball_state::write_b(u8 data) void ttfball_state::write_c(u8 data) { - // C6: speaker out - m_speaker->level_w(data >> 6 & 1); - // C7: input mux high m_inp_mux = (m_inp_mux & 0xf) | (data >> 3 & 0x10); @@ -1791,6 +1784,87 @@ static INPUT_PORTS_START( ttfball ) PORT_CONFSETTING( 0x00, "2" ) INPUT_PORTS_END +void ttfball_state::ttfball(machine_config &config) +{ + // basic machine hardware + PIC1655(config, m_maincpu, 550000); // approximation - RC osc. 27K, C=68pF + m_maincpu->read_a().set(FUNC(ttfball_state::read_a)); + m_maincpu->write_b().set(FUNC(ttfball_state::write_b)); + m_maincpu->read_c().set_constant(0xff); + m_maincpu->write_c().set(FUNC(ttfball_state::write_c)); + + // video hardware + PWM_DISPLAY(config, m_display).set_size(9, 11); + m_display->set_segmask(0x7f, 0xff); + m_display->set_bri_levels(0.003, 0.03); // player led is brighter + config.set_default_layout(layout_ttfball); + + // sound hardware + SPEAKER(config, "mono").front_center(); + SPEAKER_SOUND(config, m_speaker).add_route(ALL_OUTPUTS, "mono", 0.25); + + auto &gate(CLOCK(config, "gate", 3500)); // approximation + gate.signal_handler().set("merge", FUNC(input_merger_all_high_device::in_w<0>)); + m_maincpu->write_c().append("merge", FUNC(input_merger_all_high_device::in_w<1>)).bit(6); + + auto &merge(INPUT_MERGER_ALL_HIGH(config, "merge")); + merge.output_handler().set(m_speaker, FUNC(speaker_sound_device::level_w)); +} + +// roms + +ROM_START( ttfball ) + ROM_REGION( 0x0400, "maincpu", 0 ) + ROM_LOAD( "pic_1655a-033", 0x0000, 0x0400, CRC(2b500501) SHA1(f7fe464663c56e2181a31a1dc5f1f5239df57bed) ) +ROM_END + + + + + +/*************************************************************************** + + Toytronic Football (model 003201) + * PIC 1655-024 + * 4511 7seg BCD decoder, 7 7seg LEDs + 27 other LEDs, 1-bit sound + + The 1655-024 version looks and sounds the same as Conic "Electronic Football". + The reason it went through several brands (and even a no brand one) was + probably due to legal pursuit from Mattel. + + known releases: + - Hong Kong(1): Football, published by Toytronic + - Hong Kong(2): Football, published by (no brand) + +***************************************************************************/ + +class ttfballa_state : public ttfball_state +{ +public: + ttfballa_state(const machine_config &mconfig, device_type type, const char *tag) : + ttfball_state(mconfig, type, tag) + { } + + void ttfballa(machine_config &config); + +protected: + virtual void write_c(u8 data) override; +}; + +// handlers + +void ttfballa_state::write_c(u8 data) +{ + // C6: speaker out + m_speaker->level_w(BIT(data, 6)); + + // same as ttfball + m_c = data; + update_display(); +} + +// config + static INPUT_PORTS_START( ttfballa ) PORT_START("IN.0") // B0 port A3 PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_NAME("Kick") @@ -1804,7 +1878,7 @@ static INPUT_PORTS_START( ttfballa ) PORT_START("IN.3") // B7 port A3 PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_16WAY - PORT_START("IN.4") // C7 port A3 + PORT_START("IN.4") // C7 port A3 (not used) PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_UNUSED ) PORT_START("IN.5") // port A @@ -1815,33 +1889,21 @@ static INPUT_PORTS_START( ttfballa ) PORT_CONFSETTING( 0x00, "2" ) INPUT_PORTS_END -void ttfball_state::ttfball(machine_config &config) +void ttfballa_state::ttfballa(machine_config &config) { - // basic machine hardware - PIC1655(config, m_maincpu, 600000); // approximation - RC osc. R=27K(set 1) or 33K(set 2), C=68pF - m_maincpu->read_a().set(FUNC(ttfball_state::read_a)); - m_maincpu->write_b().set(FUNC(ttfball_state::write_b)); - m_maincpu->read_c().set_constant(0xff); - m_maincpu->write_c().set(FUNC(ttfball_state::write_c)); + ttfball(config); - // video hardware - PWM_DISPLAY(config, m_display).set_size(9, 11); - m_display->set_segmask(0x7f, 0xff); - m_display->set_bri_levels(0.003, 0.03); // player led is brighter - config.set_default_layout(layout_ttfball); + m_maincpu->set_clock(500000); // approximation - RC osc. 33K, C=68pF + m_display->set_bri_levels(0.002, 0.02); - // sound hardware - SPEAKER(config, "mono").front_center(); - SPEAKER_SOUND(config, m_speaker).add_route(ALL_OUTPUTS, "mono", 0.25); + // no volume gate + m_maincpu->write_c().set(FUNC(ttfballa_state::write_c)); + config.device_remove("gate"); + config.device_remove("merge"); } // roms -ROM_START( ttfball ) - ROM_REGION( 0x0400, "maincpu", 0 ) - ROM_LOAD( "pic_1655a-033", 0x0000, 0x0400, CRC(2b500501) SHA1(f7fe464663c56e2181a31a1dc5f1f5239df57bed) ) -ROM_END - ROM_START( ttfballa ) ROM_REGION( 0x0400, "maincpu", 0 ) ROM_LOAD( "pic_1655-024", 0x0000, 0x0400, CRC(9091102f) SHA1(ef72759f20b5a99e0366863caad1e26be114263f) ) @@ -2144,7 +2206,7 @@ CONS( 1979, rockpin, 0, 0, rockpin, rockpin, rockpin_state, empty_ CONS( 1979, hccbaskb, 0, 0, hccbaskb, hccbaskb, hccbaskb_state, empty_init, "Tiger Electronics", "Half Court Computer Basketball", MACHINE_SUPPORTS_SAVE ) CONS( 1979, ttfball, 0, 0, ttfball, ttfball, ttfball_state, empty_init, "Toytronic", "Football (Toytronic, set 1)", MACHINE_SUPPORTS_SAVE | MACHINE_IMPERFECT_SOUND ) -CONS( 1979, ttfballa, ttfball, 0, ttfball, ttfballa, ttfball_state, empty_init, "Toytronic", "Football (Toytronic, set 2)", MACHINE_SUPPORTS_SAVE ) +CONS( 1979, ttfballa, ttfball, 0, ttfballa, ttfballa, ttfballa_state, empty_init, "Toytronic", "Football (Toytronic, set 2)", MACHINE_SUPPORTS_SAVE ) CONS( 1981, uspbball, 0, 0, uspbball, uspbball, uspbball_state, empty_init, "U.S. Games", "Programmable Baseball", MACHINE_SUPPORTS_SAVE | MACHINE_NOT_WORKING ) CONS( 1981, us2pfball, 0, 0, us2pfball, us2pfball, us2pfball_state, empty_init, "U.S. Games", "Electronic 2-Player Football", MACHINE_SUPPORTS_SAVE ) -- cgit v1.2.3