misc hap devices: move variables init to device_start

This commit is contained in:
hap 2022-08-02 00:12:25 +02:00
parent 36404db064
commit 1525cc1ee3
23 changed files with 151 additions and 68 deletions

View File

@ -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));

View File

@ -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;

View File

@ -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));

View File

@ -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
};

View File

@ -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

View File

@ -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];
};

View File

@ -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;
}

View File

@ -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
{

View File

@ -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));

View File

@ -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;

View File

@ -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));

View File

@ -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;
int m_data_in;
int m_data_out;
int m_clk;
int m_load;
int m_lcd;
u32 m_shift = 0;
u32 m_latch = 0;
u32 m_shift;
u32 m_latch;
devcb_write32 m_write_segs;
devcb_write_line m_write_data;

View File

@ -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));

View File

@ -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));

View File

@ -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;

View File

@ -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));

View File

@ -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;
u8 m_x_beam_pos;
u8 m_y_beam_pos;
u8 m_control_status;
u8 m_collision_status;
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;
bool m_sh_written;
bool m_sh_pending;
u8 m_sh_prescaler;
u8 m_sh_count;
int m_sh_output;
u8 m_sh_duty;
};

View File

@ -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));

View File

@ -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_data;
int m_ce;
int m_clk;
bool m_blank;
int m_duty = 0;
int m_addsp = 0;
u64 m_shift = 0;
u64 m_latch[2] = { 0, 0 };
int m_duty;
int m_addsp;
u64 m_shift;
u64 m_latch[2];
// callbacks
devcb_write64 m_write_segs;

View File

@ -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));

View File

@ -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;

View File

@ -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));

View File

@ -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