diff options
Diffstat (limited to 'src/mame/drivers/gamemachine.cpp')
-rw-r--r-- | src/mame/drivers/gamemachine.cpp | 75 |
1 files changed, 27 insertions, 48 deletions
diff --git a/src/mame/drivers/gamemachine.cpp b/src/mame/drivers/gamemachine.cpp index 5287e6e6dc0..ea4205c8f7f 100644 --- a/src/mame/drivers/gamemachine.cpp +++ b/src/mame/drivers/gamemachine.cpp @@ -10,7 +10,7 @@ It was possibly created by VTech, but they didn't distribute it by themselves until later in 1980 as the Computer Game System. There's also a handheld version "Mini Game Machine". VTech later made a sequel "Game Machine 2" with 5 games. -hardware notes: +Hardware notes: - Mostek MK3870 MCU, 2KB internal ROM - 12 digits 7seg VFD panel - MC1455P(555 timer) + bunch of discrete components for sound @@ -20,6 +20,9 @@ TODO: the MK3870 has an internal /2 divider, this is way too slow when compared to video references of the game +BTANB: +- some digit segments get stuck after crashing in the GP game + ******************************************************************************* After boot, press a number to start a game: @@ -58,13 +61,16 @@ Grand Prix: #include "emu.h" #include "cpu/f8/f8.h" +#include "video/pwm.h" #include "machine/f3853.h" -#include "machine/timer.h" #include "speaker.h" #include "machine/netlist.h" #include "netlist/devices/net_lib.h" + +// internal artwork #include "tgm.lh" + /* * Netlist below provided under Creative Commons CC0 */ @@ -156,13 +162,9 @@ public: tgm_state(const machine_config &mconfig, device_type type, const char *tag) : driver_device(mconfig, type, tag), m_maincpu(*this, "maincpu"), + m_display(*this, "display"), m_audio_pin(*this, "snd_nl:p%02u", 8U), - m_keypad(*this, "IN.%u", 0), - m_delay_display(*this, "delay_display_%u", 0), - m_out_digit(*this, "digit%u", 0U), - m_inp_mux(0), - m_digit_select(0), - m_digit_data(0) + m_inputs(*this, "IN.%u", 0) { } void tgm(machine_config &config); @@ -173,17 +175,14 @@ protected: private: // devices/pointers required_device<cpu_device> m_maincpu; + required_device<pwm_display_device> m_display; required_device_array<netlist_mame_logic_input_device, 8> m_audio_pin; - required_ioport_array<10> m_keypad; - required_device_array<timer_device, 12> m_delay_display; - output_finder<12> m_out_digit; + required_ioport_array<10> m_inputs; void main_map(address_map &map); void main_io(address_map &map); - TIMER_DEVICE_CALLBACK_MEMBER(delay_display); - - void update_display(u16 edge); + void update_display(); DECLARE_WRITE8_MEMBER(mux1_w); DECLARE_WRITE8_MEMBER(mux2_w); DECLARE_WRITE8_MEMBER(digit_w); @@ -197,8 +196,10 @@ private: void tgm_state::machine_start() { - // resolve handlers - m_out_digit.resolve(); + // zerofill + m_inp_mux = 0; + m_digit_select = 0; + m_digit_data = 0; // register for savestates save_item(NAME(m_inp_mux)); @@ -212,42 +213,22 @@ void tgm_state::machine_start() Devices, I/O ******************************************************************************/ -// display handling - -TIMER_DEVICE_CALLBACK_MEMBER(tgm_state::delay_display) -{ - // clear VFD outputs - if (!BIT(m_digit_select, param)) - m_out_digit[param] = 0; -} +// MK3870 ports -void tgm_state::update_display(u16 edge) +void tgm_state::update_display() { - for (int i = 0; i < 12; i++) - { - // output VFD digit data - if (BIT(m_digit_select, i)) - m_out_digit[i] = m_digit_data; - - // they're strobed, so on falling edge, delay them going off to prevent flicker or stuck display - // 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_delay_display[i]->adjust(attotime::from_msec(20), i); - } + // output VFD digit data + m_display->matrix(m_digit_select, m_digit_data); } - -// MK3870 ports - WRITE8_MEMBER(tgm_state::mux1_w) { // P00-P06: input mux part m_inp_mux = (m_inp_mux & 7) | (data << 3 & 0x3f8); // P00-P07: digit select part - u16 prev = m_digit_select; m_digit_select = (m_digit_select & 0xf) | (data << 4); - update_display(m_digit_select ^ prev); + update_display(); } WRITE8_MEMBER(tgm_state::mux2_w) @@ -256,16 +237,15 @@ WRITE8_MEMBER(tgm_state::mux2_w) m_inp_mux = (m_inp_mux & 0x3f8) | (data >> 5 & 7); // P14-P17: digit select part - u16 prev = m_digit_select; m_digit_select = (m_digit_select & 0xff0) | (data >> 4 & 0xf); - update_display(m_digit_select ^ prev); + update_display(); } WRITE8_MEMBER(tgm_state::digit_w) { // P50-P57: digit 7seg data m_digit_data = bitswap<8>(data,0,1,2,3,4,5,6,7); - update_display(0); + update_display(); } READ8_MEMBER(tgm_state::input_r) @@ -275,7 +255,7 @@ READ8_MEMBER(tgm_state::input_r) // P12,P13: multiplexed inputs for (int i = 0; i < 10; i++) if (m_inp_mux >> i & 1) - data |= m_keypad[i]->read(); + data |= m_inputs[i]->read(); return data << 2; } @@ -372,9 +352,8 @@ void tgm_state::tgm(machine_config &config) psu.write_b().set(FUNC(tgm_state::digit_w)); /* video hardware */ - for (int i = 0; i < 12; i++) - TIMER(config, m_delay_display[i]).configure_generic(FUNC(tgm_state::delay_display)); - + PWM_DISPLAY(config, m_display).set_size(12, 8); + m_display->set_segmask(0xfff, 0xff); config.set_default_layout(layout_tgm); /* sound hardware */ |