summaryrefslogtreecommitdiffstatshomepage
path: root/src/mame/drivers/gamemachine.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/mame/drivers/gamemachine.cpp')
-rw-r--r--src/mame/drivers/gamemachine.cpp52
1 files changed, 27 insertions, 25 deletions
diff --git a/src/mame/drivers/gamemachine.cpp b/src/mame/drivers/gamemachine.cpp
index ab5894d2b9d..1862f53f9af 100644
--- a/src/mame/drivers/gamemachine.cpp
+++ b/src/mame/drivers/gamemachine.cpp
@@ -40,6 +40,7 @@ TODO:
#include "tgm.lh"
+
namespace {
class tgm_state : public driver_device
@@ -49,7 +50,7 @@ public:
driver_device(mconfig, type, tag),
m_maincpu(*this, "maincpu"),
m_beeper(*this, "beeper"),
- m_vfd_delay(*this, "vfd_delay_%u", 0),
+ m_delay_display(*this, "delay_display_%u", 0),
m_inp_matrix(*this, "IN.%u", 0),
m_out_digit(*this, "digit%u", 0U)
{ }
@@ -63,26 +64,26 @@ private:
// devices/pointers
required_device<cpu_device> m_maincpu;
required_device<beep_device> m_beeper;
- required_device_array<timer_device, 12> m_vfd_delay;
+ required_device_array<timer_device, 12> m_delay_display;
required_ioport_array<10> m_inp_matrix;
output_finder<12> m_out_digit;
void main_map(address_map &map);
void main_io(address_map &map);
- TIMER_DEVICE_CALLBACK_MEMBER(vfd_delay_off);
+ TIMER_DEVICE_CALLBACK_MEMBER(delay_display);
- void display_update(u16 edge);
+ void update_display(u16 edge);
DECLARE_WRITE8_MEMBER(mux1_w);
DECLARE_WRITE8_MEMBER(mux2_w);
- DECLARE_WRITE8_MEMBER(_7seg_w);
+ DECLARE_WRITE8_MEMBER(digit_w);
DECLARE_READ8_MEMBER(input_r);
DECLARE_WRITE8_MEMBER(sound_w);
DECLARE_READ8_MEMBER(timer_r);
u16 m_inp_mux;
u16 m_digit_select;
- u8 m_7seg_data;
+ u8 m_digit_data;
};
void tgm_state::machine_start()
@@ -93,40 +94,41 @@ void tgm_state::machine_start()
// zerofill
m_inp_mux = 0;
m_digit_select = 0;
- m_7seg_data = 0;
+ m_digit_data = 0;
// register for savestates
save_item(NAME(m_inp_mux));
save_item(NAME(m_digit_select));
- save_item(NAME(m_7seg_data));
+ save_item(NAME(m_digit_data));
}
+
/******************************************************************************
Devices, I/O
******************************************************************************/
-// VFD handling
+// display handling
-TIMER_DEVICE_CALLBACK_MEMBER(tgm_state::vfd_delay_off)
+TIMER_DEVICE_CALLBACK_MEMBER(tgm_state::delay_display)
{
// clear VFD outputs
if (!BIT(m_digit_select, param))
m_out_digit[param] = 0;
}
-void tgm_state::display_update(u16 edge)
+void tgm_state::update_display(u16 edge)
{
for (int i = 0; i < 12; i++)
{
// output VFD digit data
if (BIT(m_digit_select, i))
- m_out_digit[i] = m_7seg_data;
+ m_out_digit[i] = m_digit_data;
// they're strobed, so on falling edge, delay them going off to prevent flicker
// BTANB: some digit segments get stuck after crashing in the GP game, it's not due to the simulated delay here
else if (BIT(edge, i))
- m_vfd_delay[i]->adjust(attotime::from_msec(20), i);
+ m_delay_display[i]->adjust(attotime::from_msec(20), i);
}
}
@@ -141,7 +143,7 @@ WRITE8_MEMBER(tgm_state::mux1_w)
// P00-P07: digit select part
u16 prev = m_digit_select;
m_digit_select = (m_digit_select & 0xf) | (data << 4);
- display_update(m_digit_select ^ prev);
+ update_display(m_digit_select ^ prev);
}
WRITE8_MEMBER(tgm_state::mux2_w)
@@ -152,14 +154,14 @@ WRITE8_MEMBER(tgm_state::mux2_w)
// P14-P17: digit select part
u16 prev = m_digit_select;
m_digit_select = (m_digit_select & 0xff0) | (data >> 4 & 0xf);
- display_update(m_digit_select ^ prev);
+ update_display(m_digit_select ^ prev);
}
-WRITE8_MEMBER(tgm_state::_7seg_w)
+WRITE8_MEMBER(tgm_state::digit_w)
{
// P50-P57: digit 7seg data
- m_7seg_data = bitswap<8>(data,0,1,2,3,4,5,6,7);
- display_update(0);
+ m_digit_data = bitswap<8>(data,0,1,2,3,4,5,6,7);
+ update_display(0);
}
READ8_MEMBER(tgm_state::input_r)
@@ -202,17 +204,17 @@ READ8_MEMBER(tgm_state::timer_r)
void tgm_state::main_map(address_map &map)
{
- map.global_mask(0x7ff);
+ map.global_mask(0x07ff);
map(0x0000, 0x07ff).rom();
}
void tgm_state::main_io(address_map &map)
{
- map(0x00, 0x00).w(FUNC(tgm_state::mux1_w));
- map(0x01, 0x01).rw(FUNC(tgm_state::input_r), FUNC(tgm_state::mux2_w));
- map(0x04, 0x04).w(FUNC(tgm_state::sound_w));
- map(0x05, 0x05).w(FUNC(tgm_state::_7seg_w));
- map(0x07, 0x07).r(FUNC(tgm_state::timer_r));
+ map(0x0, 0x0).w(FUNC(tgm_state::mux1_w));
+ map(0x1, 0x1).rw(FUNC(tgm_state::input_r), FUNC(tgm_state::mux2_w));
+ map(0x4, 0x4).w(FUNC(tgm_state::sound_w));
+ map(0x5, 0x5).w(FUNC(tgm_state::digit_w));
+ map(0x7, 0x7).r(FUNC(tgm_state::timer_r));
}
@@ -278,7 +280,7 @@ void tgm_state::tgm(machine_config &config)
/* video hardware */
for (int i = 0; i < 12; i++)
- TIMER(config, m_vfd_delay[i]).configure_generic(FUNC(tgm_state::vfd_delay_off));
+ TIMER(config, m_delay_display[i]).configure_generic(FUNC(tgm_state::delay_display));
config.set_default_layout(layout_tgm);