diff options
Diffstat (limited to 'src/mame/drivers/hh_cop400.cpp')
-rw-r--r-- | src/mame/drivers/hh_cop400.cpp | 140 |
1 files changed, 7 insertions, 133 deletions
diff --git a/src/mame/drivers/hh_cop400.cpp b/src/mame/drivers/hh_cop400.cpp index ff72e840fcf..8ea108057d7 100644 --- a/src/mame/drivers/hh_cop400.cpp +++ b/src/mame/drivers/hh_cop400.cpp @@ -17,8 +17,9 @@ ***************************************************************************/ #include "emu.h" -#include "cpu/cop400/cop400.h" +#include "includes/screenless.h" +#include "cpu/cop400/cop400.h" #include "machine/timer.h" #include "sound/spkrdev.h" #include "sound/dac.h" @@ -45,28 +46,19 @@ //#include "hh_cop400_test.lh" // common test-layout - use external artwork -class hh_cop400_state : public driver_device +class hh_cop400_state : public screenless_state { public: hh_cop400_state(const machine_config &mconfig, device_type type, const char *tag) : - driver_device(mconfig, type, tag), + screenless_state(mconfig, type, tag), m_maincpu(*this, "maincpu"), m_inp_matrix(*this, "IN.%u", 0), - m_out_x(*this, "%u.%u", 0U, 0U), - m_out_a(*this, "%u.a", 0U), - m_out_digit(*this, "digit%u", 0U), - m_speaker(*this, "speaker"), - m_display_wait(33), - m_display_maxy(1), - m_display_maxx(0) + m_speaker(*this, "speaker") { } // devices required_device<cop400_cpu_device> m_maincpu; optional_ioport_array<6> m_inp_matrix; // max 6 - output_finder<0x20, 0x20> m_out_x; - output_finder<0x20> m_out_a; - output_finder<0x20> m_out_digit; optional_device<speaker_sound_device> m_speaker; // misc common @@ -80,21 +72,6 @@ public: u16 read_inputs(int columns, u16 colmask = ~0); virtual DECLARE_INPUT_CHANGED_MEMBER(reset_button); - // display common - int m_display_wait; // led/lamp off-delay in milliseconds (default 33ms) - int m_display_maxy; // display matrix number of rows - int m_display_maxx; // display matrix number of columns (max 31 for now) - - u32 m_display_state[0x20]; // display matrix rows data (last bit is used for always-on) - u16 m_display_segmask[0x20]; // if not 0, display matrix row is a digit, mask indicates connected segments - u8 m_display_decay[0x20][0x20]; // (internal use) - - TIMER_DEVICE_CALLBACK_MEMBER(display_decay_tick); - void display_update(); - void set_display_size(int maxx, int maxy); - void set_display_segmask(u32 digits, u32 mask); - void display_matrix(int maxx, int maxy, u32 setx, u32 sety, bool update = true); - protected: virtual void machine_start() override; virtual void machine_reset() override; @@ -105,16 +82,9 @@ protected: void hh_cop400_state::machine_start() { - // resolve handlers - m_out_x.resolve(); - m_out_a.resolve(); - m_out_digit.resolve(); + screenless_state::machine_start(); // zerofill - memset(m_display_state, 0, sizeof(m_display_state)); - memset(m_display_decay, 0, sizeof(m_display_decay)); - memset(m_display_segmask, 0, sizeof(m_display_segmask)); - m_l = 0; m_g = 0; m_d = 0; @@ -123,14 +93,6 @@ void hh_cop400_state::machine_start() m_inp_mux = ~0; // register for savestates - save_item(NAME(m_display_maxy)); - save_item(NAME(m_display_maxx)); - save_item(NAME(m_display_wait)); - - save_item(NAME(m_display_state)); - save_item(NAME(m_display_decay)); - save_item(NAME(m_display_segmask)); - save_item(NAME(m_l)); save_item(NAME(m_g)); save_item(NAME(m_d)); @@ -151,80 +113,6 @@ void hh_cop400_state::machine_reset() ***************************************************************************/ -// The device may strobe the outputs very fast, it is unnoticeable to the user. -// To prevent flickering here, we need to simulate a decay. - -void hh_cop400_state::display_update() -{ - for (int y = 0; y < m_display_maxy; y++) - { - u32 active_state = 0; - - for (int x = 0; x <= m_display_maxx; x++) - { - // turn on powered segments - if (m_display_state[y] >> x & 1) - m_display_decay[y][x] = m_display_wait; - - // determine active state - u32 ds = (m_display_decay[y][x] != 0) ? 1 : 0; - active_state |= (ds << x); - - // output to y.x, or y.a when always-on - if (x != m_display_maxx) - m_out_x[y][x] = ds; - else - m_out_a[y] = ds; - } - - // output to digity - if (m_display_segmask[y] != 0) - m_out_digit[y] = active_state & m_display_segmask[y]; - } -} - -TIMER_DEVICE_CALLBACK_MEMBER(hh_cop400_state::display_decay_tick) -{ - // slowly turn off unpowered segments - for (int y = 0; y < m_display_maxy; y++) - for (int x = 0; x <= m_display_maxx; x++) - if (m_display_decay[y][x] != 0) - m_display_decay[y][x]--; - - display_update(); -} - -void hh_cop400_state::set_display_size(int maxx, int maxy) -{ - m_display_maxx = maxx; - m_display_maxy = maxy; -} - -void hh_cop400_state::set_display_segmask(u32 digits, u32 mask) -{ - // set a segment mask per selected digit, but leave unselected ones alone - for (int i = 0; i < 0x20; i++) - { - if (digits & 1) - m_display_segmask[i] = mask; - digits >>= 1; - } -} - -void hh_cop400_state::display_matrix(int maxx, int maxy, u32 setx, u32 sety, bool update) -{ - set_display_size(maxx, maxy); - - // update current state - u32 mask = (1 << maxx) - 1; - for (int y = 0; y < maxy; y++) - m_display_state[y] = (sety >> y & 1) ? ((setx & mask) | (1 << maxx)) : 0; - - if (update) - display_update(); -} - - // generic input handlers u16 hh_cop400_state::read_inputs(int columns, u16 colmask) @@ -332,7 +220,6 @@ void ctstein_state::ctstein(machine_config &config) m_maincpu->write_sk().set(m_speaker, FUNC(speaker_sound_device::level_w)); m_maincpu->read_l().set(FUNC(ctstein_state::read_l)); - TIMER(config, "display_decay").configure_periodic(FUNC(hh_cop400_state::display_decay_tick), attotime::from_msec(1)); config.set_default_layout(layout_ctstein); /* sound hardware */ @@ -409,9 +296,7 @@ WRITE8_MEMBER(h2hbaskbc_state::write_l) set_display_segmask(3, 0x7f); // L0-L6: digit segments A-G, L0-L4: led data - // strobe display display_matrix(7, 16, data, sel); - display_matrix(7, 16, 0, 0); } READ8_MEMBER(h2hbaskbc_state::read_in) @@ -482,7 +367,6 @@ void h2hbaskbc_state::h2hbaskbc(machine_config &config) m_maincpu->read_in().set(FUNC(h2hbaskbc_state::read_in)); m_maincpu->write_so().set(m_speaker, FUNC(speaker_sound_device::level_w)); - TIMER(config, "display_decay").configure_periodic(FUNC(hh_cop400_state::display_decay_tick), attotime::from_msec(1)); config.set_default_layout(layout_h2hbaskbc); /* sound hardware */ @@ -619,11 +503,10 @@ void einvaderc_state::einvaderc(machine_config &config) /* video hardware */ screen_device &screen(SCREEN(config, "screen", SCREEN_TYPE_SVG)); screen.set_svg_region("svg"); - screen.set_refresh_hz(50); + screen.set_refresh_hz(60); screen.set_size(913, 1080); screen.set_visarea_full(); - TIMER(config, "display_decay").configure_periodic(FUNC(hh_cop400_state::display_decay_tick), attotime::from_msec(1)); config.set_default_layout(layout_einvaderc); /* sound hardware */ @@ -751,7 +634,6 @@ void unkeinv_state::unkeinv(machine_config &config) m_maincpu->read_l_tristate().set_constant(0xff); m_maincpu->write_so().set(m_speaker, FUNC(speaker_sound_device::level_w)); - TIMER(config, "display_decay").configure_periodic(FUNC(hh_cop400_state::display_decay_tick), attotime::from_msec(1)); config.set_default_layout(layout_unkeinv); /* sound hardware */ @@ -914,7 +796,6 @@ void lchicken_state::lchicken(machine_config &config) m_maincpu->read_si().set(FUNC(lchicken_state::read_si)); TIMER(config, "chicken_motor").configure_periodic(FUNC(lchicken_state::motor_sim_tick), attotime::from_msec(6000/0x100)); // ~6sec for a full rotation - TIMER(config, "display_decay").configure_periodic(FUNC(hh_cop400_state::display_decay_tick), attotime::from_msec(1)); config.set_default_layout(layout_lchicken); /* sound hardware */ @@ -1028,7 +909,6 @@ void funjacks_state::funjacks(machine_config &config) m_maincpu->read_l().set(FUNC(funjacks_state::read_l)); m_maincpu->read_g().set(FUNC(funjacks_state::read_g)); - TIMER(config, "display_decay").configure_periodic(FUNC(hh_cop400_state::display_decay_tick), attotime::from_msec(1)); config.set_default_layout(layout_funjacks); /* sound hardware */ @@ -1121,7 +1001,6 @@ void funrlgl_state::funrlgl(machine_config &config) m_maincpu->write_g().set(FUNC(funrlgl_state::write_g)); m_maincpu->read_g().set_ioport("IN.0"); - TIMER(config, "display_decay").configure_periodic(FUNC(hh_cop400_state::display_decay_tick), attotime::from_msec(1)); config.set_default_layout(layout_funrlgl); /* sound hardware */ @@ -1263,7 +1142,6 @@ void mdallas_state::mdallas(machine_config &config) m_maincpu->read_in().set(FUNC(mdallas_state::read_in)); m_maincpu->write_so().set(m_speaker, FUNC(speaker_sound_device::level_w)); - TIMER(config, "display_decay").configure_periodic(FUNC(hh_cop400_state::display_decay_tick), attotime::from_msec(1)); config.set_default_layout(layout_mdallas); /* sound hardware */ @@ -1487,7 +1365,6 @@ void lightfgt_state::lightfgt(machine_config &config) m_maincpu->write_sk().set(m_speaker, FUNC(speaker_sound_device::level_w)); m_maincpu->read_g().set(FUNC(lightfgt_state::read_g)); - TIMER(config, "display_decay").configure_periodic(FUNC(hh_cop400_state::display_decay_tick), attotime::from_msec(1)); config.set_default_layout(layout_lightfgt); /* sound hardware */ @@ -1648,7 +1525,6 @@ void bship82_state::bship82(machine_config &config) m_maincpu->write_so().set(FUNC(bship82_state::write_so)); m_maincpu->read_si().set_ioport("IN.4"); - TIMER(config, "display_decay").configure_periodic(FUNC(hh_cop400_state::display_decay_tick), attotime::from_msec(1)); config.set_default_layout(layout_bship82); /* sound hardware */ @@ -1787,7 +1663,6 @@ void qkracer_state::qkracer(machine_config &config) m_maincpu->read_in().set(FUNC(qkracer_state::read_in)); m_maincpu->write_sk().set(FUNC(qkracer_state::write_sk)); - TIMER(config, "display_decay").configure_periodic(FUNC(hh_cop400_state::display_decay_tick), attotime::from_msec(1)); config.set_default_layout(layout_qkracer); /* no sound! */ @@ -1885,7 +1760,6 @@ void vidchal_state::vidchal(machine_config &config) m_maincpu->read_in().set_ioport("IN.0"); m_maincpu->write_sk().set(FUNC(vidchal_state::write_sk)); - TIMER(config, "display_decay").configure_periodic(FUNC(hh_cop400_state::display_decay_tick), attotime::from_msec(1)); config.set_default_layout(layout_vidchal); /* sound hardware */ |