From 1525cc1ee31eec9ae7fb68ca32fabcb5f1ee571c Mon Sep 17 00:00:00 2001 From: hap Date: Tue, 2 Aug 2022 00:12:25 +0200 Subject: misc hap devices: move variables init to device_start --- src/devices/machine/ds8874.cpp | 5 +++++ src/devices/machine/ds8874.h | 6 +++--- src/devices/machine/smartboard.cpp | 8 +++++++- src/devices/machine/smartboard.h | 10 +++++----- src/devices/machine/tmc0999.cpp | 6 ++++++ src/devices/machine/tmc0999.h | 10 +++++----- src/devices/video/ef9340_1.cpp | 2 ++ src/devices/video/ef9340_1.h | 4 ++-- src/devices/video/hd61603.cpp | 6 ++++++ src/devices/video/hd61603.h | 8 ++++---- src/devices/video/hlcd0438.cpp | 13 ++++++++++++- src/devices/video/hlcd0438.h | 16 ++++++++-------- src/devices/video/hlcd0488.cpp | 15 +++++++++++---- src/devices/video/hlcd0538.cpp | 6 ++++++ src/devices/video/hlcd0538.h | 8 ++++---- src/devices/video/i8244.cpp | 18 +++++++++++++++--- src/devices/video/i8244.h | 22 +++++++++++----------- src/devices/video/lc7582.cpp | 10 ++++++++++ src/devices/video/lc7582.h | 18 +++++++++--------- src/devices/video/pcf2100.cpp | 9 +++++++++ src/devices/video/pcf2100.h | 14 +++++++------- src/devices/video/sed1500.cpp | 7 +++++-- src/devices/video/sed1500.h | 4 ++-- 23 files changed, 154 insertions(+), 71 deletions(-) diff --git a/src/devices/machine/ds8874.cpp b/src/devices/machine/ds8874.cpp index f4d2f984e31..8b6003dcad3 100644 --- a/src/devices/machine/ds8874.cpp +++ b/src/devices/machine/ds8874.cpp @@ -39,6 +39,11 @@ void ds8874_device::device_start() // resolve callbacks m_write_output.resolve_safe(); + // zerofill + m_data = 0; + m_cp = 0; + m_shift = 0xff; + // register for savestates save_item(NAME(m_data)); save_item(NAME(m_cp)); diff --git a/src/devices/machine/ds8874.h b/src/devices/machine/ds8874.h index 686ed359080..444f15a020c 100644 --- a/src/devices/machine/ds8874.h +++ b/src/devices/machine/ds8874.h @@ -47,9 +47,9 @@ protected: private: void refresh_output(); - int m_data = 0; - int m_cp = 0; - u16 m_shift = 0xff; + int m_data; + int m_cp; + u16 m_shift; // callbacks devcb_write16 m_write_output; diff --git a/src/devices/machine/smartboard.cpp b/src/devices/machine/smartboard.cpp index 2e34c1ec241..ac18fd34534 100644 --- a/src/devices/machine/smartboard.cpp +++ b/src/devices/machine/smartboard.cpp @@ -89,7 +89,13 @@ void tasc_sb30_device::device_start() m_data_out.resolve_safe(); - std::fill(std::begin(m_squares), std::end(m_squares), 0); + // zerofill + m_data0 = 0; + m_data1 = 0; + m_output = 0; + m_scan_pending = false; + m_pos = 0; + std::fill_n(m_squares, std::size(m_squares), 0); // register for savestates save_item(NAME(m_data0)); diff --git a/src/devices/machine/smartboard.h b/src/devices/machine/smartboard.h index 27b48fe2820..cb87bc36966 100644 --- a/src/devices/machine/smartboard.h +++ b/src/devices/machine/smartboard.h @@ -47,13 +47,13 @@ private: u8 spawn_cb(offs_t offset); // i/o lines - int m_data0 = 0; - int m_data1 = 0; - int m_output = 0; + int m_data0; + int m_data1; + int m_output; // internal use - bool m_scan_pending = false; - u32 m_pos = 0; + bool m_scan_pending; + u32 m_pos; u32 m_squares[64]; // board state }; diff --git a/src/devices/machine/tmc0999.cpp b/src/devices/machine/tmc0999.cpp index d93127499f1..e270e871524 100644 --- a/src/devices/machine/tmc0999.cpp +++ b/src/devices/machine/tmc0999.cpp @@ -34,6 +34,12 @@ tmc0999_device::tmc0999_device(const machine_config &mconfig, const char *tag, d void tmc0999_device::device_start() { + // zerofill + m_data = 0; + m_wr = 0; + m_rd = 0; + m_adr_strobe = 0; + m_ram_address = 0; memset(m_ram, 0, sizeof(m_ram)); // register for savestates diff --git a/src/devices/machine/tmc0999.h b/src/devices/machine/tmc0999.h index 12bffe1d6f3..24305b8d8ee 100644 --- a/src/devices/machine/tmc0999.h +++ b/src/devices/machine/tmc0999.h @@ -41,13 +41,13 @@ protected: private: // input pins state - u8 m_data = 0; - int m_wr = 0; - int m_rd = 0; - int m_adr_strobe = 0; + u8 m_data; + int m_wr; + int m_rd; + int m_adr_strobe; // internal state - u8 m_ram_address = 0; + u8 m_ram_address; u8 m_ram[0x100]; }; diff --git a/src/devices/video/ef9340_1.cpp b/src/devices/video/ef9340_1.cpp index c59be4cc611..deb26990e16 100644 --- a/src/devices/video/ef9340_1.cpp +++ b/src/devices/video/ef9340_1.cpp @@ -42,6 +42,8 @@ ef9340_1_device::ef9340_1_device(const machine_config &mconfig, const char *tag, , m_write_exram(*this) , m_read_exram(*this) { + m_offset_x = 0; + m_offset_y = 0; } diff --git a/src/devices/video/ef9340_1.h b/src/devices/video/ef9340_1.h index aca7b767203..ec7e41d16de 100644 --- a/src/devices/video/ef9340_1.h +++ b/src/devices/video/ef9340_1.h @@ -84,8 +84,8 @@ protected: bitmap_ind16 m_tmp_bitmap; - int m_offset_x = 0; - int m_offset_y = 0; + int m_offset_x; + int m_offset_y; struct { diff --git a/src/devices/video/hd61603.cpp b/src/devices/video/hd61603.cpp index 70864d49272..49a21cc779b 100644 --- a/src/devices/video/hd61603.cpp +++ b/src/devices/video/hd61603.cpp @@ -38,6 +38,12 @@ void hd61603_device::device_start() // resolve callbacks m_write_segs.resolve_safe(); + // zerofill + m_blank = 0; + m_count = 0; + m_data = 0; + m_ram = 0; + // register for savestates save_item(NAME(m_blank)); save_item(NAME(m_count)); diff --git a/src/devices/video/hd61603.h b/src/devices/video/hd61603.h index 5b4d31e5ec7..8de7c879761 100644 --- a/src/devices/video/hd61603.h +++ b/src/devices/video/hd61603.h @@ -50,10 +50,10 @@ protected: virtual void device_reset() override; private: - u8 m_count = 0; - u16 m_data = 0; - u64 m_ram = 0; - int m_blank = 0; + u8 m_count; + u16 m_data; + u64 m_ram; + int m_blank; // callbacks devcb_write64 m_write_segs; diff --git a/src/devices/video/hlcd0438.cpp b/src/devices/video/hlcd0438.cpp index fadc164dcb6..64f95711c8b 100644 --- a/src/devices/video/hlcd0438.cpp +++ b/src/devices/video/hlcd0438.cpp @@ -22,7 +22,9 @@ DEFINE_DEVICE_TYPE(HLCD0438, hlcd0438_device, "hlcd0438", "Hughes HLCD 0438 LCD hlcd0438_device::hlcd0438_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock) : device_t(mconfig, HLCD0438, tag, owner, clock), m_write_segs(*this), m_write_data(*this) -{ } +{ + m_load = 0; +} //------------------------------------------------- @@ -40,6 +42,15 @@ void hlcd0438_device::device_start() attotime period = (clock() != 0) ? attotime::from_hz(2 * clock()) : attotime::never; m_lcd_timer->adjust(period, 0, period); + // zerofill + m_data_in = 0; + m_data_out = 0; + m_clk = 0; + // m_load // not here + m_lcd = 0; + m_shift = 0; + m_latch = 0; + // register for savestates save_item(NAME(m_data_in)); save_item(NAME(m_data_out)); diff --git a/src/devices/video/hlcd0438.h b/src/devices/video/hlcd0438.h index da6da51da39..19973dd8451 100644 --- a/src/devices/video/hlcd0438.h +++ b/src/devices/video/hlcd0438.h @@ -65,14 +65,14 @@ private: emu_timer *m_lcd_timer; // pin state - int m_data_in = 0; - int m_data_out = 0; - int m_clk = 0; - int m_load = 0; - int m_lcd = 0; - - u32 m_shift = 0; - u32 m_latch = 0; + int m_data_in; + int m_data_out; + int m_clk; + int m_load; + int m_lcd; + + u32 m_shift; + u32 m_latch; devcb_write32 m_write_segs; devcb_write_line m_write_data; diff --git a/src/devices/video/hlcd0488.cpp b/src/devices/video/hlcd0488.cpp index 98ab3937f54..7c5d7eb4c99 100644 --- a/src/devices/video/hlcd0488.cpp +++ b/src/devices/video/hlcd0488.cpp @@ -24,10 +24,7 @@ DEFINE_DEVICE_TYPE(HLCD0488, hlcd0488_device, "hlcd0488", "Hughes HLCD 0488 LCD hlcd0488_device::hlcd0488_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock) : device_t(mconfig, HLCD0488, tag, owner, clock), m_write_cols(*this) -{ - memset(m_latch, 0, 8); - memset(m_hold, 0, 8); -} +{ } //------------------------------------------------- @@ -39,6 +36,16 @@ void hlcd0488_device::device_start() m_write_cols.resolve_safe(); m_sync_timer = timer_alloc(FUNC(hlcd0488_device::sync_update), this); + // zerofill + m_latch_pulse = 0; + m_latch_pulse_prev = 0; + m_data_clk = 0; + m_data_clk_prev = 0; + m_data = 0; + m_count = 0; + std::fill_n(m_latch, std::size(m_latch), 0); + std::fill_n(m_hold, std::size(m_hold), 0); + // register for savestates save_item(NAME(m_latch_pulse)); save_item(NAME(m_latch_pulse_prev)); diff --git a/src/devices/video/hlcd0538.cpp b/src/devices/video/hlcd0538.cpp index 3cf1fd4a6f6..314644bcfd4 100644 --- a/src/devices/video/hlcd0538.cpp +++ b/src/devices/video/hlcd0538.cpp @@ -55,6 +55,12 @@ void hlcd0538_device::device_start() attotime period = (clock() != 0) ? attotime::from_hz(2 * clock()) : attotime::never; m_lcd_timer->adjust(period, 0, period); + // zerofill + m_lcd = 0; + m_clk = 0; + m_data = 0; + m_shift = 0; + // register for savestates save_item(NAME(m_lcd)); save_item(NAME(m_clk)); diff --git a/src/devices/video/hlcd0538.h b/src/devices/video/hlcd0538.h index 08a2f8ef437..add8e0e3028 100644 --- a/src/devices/video/hlcd0538.h +++ b/src/devices/video/hlcd0538.h @@ -63,10 +63,10 @@ protected: emu_timer *m_lcd_timer; - int m_lcd = 0; - int m_clk = 0; - int m_data = 0; - u64 m_shift = 0; + int m_lcd; + int m_clk; + int m_data; + u64 m_shift; // callbacks devcb_write64 m_write_cols; diff --git a/src/devices/video/i8244.cpp b/src/devices/video/i8244.cpp index bea7014d9ad..622d5c056df 100644 --- a/src/devices/video/i8244.cpp +++ b/src/devices/video/i8244.cpp @@ -162,12 +162,24 @@ void i8244_device::device_start() // allocate a stream m_stream = stream_alloc(0, 1, clock()); - // register our state + // zerofill memset(m_vdc.reg, 0, 0x100); - save_pointer(NAME(m_vdc.reg), 0x100); - memset(m_collision_map, 0, sizeof(m_collision_map)); memset(m_priority_map, 0, sizeof(m_priority_map)); + + m_x_beam_pos = 0; + m_y_beam_pos = 0; + m_control_status = 0; + m_collision_status = 0; + m_sh_written = false; + m_sh_pending = false; + m_sh_prescaler = 0; + m_sh_count = 0; + m_sh_output = 0; + m_sh_duty = 0; + + // register our state + save_pointer(NAME(m_vdc.reg), 0x100); save_item(NAME(m_collision_map)); save_item(NAME(m_priority_map)); diff --git a/src/devices/video/i8244.h b/src/devices/video/i8244.h index f87382fa461..9514f36deb5 100644 --- a/src/devices/video/i8244.h +++ b/src/devices/video/i8244.h @@ -159,17 +159,17 @@ protected: u8 m_collision_map[0x200]; u8 m_priority_map[0x200]; - u8 m_x_beam_pos = 0; - u8 m_y_beam_pos = 0; - u8 m_control_status = 0; - u8 m_collision_status = 0; - - bool m_sh_written = false; - bool m_sh_pending = false; - u8 m_sh_prescaler = 0; - u8 m_sh_count = 0; - int m_sh_output = 0; - u8 m_sh_duty = 0; + u8 m_x_beam_pos; + u8 m_y_beam_pos; + u8 m_control_status; + u8 m_collision_status; + + bool m_sh_written; + bool m_sh_pending; + u8 m_sh_prescaler; + u8 m_sh_count; + int m_sh_output; + u8 m_sh_duty; }; diff --git a/src/devices/video/lc7582.cpp b/src/devices/video/lc7582.cpp index 2c8627bb945..f576d97ea20 100644 --- a/src/devices/video/lc7582.cpp +++ b/src/devices/video/lc7582.cpp @@ -37,6 +37,16 @@ void lc7582_device::device_start() // resolve callbacks m_write_segs.resolve_safe(); + // zerofill + m_data = 0; + m_ce = 0; + m_clk = 0; + m_blank = false; + m_duty = 0; + m_addsp = 0; + m_shift = 0; + std::fill_n(m_latch, std::size(m_latch), 0); + // register for savestates save_item(NAME(m_data)); save_item(NAME(m_ce)); diff --git a/src/devices/video/lc7582.h b/src/devices/video/lc7582.h index 5f632710f1d..3f8dcc22bc6 100644 --- a/src/devices/video/lc7582.h +++ b/src/devices/video/lc7582.h @@ -51,15 +51,15 @@ protected: private: void refresh_output(); - int m_data = 0; - int m_ce = 0; - int m_clk = 0; - bool m_blank = false; - - int m_duty = 0; - int m_addsp = 0; - u64 m_shift = 0; - u64 m_latch[2] = { 0, 0 }; + int m_data; + int m_ce; + int m_clk; + bool m_blank; + + int m_duty; + int m_addsp; + u64 m_shift; + u64 m_latch[2]; // callbacks devcb_write64 m_write_segs; diff --git a/src/devices/video/pcf2100.cpp b/src/devices/video/pcf2100.cpp index 7cdcd044c6f..ae686b98b1a 100644 --- a/src/devices/video/pcf2100.cpp +++ b/src/devices/video/pcf2100.cpp @@ -63,6 +63,15 @@ void pcf2100_device::device_start() attotime period = attotime::from_hz(clock()); m_lcd_timer->adjust(period, 0, period); + // zerofill + m_shift = 0; + m_count = 0; + m_bpout = 0; + std::fill_n(m_latch, std::size(m_latch), 0); + m_clb = 0; + m_data = 0; + m_dlen = 0; + // register for savestates save_item(NAME(m_shift)); save_item(NAME(m_count)); diff --git a/src/devices/video/pcf2100.h b/src/devices/video/pcf2100.h index c4e657fef19..1d0963b2896 100644 --- a/src/devices/video/pcf2100.h +++ b/src/devices/video/pcf2100.h @@ -54,15 +54,15 @@ protected: const u8 m_bpmax; // number of BP pins const u8 m_smax; // number of S pins - u64 m_shift = 0; - u8 m_count = 0; - u8 m_bpout = 0; - u32 m_latch[2] = { 0, 0 }; + u64 m_shift; + u8 m_count; + u8 m_bpout; + u32 m_latch[2]; // pin state - int m_clb = 0; - int m_data = 0; - int m_dlen = 0; + int m_clb; + int m_data; + int m_dlen; // callbacks devcb_write32 m_write_segs; diff --git a/src/devices/video/sed1500.cpp b/src/devices/video/sed1500.cpp index 57f7a026e4c..41ade315d56 100644 --- a/src/devices/video/sed1500.cpp +++ b/src/devices/video/sed1500.cpp @@ -63,8 +63,6 @@ sed1503_device::sed1503_device(const machine_config &mconfig, const char *tag, d void sed1500_device::device_start() { - memset(m_ram, 0, sizeof(m_ram)); - // resolve callbacks m_write_segs.resolve_safe(); @@ -73,6 +71,11 @@ void sed1500_device::device_start() attotime period = attotime::from_hz(clock() / 64); m_lcd_timer->adjust(period, 0, period); + // zerofill + m_mode = 0; + m_cout = 0; + std::fill_n(m_ram, std::size(m_ram), 0); + // register for savestates save_item(NAME(m_mode)); save_item(NAME(m_cout)); diff --git a/src/devices/video/sed1500.h b/src/devices/video/sed1500.h index 21981c35034..a72e124f772 100644 --- a/src/devices/video/sed1500.h +++ b/src/devices/video/sed1500.h @@ -51,8 +51,8 @@ protected: const u8 m_cmax; // number of COL pins const u8 m_smax; // number of SEG pins - u8 m_mode = 0; - u8 m_cout = 0; + u8 m_mode; + u8 m_cout; u8 m_ram[0x80]; // callbacks -- cgit v1.2.3