skywriter: prevent class variable shadowing with m_display,

modular_tm: overclock lcd with set_clock_scale instead
This commit is contained in:
hap 2023-11-27 19:10:50 +01:00
parent 16edb038d7
commit c626209de7
2 changed files with 8 additions and 8 deletions

View File

@ -7463,7 +7463,7 @@ protected:
virtual void machine_start() override; virtual void machine_start() override;
private: private:
std::unique_ptr<u16[]> m_display; std::unique_ptr<u16[]> m_pixbuf;
u8 m_led_data[2] = { }; u8 m_led_data[2] = { };
u16 m_wand_pos[2] = { }; u16 m_wand_pos[2] = { };
attotime m_shake; attotime m_shake;
@ -7480,8 +7480,8 @@ void skywriter_state::machine_start()
{ {
hh_tms1k_state::machine_start(); hh_tms1k_state::machine_start();
m_display = make_unique_clear<u16[]>(7 * SKYWRITER_WIDTH); m_pixbuf = make_unique_clear<u16[]>(7 * SKYWRITER_WIDTH);
save_pointer(NAME(m_display), 7 * SKYWRITER_WIDTH); save_pointer(NAME(m_pixbuf), 7 * SKYWRITER_WIDTH);
save_item(NAME(m_led_data)); save_item(NAME(m_led_data));
save_item(NAME(m_wand_pos)); save_item(NAME(m_wand_pos));
@ -7498,7 +7498,7 @@ u32 skywriter_state::screen_update(screen_device &screen, bitmap_rgb32 &bitmap,
int dy = (i / SKYWRITER_WIDTH) * 4 + 1; int dy = (i / SKYWRITER_WIDTH) * 4 + 1;
// write current led state to pixels // write current led state to pixels
u8 red = std::clamp<u16>(m_display[i], 0, 0xff); u8 red = std::clamp<u16>(m_pixbuf[i], 0, 0xff);
u8 green = red / 16; u8 green = red / 16;
u8 blue = red / 12; u8 blue = red / 12;
@ -7510,7 +7510,7 @@ u32 skywriter_state::screen_update(screen_device &screen, bitmap_rgb32 &bitmap,
// decay led brightness // decay led brightness
const double rate = 1.15; const double rate = 1.15;
m_display[i] /= rate; m_pixbuf[i] /= rate;
} }
return 0; return 0;
@ -7530,11 +7530,11 @@ TIMER_DEVICE_CALLBACK_MEMBER(skywriter_state::check_pos)
m_wand_pos[0] = pos; m_wand_pos[0] = pos;
} }
// write lit leds to display // write lit leds to pixel buffer
for (int i = 0; i < 7; i++) for (int i = 0; i < 7; i++)
{ {
if (BIT(m_led_data[0] | m_led_data[1], i)) if (BIT(m_led_data[0] | m_led_data[1], i))
m_display[i * SKYWRITER_WIDTH + pos] = 0x180; m_pixbuf[i * SKYWRITER_WIDTH + pos] = 0x180;
} }
m_led_data[1] = m_led_data[0]; m_led_data[1] = m_led_data[0];

View File

@ -141,7 +141,7 @@ void mmtm_state::set_cpu_freq()
m_maincpu->set_unscaled_clock(xtal[val]); m_maincpu->set_unscaled_clock(xtal[val]);
// lcd busy flag timing problem when overclocked // lcd busy flag timing problem when overclocked
subdevice<hd44780_device>("display:hd44780")->set_clock((val > 1) ? 350'000 : 270'000); subdevice<hd44780_device>("display:hd44780")->set_clock_scale((val > 1) ? 1.32 : 1.0);
} }