summaryrefslogtreecommitdiffstats
path: root/src/mame/drivers/hh_pic16.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/mame/drivers/hh_pic16.cpp')
-rw-r--r--src/mame/drivers/hh_pic16.cpp188
1 files changed, 101 insertions, 87 deletions
diff --git a/src/mame/drivers/hh_pic16.cpp b/src/mame/drivers/hh_pic16.cpp
index 3dbab20c30f..6517ce61ab0 100644
--- a/src/mame/drivers/hh_pic16.cpp
+++ b/src/mame/drivers/hh_pic16.cpp
@@ -92,6 +92,12 @@ public:
m_inputs(*this, "IN.%u", 0)
{ }
+ virtual DECLARE_INPUT_CHANGED_MEMBER(reset_button);
+
+protected:
+ virtual void machine_start() override;
+ virtual void machine_reset() override;
+
// devices
required_device<pic16c5x_device> m_maincpu;
optional_device<pwm_display_device> m_display;
@@ -99,19 +105,14 @@ public:
optional_ioport_array<6> m_inputs; // max 6
// misc common
- u8 m_a; // MCU port A write data
- u8 m_b; // " B
- u8 m_c; // " C
- u8 m_d; // " D
- u16 m_inp_mux; // multiplexed inputs mask
+ u8 m_a = 0; // MCU port A write data
+ u8 m_b = 0; // " B
+ u8 m_c = 0; // " C
+ u8 m_d = 0; // " D
+ u16 m_inp_mux = ~0; // multiplexed inputs mask
u16 read_inputs(int columns, u16 colmask = ~0);
u8 read_rotated_inputs(int columns, u8 rowmask = ~0);
- virtual DECLARE_INPUT_CHANGED_MEMBER(reset_button);
-
-protected:
- virtual void machine_start() override;
- virtual void machine_reset() override;
};
@@ -119,13 +120,6 @@ protected:
void hh_pic16_state::machine_start()
{
- // zerofill
- m_a = 0;
- m_b = 0;
- m_c = 0;
- m_d = 0;
- m_inp_mux = ~0;
-
// register for savestates
save_item(NAME(m_a));
save_item(NAME(m_b));
@@ -212,12 +206,14 @@ public:
hh_pic16_state(mconfig, type, tag)
{ }
+ void touchme(machine_config &config);
+
+private:
void update_display();
void update_speaker();
u8 read_a();
void write_b(u8 data);
void write_c(u8 data);
- void touchme(machine_config &config);
};
// handlers
@@ -287,7 +283,7 @@ INPUT_PORTS_END
void touchme_state::touchme(machine_config &config)
{
- /* basic machine hardware */
+ // basic machine hardware
PIC1655(config, m_maincpu, 300000); // 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));
@@ -297,12 +293,12 @@ void touchme_state::touchme(machine_config &config)
// PIC CLKOUT, tied to RTCC
CLOCK(config, "clock", 300000/4).signal_handler().set_inputline("maincpu", PIC16C5x_RTCC);
- /* video hardware */
+ // video hardware
PWM_DISPLAY(config, m_display).set_size(7, 7);
m_display->set_segmask(3, 0x7f);
config.set_default_layout(layout_touchme);
- /* sound hardware */
+ // sound hardware
SPEAKER(config, "mono").front_center();
SPEAKER_SOUND(config, m_speaker);
static const double speaker_levels[] = { 0.0, 1.0, -1.0, 0.0 };
@@ -336,10 +332,12 @@ public:
hh_pic16_state(mconfig, type, tag)
{ }
+ void pabball(machine_config &config);
+
+private:
void update_display();
void write_b(u8 data);
void write_c(u8 data);
- void pabball(machine_config &config);
};
// handlers
@@ -397,19 +395,19 @@ INPUT_PORTS_END
void pabball_state::pabball(machine_config &config)
{
- /* basic machine hardware */
+ // basic machine hardware
PIC1655(config, m_maincpu, 1200000); // approximation - RC osc. R=18K, C=27pF
m_maincpu->read_a().set_ioport("IN.0");
m_maincpu->write_b().set(FUNC(pabball_state::write_b));
m_maincpu->read_c().set_ioport("IN.1");
m_maincpu->write_c().set(FUNC(pabball_state::write_c));
- /* video hardware */
+ // video hardware
PWM_DISPLAY(config, m_display).set_size(10, 8);
m_display->set_segmask(0x200, 0xff);
config.set_default_layout(layout_hh_pic16_test);
- /* sound hardware */
+ // sound hardware
SPEAKER(config, "mono").front_center();
SPEAKER_SOUND(config, m_speaker).add_route(ALL_OUTPUTS, "mono", 0.25);
}
@@ -443,10 +441,12 @@ public:
hh_pic16_state(mconfig, type, tag)
{ }
+ void melodym(machine_config &config);
+
+private:
void write_b(u8 data);
u8 read_c();
void write_c(u8 data);
- void melodym(machine_config &config);
};
// handlers
@@ -519,19 +519,19 @@ INPUT_PORTS_END
void melodym_state::melodym(machine_config &config)
{
- /* basic machine hardware */
+ // basic machine hardware
PIC1655(config, m_maincpu, 1000000); // approximation
m_maincpu->read_a().set_ioport("IN.5");
m_maincpu->write_b().set(FUNC(melodym_state::write_b));
m_maincpu->read_c().set(FUNC(melodym_state::read_c));
m_maincpu->write_c().set(FUNC(melodym_state::write_c));
- /* video hardware */
+ // video hardware
PWM_DISPLAY(config, m_display).set_size(1, 1);
m_display->set_bri_levels(0.9);
config.set_default_layout(layout_melodym);
- /* sound hardware */
+ // sound hardware
SPEAKER(config, "mono").front_center();
SPEAKER_SOUND(config, m_speaker).add_route(ALL_OUTPUTS, "mono", 0.25);
}
@@ -569,11 +569,13 @@ public:
hh_pic16_state(mconfig, type, tag)
{ }
+ void maniac(machine_config &config);
+
+private:
void update_display();
void update_speaker();
void write_b(u8 data);
void write_c(u8 data);
- void maniac(machine_config &config);
};
// handlers
@@ -621,18 +623,18 @@ INPUT_PORTS_END
void maniac_state::maniac(machine_config &config)
{
- /* basic machine hardware */
+ // basic machine hardware
PIC1655(config, m_maincpu, 1000000); // approximation - RC osc. R=~13.4K, C=470pF
m_maincpu->read_a().set_ioport("IN.0");
m_maincpu->write_b().set(FUNC(maniac_state::write_b));
m_maincpu->write_c().set(FUNC(maniac_state::write_c));
- /* video hardware */
+ // video hardware
PWM_DISPLAY(config, m_display).set_size(2, 7);
m_display->set_segmask(3, 0x7f);
config.set_default_layout(layout_maniac);
- /* sound hardware */
+ // sound hardware
SPEAKER(config, "mono").front_center();
SPEAKER_SOUND(config, m_speaker);
static const double speaker_levels[] = { 0.0, 1.0, -1.0, 0.0 };
@@ -682,6 +684,12 @@ public:
hh_pic16_state(mconfig, type, tag)
{ }
+ void flash(machine_config &config);
+
+protected:
+ virtual void machine_start() override;
+
+private:
void update_display();
void write_b(u8 data);
u8 read_c();
@@ -689,19 +697,12 @@ public:
void speaker_decay_reset();
TIMER_DEVICE_CALLBACK_MEMBER(speaker_decay_sim);
- double m_speaker_volume;
- void flash(machine_config &config);
-
-protected:
- virtual void machine_start() override;
+ double m_speaker_volume = 0.0;
};
void flash_state::machine_start()
{
hh_pic16_state::machine_start();
-
- // zerofill/init
- m_speaker_volume = 0;
save_item(NAME(m_speaker_volume));
}
@@ -776,19 +777,19 @@ INPUT_PORTS_END
void flash_state::flash(machine_config &config)
{
- /* basic machine hardware */
+ // basic machine hardware
PIC1655(config, m_maincpu, 1050000); // approximation
m_maincpu->read_a().set_ioport("IN.0");
m_maincpu->write_b().set(FUNC(flash_state::write_b));
m_maincpu->read_c().set(FUNC(flash_state::read_c));
m_maincpu->write_c().set(FUNC(flash_state::write_c));
- /* video hardware */
+ // video hardware
PWM_DISPLAY(config, m_display).set_size(2, 7+4);
m_display->set_segmask(3, 0x7f);
config.set_default_layout(layout_flash);
- /* sound hardware */
+ // sound hardware
SPEAKER(config, "mono").front_center();
SPEAKER_SOUND(config, m_speaker).add_route(ALL_OUTPUTS, "mono", 0.25);
TIMER(config, "speaker_decay").configure_periodic(FUNC(flash_state::speaker_decay_sim), attotime::from_msec(25));
@@ -832,16 +833,18 @@ public:
hh_pic16_state(mconfig, type, tag)
{ }
- void write_b(u8 data);
- void write_c(u8 data);
- u8 read_c();
+ void matchme(machine_config &config);
- void set_clock();
DECLARE_INPUT_CHANGED_MEMBER(speed_switch) { set_clock(); }
- void matchme(machine_config &config);
protected:
virtual void machine_reset() override;
+
+private:
+ void set_clock();
+ void write_b(u8 data);
+ void write_c(u8 data);
+ u8 read_c();
};
void matchme_state::machine_reset()
@@ -933,18 +936,18 @@ INPUT_PORTS_END
void matchme_state::matchme(machine_config &config)
{
- /* basic machine hardware */
+ // basic machine hardware
PIC1655(config, m_maincpu, 1200000); // see set_clock
m_maincpu->read_a().set_ioport("IN.3");
m_maincpu->write_b().set(FUNC(matchme_state::write_b));
m_maincpu->read_c().set(FUNC(matchme_state::read_c));
m_maincpu->write_c().set(FUNC(matchme_state::write_c));
- /* video hardware */
+ // video hardware
PWM_DISPLAY(config, m_display).set_size(1, 8);
config.set_default_layout(layout_matchme);
- /* sound hardware */
+ // sound hardware
SPEAKER(config, "mono").front_center();
SPEAKER_SOUND(config, m_speaker).add_route(ALL_OUTPUTS, "mono", 0.25);
}
@@ -983,11 +986,13 @@ public:
hh_pic16_state(mconfig, type, tag)
{ }
+ void drdunk(machine_config &config);
+
+private:
void update_display();
u8 read_a();
void write_b(u8 data);
void write_c(u8 data);
- void drdunk(machine_config &config);
};
// handlers
@@ -1053,20 +1058,20 @@ INPUT_PORTS_END
void drdunk_state::drdunk(machine_config &config)
{
- /* basic machine hardware */
+ // basic machine hardware
PIC1655(config, m_maincpu, 800000); // approximation - RC osc. R=18K, C=47pF
m_maincpu->read_a().set(FUNC(drdunk_state::read_a));
m_maincpu->write_b().set(FUNC(drdunk_state::write_b));
m_maincpu->read_c().set_constant(0xff);
m_maincpu->write_c().set(FUNC(drdunk_state::write_c));
- /* video hardware */
+ // video hardware
PWM_DISPLAY(config, m_display).set_size(6, 7);
m_display->set_segmask(0x30, 0x7f);
m_display->set_bri_levels(0.01, 0.2); // player led is brighter
config.set_default_layout(layout_drdunk);
- /* sound hardware */
+ // sound hardware
SPEAKER(config, "mono").front_center();
SPEAKER_SOUND(config, m_speaker).add_route(ALL_OUTPUTS, "mono", 0.25);
}
@@ -1112,25 +1117,24 @@ public:
hh_pic16_state(mconfig, type, tag)
{ }
+ void leboom(machine_config &config);
+
+protected:
+ virtual void machine_start() override;
+
+private:
u8 read_a();
void write_b(u8 data);
void write_c(u8 data);
void speaker_decay_reset();
TIMER_DEVICE_CALLBACK_MEMBER(speaker_decay_sim);
- double m_speaker_volume;
- void leboom(machine_config &config);
-
-protected:
- virtual void machine_start() override;
+ double m_speaker_volume = 0.0;
};
void leboom_state::machine_start()
{
hh_pic16_state::machine_start();
-
- // zerofill/init
- m_speaker_volume = 0;
save_item(NAME(m_speaker_volume));
}
@@ -1218,18 +1222,18 @@ INPUT_PORTS_END
void leboom_state::leboom(machine_config &config)
{
- /* basic machine hardware */
+ // basic machine hardware
PIC1655(config, m_maincpu, 1000000); // approximation
m_maincpu->read_a().set(FUNC(leboom_state::read_a));
m_maincpu->write_b().set(FUNC(leboom_state::write_b));
m_maincpu->read_c().set_constant(0xff);
m_maincpu->write_c().set(FUNC(leboom_state::write_c));
- /* video hardware */
+ // video hardware
PWM_DISPLAY(config, m_display).set_size(1, 1);
config.set_default_layout(layout_leboom);
- /* sound hardware */
+ // sound hardware
SPEAKER(config, "mono").front_center();
SPEAKER_SOUND(config, m_speaker).add_route(ALL_OUTPUTS, "mono", 0.25);
TIMER(config, "speaker_decay").configure_periodic(FUNC(leboom_state::speaker_decay_sim), attotime::from_msec(25));
@@ -1267,12 +1271,14 @@ public:
hh_pic16_state(mconfig, type, tag)
{ }
+ void rockpin(machine_config &config);
+
+private:
void update_display();
void write_a(u8 data);
void write_b(u8 data);
void write_c(u8 data);
void write_d(u8 data);
- void rockpin(machine_config &config);
};
// handlers
@@ -1329,7 +1335,7 @@ INPUT_PORTS_END
void rockpin_state::rockpin(machine_config &config)
{
- /* basic machine hardware */
+ // basic machine hardware
PIC1650(config, m_maincpu, 450000); // approximation - RC osc. R=47K, C=47pF
m_maincpu->read_a().set_ioport("IN.0");
m_maincpu->write_a().set(FUNC(rockpin_state::write_a));
@@ -1343,12 +1349,12 @@ void rockpin_state::rockpin(machine_config &config)
// PIC CLKOUT, tied to RTCC
CLOCK(config, "clock", 450000/4).signal_handler().set_inputline(m_maincpu, PIC16C5x_RTCC);
- /* video hardware */
+ // video hardware
PWM_DISPLAY(config, m_display).set_size(3+6, 8);
m_display->set_segmask(7, 0x7f);
config.set_default_layout(layout_rockpin);
- /* sound hardware */
+ // sound hardware
SPEAKER(config, "mono").front_center();
SPEAKER_SOUND(config, m_speaker);
static const double speaker_levels[] = { 0.0, 1.0, -1.0, 0.0 };
@@ -1386,11 +1392,13 @@ public:
hh_pic16_state(mconfig, type, tag)
{ }
+ void hccbaskb(machine_config &config);
+
+private:
void update_display();
u8 read_a();
void write_b(u8 data);
void write_c(u8 data);
- void hccbaskb(machine_config &config);
};
// handlers
@@ -1456,20 +1464,20 @@ INPUT_PORTS_END
void hccbaskb_state::hccbaskb(machine_config &config)
{
- /* basic machine hardware */
+ // basic machine hardware
PIC1655(config, m_maincpu, 800000); // approximation - RC osc. R=15K, C=47pF
m_maincpu->read_a().set(FUNC(hccbaskb_state::read_a));
m_maincpu->write_b().set(FUNC(hccbaskb_state::write_b));
m_maincpu->read_c().set_constant(0xff);
m_maincpu->write_c().set(FUNC(hccbaskb_state::write_c));
- /* video hardware */
+ // video hardware
PWM_DISPLAY(config, m_display).set_size(7, 7);
m_display->set_segmask(0x60, 0x7f);
m_display->set_bri_levels(0.01, 0.2); // player led is brighter
config.set_default_layout(layout_hccbaskb);
- /* sound hardware */
+ // sound hardware
SPEAKER(config, "mono").front_center();
SPEAKER_SOUND(config, m_speaker).add_route(ALL_OUTPUTS, "mono", 0.25);
}
@@ -1510,11 +1518,13 @@ public:
hh_pic16_state(mconfig, type, tag)
{ }
+ void ttfball(machine_config &config);
+
+private:
void update_display();
u8 read_a();
void write_b(u8 data);
void write_c(u8 data);
- void ttfball(machine_config &config);
};
// handlers
@@ -1618,20 +1628,20 @@ INPUT_PORTS_END
void ttfball_state::ttfball(machine_config &config)
{
- /* basic machine hardware */
+ // basic machine hardware
PIC1655(config, m_maincpu, 500000); // 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));
- /* video hardware */
+ // video hardware
PWM_DISPLAY(config, m_display).set_size(9, 11);
m_display->set_segmask(0x7f, 0xff);
m_display->set_bri_levels(0.002, 0.02); // player led is brighter
config.set_default_layout(layout_ttfball);
- /* sound hardware */
+ // sound hardware
SPEAKER(config, "mono").front_center();
SPEAKER_SOUND(config, m_speaker).add_route(ALL_OUTPUTS, "mono", 0.25);
}
@@ -1671,12 +1681,14 @@ public:
hh_pic16_state(mconfig, type, tag)
{ }
+ void uspbball(machine_config &config);
+
+private:
void update_display();
void write_a(u8 data);
void write_b(u8 data);
void write_c(u8 data);
void write_d(u8 data);
- void uspbball(machine_config &config);
};
// handlers
@@ -1735,7 +1747,7 @@ INPUT_PORTS_END
void uspbball_state::uspbball(machine_config &config)
{
- /* basic machine hardware */
+ // basic machine hardware
PIC1650(config, m_maincpu, 900000); // approximation - RC osc. R=22K, C=47pF
m_maincpu->read_a().set_ioport("IN.0");
m_maincpu->write_a().set(FUNC(uspbball_state::write_a));
@@ -1749,12 +1761,12 @@ void uspbball_state::uspbball(machine_config &config)
// PIC CLKOUT, tied to RTCC
CLOCK(config, "clock", 900000/4).signal_handler().set_inputline("maincpu", PIC16C5x_RTCC);
- /* video hardware */
+ // video hardware
PWM_DISPLAY(config, m_display).set_size(6, 16);
m_display->set_segmask(7, 0x7f);
config.set_default_layout(layout_hh_pic16_test);
- /* sound hardware */
+ // sound hardware
SPEAKER(config, "mono").front_center();
SPEAKER_SOUND(config, m_speaker).add_route(ALL_OUTPUTS, "mono", 0.25);
}
@@ -1789,13 +1801,15 @@ public:
hh_pic16_state(mconfig, type, tag)
{ }
+ void us2pfball(machine_config &config);
+
+private:
void update_display();
u8 read_a();
void write_a(u8 data);
void write_b(u8 data);
void write_c(u8 data);
void write_d(u8 data);
- void us2pfball(machine_config &config);
};
// handlers
@@ -1877,7 +1891,7 @@ INPUT_PORTS_END
void us2pfball_state::us2pfball(machine_config &config)
{
- /* basic machine hardware */
+ // basic machine hardware
PIC1650(config, m_maincpu, 800000); // approximation - RC osc. R=39K, C=75pF
m_maincpu->read_a().set(FUNC(us2pfball_state::read_a));
m_maincpu->write_a().set(FUNC(us2pfball_state::write_a));
@@ -1891,12 +1905,12 @@ void us2pfball_state::us2pfball(machine_config &config)
// PIC CLKOUT, tied to RTCC
CLOCK(config, "clock", 800000/4).signal_handler().set_inputline("maincpu", PIC16C5x_RTCC);
- /* video hardware */
+ // video hardware
PWM_DISPLAY(config, m_display).set_size(10, 7);
m_display->set_segmask(0xff, 0x7f);
config.set_default_layout(layout_us2pfball);
- /* sound hardware */
+ // sound hardware
SPEAKER(config, "mono").front_center();
SPEAKER_SOUND(config, m_speaker).add_route(ALL_OUTPUTS, "mono", 0.25);
}