Fixed a few class memory access warnings.

This commit is contained in:
Vas Crabb 2024-04-22 02:30:17 +10:00
parent d27a148fa3
commit d7f8adbce1
25 changed files with 204 additions and 204 deletions

View File

@ -38,6 +38,8 @@
#include "emu.h" #include "emu.h"
#include "cc500.h" #include "cc500.h"
#include <algorithm>
//************************************************************************** //**************************************************************************
// DEVICE DEFINITIONS // DEVICE DEFINITIONS
@ -110,9 +112,9 @@ bbc_cc500_device::bbc_cc500_device(const machine_config &mconfig, const char *ta
void bbc_cc500_device::device_start() void bbc_cc500_device::device_start()
{ {
memset(m_palette_ram, 0, sizeof(m_palette_ram)); std::fill(std::begin(m_palette_ram), std::end(m_palette_ram), rgb_t(0));
/* register for save states */ // register for save states
save_item(NAME(m_palette_ram)); save_item(NAME(m_palette_ram));
} }

View File

@ -16,6 +16,9 @@
#include "emu.h" #include "emu.h"
#include "palext.h" #include "palext.h"
#include <algorithm>
//************************************************************************** //**************************************************************************
// DEVICE DEFINITIONS // DEVICE DEFINITIONS
//************************************************************************** //**************************************************************************
@ -76,9 +79,9 @@ bbc_cpalette_device::bbc_cpalette_device(const machine_config &mconfig, const ch
void bbc_palext_device::device_start() void bbc_palext_device::device_start()
{ {
memset(m_palette_ram, 0, sizeof(m_palette_ram)); std::fill(std::begin(m_palette_ram), std::end(m_palette_ram), rgb_t(0));
/* register for save states */ // register for save states
save_item(NAME(m_colour)); save_item(NAME(m_colour));
save_item(NAME(m_palette_ram)); save_item(NAME(m_palette_ram));
} }

View File

@ -72,7 +72,6 @@ c64h156_device::c64h156_device(const machine_config &mconfig, const char *tag, d
m_atni(0), m_atni(0),
m_atna(0) m_atna(0)
{ {
memset(&cur_live, 0x00, sizeof(cur_live));
cur_live.tm = attotime::never; cur_live.tm = attotime::never;
cur_live.state = IDLE; cur_live.state = IDLE;
cur_live.next_state = -1; cur_live.next_state = -1;

View File

@ -117,28 +117,28 @@ private:
struct live_info { struct live_info {
attotime tm; attotime tm;
int state, next_state; int state = 0, next_state = 0;
int sync; int sync = 0;
int byte; int byte = 0;
int ds; int ds = 0;
int oe; int oe = 0;
int soe; int soe = 0;
int accl; int accl = 0;
uint8_t accl_yb; uint8_t accl_yb = 0;
attotime edge; attotime edge;
uint16_t shift_reg; uint16_t shift_reg = 0;
int cycle_counter; int cycle_counter = 0;
int cell_counter; int cell_counter = 0;
int bit_counter; int bit_counter = 0;
int zero_counter; int zero_counter = 0;
int cycles_until_random_flux; int cycles_until_random_flux = 0;
uint8_t yb; uint8_t yb = 0;
uint8_t shift_reg_write; uint8_t shift_reg_write = 0;
attotime write_start_time; attotime write_start_time;
attotime write_buffer[32]; attotime write_buffer[32];
int write_position; int write_position = 0;
}; };
devcb_write_line m_write_atn; devcb_write_line m_write_atn;

View File

@ -163,27 +163,27 @@ void vertigo_state::vertigo_vproc_reset()
/* Decode microcode */ /* Decode microcode */
for (int i = 0; i < MC_LENGTH; i++) for (int i = 0; i < MC_LENGTH; i++)
{ {
m_mc[i].x = (mcode[i] >> 44) & 0x3f; m_mc[i].x = BIT(mcode[i], 44, 6);
m_mc[i].a = (mcode[i] >> 40) & 0xf; m_mc[i].a = BIT(mcode[i], 40, 4);
m_mc[i].b = (mcode[i] >> 36) & 0xf; m_mc[i].b = BIT(mcode[i], 36, 4);
m_mc[i].inst = (mcode[i] >> 27) & 077; m_mc[i].inst = BIT(mcode[i], 27, 6);
m_mc[i].dest = (mcode[i] >> 33) & 07; m_mc[i].dest = BIT(mcode[i], 33, 3);
m_mc[i].cn = (mcode[i] >> 26) & 0x1; m_mc[i].cn = BIT(mcode[i], 26, 1);
m_mc[i].mreq = (mcode[i] >> 25) & 0x1; m_mc[i].mreq = BIT(mcode[i], 25, 1);
m_mc[i].rwrite = (mcode[i] >> 23) & 0x1; m_mc[i].rwrite = BIT(mcode[i], 23, 1);
m_mc[i].rsel = m_mc[i].rwrite & ((mcode[i] >> 24) & 0x1); m_mc[i].rsel = BIT(mcode[i], 24, 1) & m_mc[i].rwrite;
m_mc[i].of = (mcode[i] >> 20) & 0x7; m_mc[i].of = BIT(mcode[i], 20, 3);
m_mc[i].iif = (mcode[i] >> 18) & 0x3; m_mc[i].iif = BIT(mcode[i], 18, 2);
m_mc[i].oa = (mcode[i] >> 16) & 0x3; m_mc[i].oa = BIT(mcode[i], 16, 2);
m_mc[i].jpos = (mcode[i] >> 14) & 0x1; m_mc[i].jpos = BIT(mcode[i], 14, 1);
m_mc[i].jmp = (mcode[i] >> 12) & 0x3; m_mc[i].jmp = BIT(mcode[i], 12, 2);
m_mc[i].jcon = (mcode[i] >> 9) & 0x7; m_mc[i].jcon = BIT(mcode[i], 9, 3);
m_mc[i].ma = mcode[i] & 0x1ff; m_mc[i].ma = BIT(mcode[i], 0, 9);
} }
memset(&m_vs, 0, sizeof(m_vs)); m_vs = vproc();
memset(&m_bsp, 0, sizeof(m_bsp)); m_bsp = am2901();
memset(&m_vgen, 0, sizeof(m_vgen)); m_vgen = vector_generator();
} }

View File

@ -70,13 +70,13 @@ private:
/* microcode state */ /* microcode state */
struct micro_t struct micro_t
{ {
uint16_t i; uint16_t i = 0;
uint16_t pc; uint16_t pc = 0;
uint8_t r,g,b; uint8_t r = 0, g = 0, b = 0;
uint8_t xp,yp; uint8_t xp = 0, yp = 0;
uint8_t cmd,cmdlo; uint8_t cmd = 0, cmdlo = 0;
emu_timer * timer; emu_timer * timer = nullptr;
uint8_t timer_active; uint8_t timer_active = 0;
attotime endtime; attotime endtime;
void count_states(int states); void count_states(int states);

View File

@ -49,7 +49,7 @@ void victory_state::video_start()
m_scrollx = m_scrolly = 0; m_scrollx = m_scrolly = 0;
m_video_control = 0; m_video_control = 0;
memset(&m_micro, 0, sizeof(m_micro)); m_micro = micro_t();
m_micro.timer = machine().scheduler().timer_alloc(timer_expired_delegate()); m_micro.timer = machine().scheduler().timer_alloc(timer_expired_delegate());
for (int i = 0; i < 128; i++) for (int i = 0; i < 128; i++)

View File

@ -71,7 +71,7 @@ private:
struct SPRITE struct SPRITE
{ {
const SPRITE_HELPER *data; const SPRITE_HELPER *data = nullptr;
int mask = 0; int mask = 0;
int state = 0; int state = 0;
int delay = 0; int delay = 0;

View File

@ -623,13 +623,13 @@ private:
uint32_t eicr = 0U; uint32_t eicr = 0U;
uint32_t svr = 0U; uint32_t svr = 0U;
uint8_t pctpr = 0xfU; uint8_t pctpr = 0x0U;
int active_irq = 0; int active_irq = 0;
MPC8240_IRQ irq[MPC8240_NUM_INTERRUPTS]{}; MPC8240_IRQ irq[MPC8240_NUM_INTERRUPTS];
MPC8240_GLOBAL_TIMER global_timer[4]{}; MPC8240_GLOBAL_TIMER global_timer[4];
}; };
MPC8240_EPIC m_epic{}; MPC8240_EPIC m_epic{};
@ -1238,7 +1238,7 @@ void viper_state::mpc8240_interrupt(int irq)
void viper_state::mpc8240_epic_init() void viper_state::mpc8240_epic_init()
{ {
memset(&m_epic, 0, sizeof(m_epic)); m_epic = MPC8240_EPIC();
m_epic.global_timer[0].timer = timer_alloc(FUNC(viper_state::epic_global_timer_callback), this); m_epic.global_timer[0].timer = timer_alloc(FUNC(viper_state::epic_global_timer_callback), this);
m_epic.global_timer[1].timer = timer_alloc(FUNC(viper_state::epic_global_timer_callback), this); m_epic.global_timer[1].timer = timer_alloc(FUNC(viper_state::epic_global_timer_callback), this);
m_epic.global_timer[2].timer = timer_alloc(FUNC(viper_state::epic_global_timer_callback), this); m_epic.global_timer[2].timer = timer_alloc(FUNC(viper_state::epic_global_timer_callback), this);

View File

@ -166,12 +166,12 @@ protected:
/* VDP1 */ /* VDP1 */
void stv_set_framebuffer_config( void ); void stv_set_framebuffer_config();
void stv_prepare_framebuffers( void ); void stv_prepare_framebuffers();
void stv_vdp1_change_framebuffers( void ); void stv_vdp1_change_framebuffers();
void video_update_vdp1( void ); void video_update_vdp1();
void stv_vdp1_process_list( void ); void stv_vdp1_process_list();
void stv_vdp1_set_drawpixel( void ); void stv_vdp1_set_drawpixel();
void stv_vdp1_draw_normal_sprite(const rectangle &cliprect, int sprite_type); void stv_vdp1_draw_normal_sprite(const rectangle &cliprect, int sprite_type);
void stv_vdp1_draw_scaled_sprite(const rectangle &cliprect); void stv_vdp1_draw_scaled_sprite(const rectangle &cliprect);
@ -202,14 +202,14 @@ protected:
int32_t g1, int32_t g2, int32_t slg1, int32_t slg2, int32_t *ng1, int32_t *ng2, int32_t g1, int32_t g2, int32_t slg1, int32_t slg2, int32_t *ng1, int32_t *ng2,
int32_t b1, int32_t b2, int32_t slb1, int32_t slb2, int32_t *nb1, int32_t *nb2, int32_t b1, int32_t b2, int32_t slb1, int32_t slb2, int32_t *nb1, int32_t *nb2,
int32_t _y1, int32_t y2); int32_t _y1, int32_t y2);
uint16_t stv_vdp1_apply_gouraud_shading( int x, int y, uint16_t pix ); uint16_t stv_vdp1_apply_gouraud_shading(int x, int y, uint16_t pix);
void stv_vdp1_setup_shading(const struct spoint* q, const rectangle &cliprect); void stv_vdp1_setup_shading(const struct spoint* q, const rectangle &cliprect);
uint8_t stv_read_gouraud_table( void ); uint8_t stv_read_gouraud_table();
void stv_clear_gouraud_shading(void); void stv_clear_gouraud_shading();
void stv_clear_framebuffer( int which_framebuffer ); void stv_clear_framebuffer(int which_framebuffer);
void stv_vdp1_state_save_postload( void ); void stv_vdp1_state_save_postload();
int stv_vdp1_start ( void ); int stv_vdp1_start();
struct stv_vdp1_poly_scanline struct stv_vdp1_poly_scanline
{ {
@ -263,19 +263,19 @@ protected:
/* VDP2 */ /* VDP2 */
uint8_t get_vblank( void ); uint8_t get_vblank();
uint8_t get_hblank( void ); uint8_t get_hblank();
int get_hcounter( void ); int get_hcounter();
int get_vcounter( void ); int get_vcounter();
int get_vblank_duration( void ); int get_vblank_duration();
int get_hblank_duration( void ); int get_hblank_duration();
int get_pixel_clock( void ); int get_pixel_clock();
uint8_t get_odd_bit( void ); uint8_t get_odd_bit();
void stv_vdp2_dynamic_res_change( void ); void stv_vdp2_dynamic_res_change();
int get_vblank_start_position( void ); int get_vblank_start_position();
int get_ystep_count( void ); int get_ystep_count();
void refresh_palette_data( void ); void refresh_palette_data();
inline int stv_vdp2_window_process(int x,int y); inline int stv_vdp2_window_process(int x,int y);
void stv_vdp2_get_window0_coordinates(int *s_x, int *e_x, int *s_y, int *e_y, int y); void stv_vdp2_get_window0_coordinates(int *s_x, int *e_x, int *s_y, int *e_y, int y);
void stv_vdp2_get_window1_coordinates(int *s_x, int *e_x, int *s_y, int *e_y, int y); void stv_vdp2_get_window1_coordinates(int *s_x, int *e_x, int *s_y, int *e_y, int y);
@ -292,8 +292,8 @@ protected:
void stv_vdp2_drawgfxzoom(bitmap_rgb32 &dest_bmp,const rectangle &clip,gfx_element *gfx, uint32_t code,uint32_t color,int flipx,int flipy,int sx,int sy,int transparency,int scalex, int scaley,int sprite_screen_width, int sprite_screen_height, int alpha); void stv_vdp2_drawgfxzoom(bitmap_rgb32 &dest_bmp,const rectangle &clip,gfx_element *gfx, uint32_t code,uint32_t color,int flipx,int flipy,int sx,int sy,int transparency,int scalex, int scaley,int sprite_screen_width, int sprite_screen_height, int alpha);
void stv_vdp2_drawgfxzoom_rgb555(bitmap_rgb32 &dest_bmp,const rectangle &clip,uint32_t code,uint32_t color,int flipx,int flipy,int sx,int sy,int transparency,int scalex, int scaley,int sprite_screen_width, int sprite_screen_height, int alpha); void stv_vdp2_drawgfxzoom_rgb555(bitmap_rgb32 &dest_bmp,const rectangle &clip,uint32_t code,uint32_t color,int flipx,int flipy,int sx,int sy,int transparency,int scalex, int scaley,int sprite_screen_width, int sprite_screen_height, int alpha);
void stv_vdp2_drawgfx_rgb555( bitmap_rgb32 &dest_bmp, const rectangle &clip, uint32_t code, int flipx, int flipy, int sx, int sy, int transparency, int alpha); void stv_vdp2_drawgfx_rgb555(bitmap_rgb32 &dest_bmp, const rectangle &clip, uint32_t code, int flipx, int flipy, int sx, int sy, int transparency, int alpha);
void stv_vdp2_drawgfx_rgb888( bitmap_rgb32 &dest_bmp, const rectangle &clip, uint32_t code, int flipx, int flipy, int sx, int sy, int transparency, int alpha); void stv_vdp2_drawgfx_rgb888(bitmap_rgb32 &dest_bmp, const rectangle &clip, uint32_t code, int flipx, int flipy, int sx, int sy, int transparency, int alpha);
void stv_vdp2_drawgfx_alpha(bitmap_rgb32 &dest_bmp,const rectangle &clip,gfx_element *gfx, uint32_t code,uint32_t color, int flipx,int flipy,int offsx,int offsy, int transparency, int alpha); void stv_vdp2_drawgfx_alpha(bitmap_rgb32 &dest_bmp,const rectangle &clip,gfx_element *gfx, uint32_t code,uint32_t color, int flipx,int flipy,int offsx,int offsy, int transparency, int alpha);
void stv_vdp2_drawgfx_transpen(bitmap_rgb32 &dest_bmp,const rectangle &clip,gfx_element *gfx, uint32_t code,uint32_t color, int flipx,int flipy,int offsx,int offsy, int transparency); void stv_vdp2_drawgfx_transpen(bitmap_rgb32 &dest_bmp,const rectangle &clip,gfx_element *gfx, uint32_t code,uint32_t color, int flipx,int flipy,int offsx,int offsy, int transparency);
@ -306,17 +306,17 @@ protected:
inline bool stv_vdp2_roz_window(int x, int y); inline bool stv_vdp2_roz_window(int x, int y);
inline bool stv_vdp2_roz_mode3_window(int x, int y, int rot_parameter); inline bool stv_vdp2_roz_mode3_window(int x, int y, int rot_parameter);
inline int get_roz_window_pixel(int s_x,int e_x,int s_y,int e_y,int x, int y,uint8_t winenable,uint8_t winarea); inline int get_roz_window_pixel(int s_x,int e_x,int s_y,int e_y,int x, int y,uint8_t winenable,uint8_t winarea);
void stv_vdp2_fill_rotation_parameter_table( uint8_t rot_parameter ); void stv_vdp2_fill_rotation_parameter_table(uint8_t rot_parameter);
uint8_t stv_vdp2_check_vram_cycle_pattern_registers( uint8_t access_command_pnmdr, uint8_t access_command_cpdr, uint8_t bitmap_enable ); uint8_t stv_vdp2_check_vram_cycle_pattern_registers(uint8_t access_command_pnmdr, uint8_t access_command_cpdr, uint8_t bitmap_enable);
uint8_t stv_vdp2_is_rotation_applied(void); uint8_t stv_vdp2_is_rotation_applied();
uint8_t stv_vdp2_are_map_registers_equal(void); uint8_t stv_vdp2_are_map_registers_equal();
void stv_vdp2_get_map_page( int x, int y, int *_map, int *_page ); void stv_vdp2_get_map_page(int x, int y, int *_map, int *_page);
void stv_vdp2_draw_mosaic(bitmap_rgb32 &bitmap, const rectangle &cliprect, uint8_t is_roz); void stv_vdp2_draw_mosaic(bitmap_rgb32 &bitmap, const rectangle &cliprect, uint8_t is_roz);
void stv_vdp2_fade_effects( void ); void stv_vdp2_fade_effects();
void stv_vdp2_compute_color_offset( int *r, int *g, int *b, int cor ); void stv_vdp2_compute_color_offset(int *r, int *g, int *b, int cor);
void stv_vdp2_compute_color_offset_UINT32(rgb_t *rgb, int cor); void stv_vdp2_compute_color_offset_UINT32(rgb_t *rgb, int cor);
void stv_vdp2_check_fade_control_for_layer( void ); void stv_vdp2_check_fade_control_for_layer();
void stv_vdp2_draw_line(bitmap_rgb32 &bitmap, const rectangle &cliprect); void stv_vdp2_draw_line(bitmap_rgb32 &bitmap, const rectangle &cliprect);
void stv_vdp2_draw_back(bitmap_rgb32 &bitmap, const rectangle &cliprect); void stv_vdp2_draw_back(bitmap_rgb32 &bitmap, const rectangle &cliprect);
@ -328,9 +328,9 @@ protected:
void draw_sprites(bitmap_rgb32 &bitmap, const rectangle &cliprect, uint8_t pri); void draw_sprites(bitmap_rgb32 &bitmap, const rectangle &cliprect, uint8_t pri);
int true_vcount[263][4]; int true_vcount[263][4];
void stv_vdp2_state_save_postload( void ); void stv_vdp2_state_save_postload();
void stv_vdp2_exit ( void ); void stv_vdp2_exit();
int stv_vdp2_start ( void ); int stv_vdp2_start();
uint8_t m_vdpdebug_roz = 0; uint8_t m_vdpdebug_roz = 0;

View File

@ -232,7 +232,7 @@ void saturn_state::stv_clear_framebuffer( int which_framebuffer )
} }
void saturn_state::stv_prepare_framebuffers( void ) void saturn_state::stv_prepare_framebuffers()
{ {
int i,rowsize; int i,rowsize;
@ -273,7 +273,7 @@ void saturn_state::stv_prepare_framebuffers( void )
} }
void saturn_state::stv_vdp1_change_framebuffers( void ) void saturn_state::stv_vdp1_change_framebuffers()
{ {
m_vdp1.framebuffer_current_display ^= 1; m_vdp1.framebuffer_current_display ^= 1;
m_vdp1.framebuffer_current_draw ^= 1; m_vdp1.framebuffer_current_draw ^= 1;
@ -283,7 +283,7 @@ void saturn_state::stv_vdp1_change_framebuffers( void )
stv_prepare_framebuffers(); stv_prepare_framebuffers();
} }
void saturn_state::stv_set_framebuffer_config( void ) void saturn_state::stv_set_framebuffer_config()
{ {
if ( m_vdp1.framebuffer_mode == STV_VDP1_TVM && if ( m_vdp1.framebuffer_mode == STV_VDP1_TVM &&
m_vdp1.framebuffer_double_interlace == STV_VDP1_DIE ) return; m_vdp1.framebuffer_double_interlace == STV_VDP1_DIE ) return;
@ -521,12 +521,12 @@ the rest are data used by it
*/ */
void saturn_state::stv_clear_gouraud_shading(void) void saturn_state::stv_clear_gouraud_shading()
{ {
memset( &stv_gouraud_shading, 0, sizeof( stv_gouraud_shading ) ); stv_gouraud_shading = decltype(stv_gouraud_shading)();
} }
uint8_t saturn_state::stv_read_gouraud_table( void ) uint8_t saturn_state::stv_read_gouraud_table()
{ {
int gaddr; int gaddr;
@ -1086,7 +1086,7 @@ void saturn_state::drawpixel_generic(int x, int y, int patterndata, int offsetcn
} }
void saturn_state::stv_vdp1_set_drawpixel( void ) void saturn_state::stv_vdp1_set_drawpixel()
{ {
int sprite_type = stv2_current_sprite.CMDCTRL & 0x000f; int sprite_type = stv2_current_sprite.CMDCTRL & 0x000f;
int sprite_mode = stv2_current_sprite.CMDPMOD&0x0038; int sprite_mode = stv2_current_sprite.CMDPMOD&0x0038;
@ -1818,7 +1818,7 @@ TIMER_CALLBACK_MEMBER(saturn_state::vdp1_draw_end )
} }
void saturn_state::stv_vdp1_process_list( void ) void saturn_state::stv_vdp1_process_list()
{ {
int position; int position;
int spritecount; int spritecount;
@ -2062,7 +2062,7 @@ void saturn_state::stv_vdp1_process_list( void )
if (VDP1_LOG) logerror ("End of list processing!\n"); if (VDP1_LOG) logerror ("End of list processing!\n");
} }
void saturn_state::video_update_vdp1( void ) void saturn_state::video_update_vdp1()
{ {
int framebuffer_changed = 0; int framebuffer_changed = 0;
@ -2157,7 +2157,7 @@ void saturn_state::video_update_vdp1( void )
//popmessage("%04x %04x",STV_VDP1_EWRR_X3,STV_VDP1_EWRR_Y3); //popmessage("%04x %04x",STV_VDP1_EWRR_X3,STV_VDP1_EWRR_Y3);
} }
void saturn_state::stv_vdp1_state_save_postload( void ) void saturn_state::stv_vdp1_state_save_postload()
{ {
uint8_t *vdp1 = m_vdp1.gfx_decode.get(); uint8_t *vdp1 = m_vdp1.gfx_decode.get();
int offset; int offset;
@ -2179,7 +2179,7 @@ void saturn_state::stv_vdp1_state_save_postload( void )
} }
} }
int saturn_state::stv_vdp1_start ( void ) int saturn_state::stv_vdp1_start()
{ {
m_vdp1_regs = make_unique_clear<uint16_t[]>(0x020/2 ); m_vdp1_regs = make_unique_clear<uint16_t[]>(0x020/2 );
m_vdp1_vram = make_unique_clear<uint32_t[]>(0x100000/4 ); m_vdp1_vram = make_unique_clear<uint32_t[]>(0x100000/4 );
@ -4450,7 +4450,7 @@ void saturn_state::stv_vdp2_fill_rotation_parameter_table( uint8_t rot_parameter
} }
/* check if RGB layer has rotation applied */ /* check if RGB layer has rotation applied */
uint8_t saturn_state::stv_vdp2_is_rotation_applied(void) uint8_t saturn_state::stv_vdp2_is_rotation_applied()
{ {
#define _FIXED_1 (0x00010000) #define _FIXED_1 (0x00010000)
#define _FIXED_0 (0x00000000) #define _FIXED_0 (0x00000000)
@ -4477,7 +4477,7 @@ uint8_t saturn_state::stv_vdp2_is_rotation_applied(void)
} }
} }
uint8_t saturn_state::stv_vdp2_are_map_registers_equal(void) uint8_t saturn_state::stv_vdp2_are_map_registers_equal()
{ {
int i; int i;
@ -4491,7 +4491,7 @@ uint8_t saturn_state::stv_vdp2_are_map_registers_equal(void)
return 1; return 1;
} }
void saturn_state::stv_vdp2_check_fade_control_for_layer( void ) void saturn_state::stv_vdp2_check_fade_control_for_layer()
{ {
if ( stv2_current_tilemap.fade_control & 1 ) if ( stv2_current_tilemap.fade_control & 1 )
{ {
@ -8159,7 +8159,7 @@ void saturn_state::saturn_vdp2_cram_w(offs_t offset, uint32_t data, uint32_t mem
} }
} }
void saturn_state::refresh_palette_data( void ) void saturn_state::refresh_palette_data()
{ {
int r,g,b; int r,g,b;
int c_i; int c_i;
@ -8235,7 +8235,7 @@ void saturn_state::saturn_vdp2_regs_w(offs_t offset, uint16_t data, uint16_t mem
printf("VDP2 sets up 8 Mbit VRAM!\n"); printf("VDP2 sets up 8 Mbit VRAM!\n");
} }
int saturn_state::get_hblank_duration( void ) int saturn_state::get_hblank_duration()
{ {
int res; int res;
@ -8250,7 +8250,7 @@ int saturn_state::get_hblank_duration( void )
/*some vblank lines measurements (according to Charles MacDonald)*/ /*some vblank lines measurements (according to Charles MacDonald)*/
/* TODO: interlace mode "eats" one line, should be 262.5 */ /* TODO: interlace mode "eats" one line, should be 262.5 */
int saturn_state::get_vblank_duration( void ) int saturn_state::get_vblank_duration()
{ {
int res; int res;
@ -8266,7 +8266,7 @@ int saturn_state::get_vblank_duration( void )
return res; return res;
} }
int saturn_state::get_pixel_clock( void ) int saturn_state::get_pixel_clock()
{ {
int res,divider; int res,divider;
@ -8287,7 +8287,7 @@ int saturn_state::get_pixel_clock( void )
} }
/* TODO: hblank position and hblank firing doesn't really match HW behaviour. */ /* TODO: hblank position and hblank firing doesn't really match HW behaviour. */
uint8_t saturn_state::get_hblank( void ) uint8_t saturn_state::get_hblank()
{ {
const rectangle &visarea = m_screen->visible_area(); const rectangle &visarea = m_screen->visible_area();
int cur_h = m_screen->hpos(); int cur_h = m_screen->hpos();
@ -8298,7 +8298,7 @@ uint8_t saturn_state::get_hblank( void )
return 0; return 0;
} }
uint8_t saturn_state::get_vblank( void ) uint8_t saturn_state::get_vblank()
{ {
int cur_v,vblank; int cur_v,vblank;
cur_v = m_screen->vpos(); cur_v = m_screen->vpos();
@ -8311,7 +8311,7 @@ uint8_t saturn_state::get_vblank( void )
return 0; return 0;
} }
uint8_t saturn_state::get_odd_bit( void ) uint8_t saturn_state::get_odd_bit()
{ {
if(STV_VDP2_HRES & 4) //exclusive monitor mode makes this bit to be always 1 if(STV_VDP2_HRES & 4) //exclusive monitor mode makes this bit to be always 1
return 1; return 1;
@ -8323,7 +8323,7 @@ uint8_t saturn_state::get_odd_bit( void )
return m_vdp2.odd;//m_screen->frame_number() & 1; return m_vdp2.odd;//m_screen->frame_number() & 1;
} }
int saturn_state::get_vblank_start_position( void ) int saturn_state::get_vblank_start_position()
{ {
// TODO: test says that second setting happens at 241, might need further investigation ... // TODO: test says that second setting happens at 241, might need further investigation ...
// also first one happens at 240, but needs mods in SMPC otherwise we get 2 credits at startup in shanhigw and sokyugrt // also first one happens at 240, but needs mods in SMPC otherwise we get 2 credits at startup in shanhigw and sokyugrt
@ -8338,7 +8338,7 @@ int saturn_state::get_vblank_start_position( void )
return vblank_line; return vblank_line;
} }
int saturn_state::get_ystep_count( void ) int saturn_state::get_ystep_count()
{ {
int max_y = m_screen->height(); int max_y = m_screen->height();
int y_step; int y_step;
@ -8352,7 +8352,7 @@ int saturn_state::get_ystep_count( void )
} }
/* TODO: these needs to be checked via HW tests! */ /* TODO: these needs to be checked via HW tests! */
int saturn_state::get_hcounter( void ) int saturn_state::get_hcounter()
{ {
int hcount; int hcount;
@ -8383,7 +8383,7 @@ int saturn_state::get_hcounter( void )
return hcount; return hcount;
} }
int saturn_state::get_vcounter( void ) int saturn_state::get_vcounter()
{ {
int vcount; int vcount;
@ -8402,7 +8402,7 @@ int saturn_state::get_vcounter( void )
return (true_vcount[vcount & 0x1ff][STV_VDP2_VRES]); // Non-interlace return (true_vcount[vcount & 0x1ff][STV_VDP2_VRES]); // Non-interlace
} }
void saturn_state::stv_vdp2_state_save_postload( void ) void saturn_state::stv_vdp2_state_save_postload()
{ {
uint8_t *gfxdata = m_vdp2.gfx_decode.get(); uint8_t *gfxdata = m_vdp2.gfx_decode.get();
int offset; int offset;
@ -8438,13 +8438,13 @@ void saturn_state::stv_vdp2_state_save_postload( void )
refresh_palette_data(); refresh_palette_data();
} }
void saturn_state::stv_vdp2_exit ( void ) void saturn_state::stv_vdp2_exit()
{ {
m_vdp2.roz_bitmap[0].reset(); m_vdp2.roz_bitmap[0].reset();
m_vdp2.roz_bitmap[1].reset(); m_vdp2.roz_bitmap[1].reset();
} }
int saturn_state::stv_vdp2_start ( void ) int saturn_state::stv_vdp2_start()
{ {
machine().add_notifier(MACHINE_NOTIFY_EXIT, machine_notify_delegate(&saturn_state::stv_vdp2_exit, this)); machine().add_notifier(MACHINE_NOTIFY_EXIT, machine_notify_delegate(&saturn_state::stv_vdp2_exit, this));
@ -8505,7 +8505,7 @@ VIDEO_START_MEMBER(saturn_state,stv_vdp2)
} }
} }
void saturn_state::stv_vdp2_dynamic_res_change( void ) void saturn_state::stv_vdp2_dynamic_res_change()
{ {
const int d_vres[4] = { 224, 240, 256, 256 }; const int d_vres[4] = { 224, 240, 256, 256 };
const int d_hres[4] = { 320, 352, 640, 704 }; const int d_hres[4] = { 320, 352, 640, 704 };
@ -8546,7 +8546,7 @@ void saturn_state::stv_vdp2_dynamic_res_change( void )
/*This is for calculating the rgb brightness*/ /*This is for calculating the rgb brightness*/
/*TODO: Optimize this...*/ /*TODO: Optimize this...*/
void saturn_state::stv_vdp2_fade_effects( void ) void saturn_state::stv_vdp2_fade_effects()
{ {
/* /*
Note:We have to use temporary storages because palette_get_color must use Note:We have to use temporary storages because palette_get_color must use

View File

@ -537,8 +537,6 @@ segaic16_video_device::segaic16_video_device(const machine_config &mconfig, cons
, m_pagelatch_cb(*this, DEVICE_SELF, FUNC(segaic16_video_device::tilemap_16b_fill_latch)) , m_pagelatch_cb(*this, DEVICE_SELF, FUNC(segaic16_video_device::tilemap_16b_fill_latch))
, m_gfxdecode(*this, finder_base::DUMMY_TAG) , m_gfxdecode(*this, finder_base::DUMMY_TAG)
{ {
memset(m_rotate, 0, sizeof(m_rotate));
memset(m_bg_tilemap, 0, sizeof(m_bg_tilemap));
} }
void segaic16_video_device::device_start() void segaic16_video_device::device_start()
@ -1205,7 +1203,7 @@ void segaic16_video_device::tilemap_init(int which, int type, int colorbase, int
tilemap_get_info_delegate get_tile_info(*this); tilemap_get_info_delegate get_tile_info(*this);
/* reset the tilemap info */ /* reset the tilemap info */
memset(info, 0, sizeof(*info)); *info = tilemap_info();
info->index = which; info->index = which;
info->type = type; info->type = type;
for (int i = 0; i < numbanks; i++) for (int i = 0; i < numbanks; i++)
@ -1477,7 +1475,7 @@ void segaic16_video_device::rotate_init(int which, int type, int colorbase)
struct rotate_info *info = &m_rotate[which]; struct rotate_info *info = &m_rotate[which];
/* reset the tilemap info */ /* reset the tilemap info */
memset(info, 0, sizeof(*info)); *info = rotate_info();
info->index = which; info->index = which;
info->type = type; info->type = type;
info->colorbase = colorbase; info->colorbase = colorbase;

View File

@ -76,45 +76,47 @@ public:
struct tilemap_callback_info struct tilemap_callback_info
{ {
uint16_t * rambase; /* base of RAM for this tilemap page */ uint16_t * rambase = nullptr; // base of RAM for this tilemap page
const uint8_t * bank; /* pointer to bank array */ const uint8_t * bank = nullptr; // pointer to bank array
uint16_t banksize; /* size of banks */ uint16_t banksize = 0; // size of banks
}; };
struct tilemap_info struct tilemap_info
{ {
uint8_t index; /* index of this structure */ using reset_func = void (*)(screen_device &screen, tilemap_info *info);
uint8_t type; /* type of tilemap (see segaic16.h for details) */ using draw_layer_func = void (*)(screen_device &screen, tilemap_info *info, bitmap_ind16 &bitmap, const rectangle &cliprect, int which, int flags, int priority);
uint8_t numpages; /* number of allocated pages */
uint8_t flip; /* screen flip? */ uint8_t index = 0; // index of this structure
uint8_t rowscroll, colscroll; /* are rowscroll/colscroll enabled (if external enables are used) */ uint8_t type = 0; // type of tilemap (see segaic16.h for details)
uint8_t bank[8]; /* indexes of the tile banks */ uint8_t numpages = 0; // number of allocated pages
uint16_t banksize; /* number of tiles per bank */ uint8_t flip = 0; // screen flip?
uint16_t latched_xscroll[4]; /* latched X scroll values */ uint8_t rowscroll = 0, colscroll = 0; // are rowscroll/colscroll enabled (if external enables are used)
uint16_t latched_yscroll[4]; /* latched Y scroll values */ uint8_t bank[8]; // indexes of the tile banks
uint16_t latched_pageselect[4]; /* latched page select values */ uint16_t banksize = 0; // number of tiles per bank
int32_t xoffs; /* X scroll offset */ uint16_t latched_xscroll[4] = {0,0,0,0}; // latched X scroll values
tilemap_t * tilemaps[16]; /* up to 16 tilemap pages */ uint16_t latched_yscroll[4] = {0,0,0,0}; // latched Y scroll values
tilemap_t * textmap; /* a single text tilemap */ uint16_t latched_pageselect[4] = {0,0,0,0}; // latched page select values
struct tilemap_callback_info tmap_info[16]; /* callback info for 16 tilemap pages */ int32_t xoffs = 0; // X scroll offset
struct tilemap_callback_info textmap_info; /* callback info for a single textmap page */ tilemap_t * tilemaps[16]{}; // up to 16 tilemap pages
void (*reset)(screen_device &screen, struct tilemap_info *info);/* reset callback */ tilemap_t * textmap = nullptr; // a single text tilemap
void (*draw_layer)(screen_device &screen, struct tilemap_info *info, bitmap_ind16 &bitmap, const rectangle &cliprect, int which, int flags, int priority); tilemap_callback_info tmap_info[16]; // callback info for 16 tilemap pages
uint16_t * textram; /* pointer to textram pointer */ tilemap_callback_info textmap_info; // callback info for a single textmap page
uint16_t * tileram; /* pointer to tileram pointer */ reset_func reset = nullptr; // reset callback
emu_timer * latch_timer; /* timer for latching 16b tilemap scroll values */ draw_layer_func draw_layer = nullptr;
uint16_t * textram = nullptr; // pointer to textram pointer
uint16_t * tileram = nullptr; // pointer to tileram pointer
emu_timer * latch_timer = nullptr; // timer for latching 16b tilemap scroll values
}; };
struct rotate_info struct rotate_info
{ {
uint8_t index; /* index of this structure */ uint8_t index = 0; // index of this structure
uint8_t type; /* type of rotate system (see segaic16.h for details) */ uint8_t type = 0; // type of rotate system (see segaic16.h for details)
uint16_t colorbase; /* base color index */ uint16_t colorbase = 0; // base color index
int32_t ramsize; /* size of rotate RAM */ int32_t ramsize = 0; // size of rotate RAM
uint16_t * rotateram; /* pointer to rotateram pointer */ uint16_t * rotateram = nullptr; // pointer to rotateram pointer
std::unique_ptr<uint16_t[]> buffer; /* buffered data */ std::unique_ptr<uint16_t[]> buffer; // buffered data
}; };
template <typename T> segaic16_video_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock, T &&decode_tag) template <typename T> segaic16_video_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock, T &&decode_tag)

View File

@ -522,7 +522,7 @@ void segaic16_road_device::segaic16_road_init(int which, int type, int colorbase
road_info *info = &segaic16_road[which]; road_info *info = &segaic16_road[which];
/* reset the tilemap info */ /* reset the tilemap info */
memset(info, 0, sizeof(*info)); *info = road_info();
info->index = which; info->index = which;
info->type = type; info->type = type;
info->colorbase1 = colorbase1; info->colorbase1 = colorbase1;

View File

@ -23,20 +23,21 @@ public:
static constexpr unsigned ROAD_FOREGROUND = 1; static constexpr unsigned ROAD_FOREGROUND = 1;
struct road_info struct road_info
{ {
u8 index; /* index of this structure */ using draw_func = void (*)(struct road_info *info, bitmap_ind16 &bitmap, const rectangle &cliprect, int priority);
u8 type; /* type of road system (see segaic16.h for details) */
u8 control; /* control register value */ u8 index = 0; // index of this structure
u16 colorbase1; /* color base for road ROM data */ u8 type = 0; // type of road system (see segaic16.h for details)
u16 colorbase2; /* color base for road background data */ u8 control = 0; // control register value
u16 colorbase3; /* color base for sky data */ u16 colorbase1 = 0; // color base for road ROM data
s32 xoffs; /* X scroll offset */ u16 colorbase2 = 0; // color base for road background data
void (*draw)(struct road_info *info, bitmap_ind16 &bitmap, const rectangle &cliprect, int priority); u16 colorbase3 = 0; // color base for sky data
u16 * roadram; /* pointer to roadram pointer */ s32 xoffs = 0; // X scroll offset
std::unique_ptr<u16[]> buffer; /* buffered roadram pointer */ draw_func draw = nullptr;
std::unique_ptr<u8[]> gfx; /* expanded road graphics */ u16 * roadram = nullptr; // pointer to roadram pointer
std::unique_ptr<u16[]> buffer; // buffered roadram pointer
std::unique_ptr<u8[]> gfx; // expanded road graphics
}; };

View File

@ -221,8 +221,8 @@ void vboysnd_device::device_start()
for (int i=0; i<8; i++) for (int i=0; i<8; i++)
waveEnv2LenTbl[i] = (i + 1) * 4 * 120; waveEnv2LenTbl[i] = (i + 1) * 4 * 120;
for (int i = 0; i < 5; i++) for (auto &chan : snd_channel)
memset(&snd_channel[i], 0, sizeof(s_snd_channel)); chan = s_snd_channel();
memset(m_aram, 0, 0x600); memset(m_aram, 0, 0x600);
} }

View File

@ -33,21 +33,21 @@ protected:
static constexpr unsigned CHANNELS = 4; static constexpr unsigned CHANNELS = 4;
struct s_snd_channel { struct s_snd_channel {
int8_t playing = 0; // the sound is playing int8_t playing = 0; // the sound is playing
// state when sound was enabled // state when sound was enabled
uint32_t env_steptime = 0; // Envelope step time uint32_t env_steptime = 0; // Envelope step time
uint8_t env0 = 0; // Envelope data uint8_t env0 = 0; // Envelope data
uint8_t env1 = 0; // Envelope data uint8_t env1 = 0; // Envelope data
uint8_t volLeft = 0; // Left output volume uint8_t volLeft = 0; // Left output volume
uint8_t volRight = 0; // Right output volume uint8_t volRight = 0; // Right output volume
uint8_t sample[580]{}; // sample to play uint8_t sample[580]{}; // sample to play
int sample_len = 0; // length of sample int sample_len = 0; // length of sample
// values that change, as the sample is played // values that change, as the sample is played
int offset = 0; // current offset in sample int offset = 0; // current offset in sample
int time = 0; // the duration that this sample is to be played int time = 0; // the duration that this sample is to be played
uint8_t envelope = 0; // Current envelope level (604) uint8_t envelope = 0; // Current envelope level (604)
int env_time = 0; // The duration between envelope decay/grow (608) int env_time = 0; // The duration between envelope decay/grow (608)
}; };

View File

@ -9,6 +9,8 @@
#include "emu.h" #include "emu.h"
#include "svis_snd.h" #include "svis_snd.h"
#include <algorithm>
// configurable logging // configurable logging
#define LOG_DMA (1U << 1) #define LOG_DMA (1U << 1)
#define LOG_NOISE (1U << 2) #define LOG_NOISE (1U << 2)
@ -50,9 +52,9 @@ svision_sound_device::svision_sound_device(const machine_config &mconfig, const
void svision_sound_device::device_start() void svision_sound_device::device_start()
{ {
memset(&m_dma, 0, sizeof(m_dma)); m_dma = DMA();
memset(&m_noise, 0, sizeof(m_noise)); m_noise = NOISE();
memset(m_channel, 0, sizeof(m_channel)); std::fill(std::begin(m_channel), std::end(m_channel), CHANNEL());
m_mixer_channel = stream_alloc(0, 2, machine().sample_rate()); m_mixer_channel = stream_alloc(0, 2, machine().sample_rate());

View File

@ -71,16 +71,16 @@ protected:
private: private:
struct math_t struct math_t
{ {
uint16_t cpulatch; uint16_t cpulatch = 0;
uint16_t promaddr; uint16_t promaddr = 0;
uint16_t inslatch; uint16_t inslatch = 0;
uint32_t mux; uint32_t mux = 0;
uint16_t ppshift; uint16_t ppshift = 0;
uint32_t i0ff; uint32_t i0ff = 0;
uint16_t retval; uint16_t retval = 0;
uint16_t muxlatch; // TX-1 uint16_t muxlatch = 0; // TX-1
int dbgaddr; int dbgaddr = 0;
int dbgpc = 0; int dbgpc = 0;
uint16_t get_datarom_addr() const; uint16_t get_datarom_addr() const;
uint16_t get_bb_datarom_addr() const; uint16_t get_bb_datarom_addr() const;

View File

@ -1339,7 +1339,7 @@ void tx1_state::machine_reset()
// TODO: This is connected to the /BUSACK line of the Z80 // TODO: This is connected to the /BUSACK line of the Z80
m_maincpu->set_input_line(INPUT_LINE_TEST, ASSERT_LINE); m_maincpu->set_input_line(INPUT_LINE_TEST, ASSERT_LINE);
memset(&m_math, 0, sizeof(m_math)); m_math = math_t();
m_sn74s516.state = 0; m_sn74s516.state = 0;
} }

View File

@ -199,7 +199,7 @@ TIMER_CALLBACK_MEMBER(kcgd_state::toggle_500hz)
void kcgd_state::machine_reset() void kcgd_state::machine_reset()
{ {
memset(&m_video, 0, sizeof(m_video)); m_video = decltype(m_video)();
} }
void kcgd_state::machine_start() void kcgd_state::machine_start()

View File

@ -226,7 +226,7 @@ TIMER_CALLBACK_MEMBER(ksm_state::clock_brg)
void ksm_state::machine_reset() void ksm_state::machine_reset()
{ {
memset(&m_video, 0, sizeof(m_video)); m_video = decltype(m_video)();
brga = 0; brga = 0;
brgb = 0; brgb = 0;
brgc = 0; brgc = 0;

View File

@ -154,7 +154,7 @@ void sm7238_state::sm7238_io(address_map &map)
void sm7238_state::machine_reset() void sm7238_state::machine_reset()
{ {
memset(&m_video, 0, sizeof(m_video)); m_video = decltype(m_video)();
m_videobank->set_bank(0); m_videobank->set_bank(0);
} }

View File

@ -74,8 +74,8 @@ void tiamc1_sound_device::device_start()
{ {
int i, j; int i, j;
timer8253_reset(&m_timer0); m_timer0 = timer8253struct();
timer8253_reset(&m_timer1); m_timer1 = timer8253struct();
m_channel = stream_alloc(0, 1, clock() / CLOCK_DIVIDER); m_channel = stream_alloc(0, 1, clock() / CLOCK_DIVIDER);
@ -147,12 +147,6 @@ void tiamc1_sound_device::sound_stream_update(sound_stream &stream, std::vector<
} }
void tiamc1_sound_device::timer8253_reset(struct timer8253struct *t)
{
memset(t,0,sizeof(struct timer8253struct));
}
void tiamc1_sound_device::timer8253_tick(struct timer8253struct *t, int chn) void tiamc1_sound_device::timer8253_tick(struct timer8253struct *t, int chn)
{ {
if (t->channel[chn].enable && t->channel[chn].gate) if (t->channel[chn].enable && t->channel[chn].gate)

View File

@ -49,7 +49,6 @@ private:
}; };
void timer8253_reset(struct timer8253struct *t);
void timer8253_tick(struct timer8253struct *t,int chn); void timer8253_tick(struct timer8253struct *t,int chn);
void timer8253_wr(struct timer8253struct *t, int reg, uint8_t val); void timer8253_wr(struct timer8253struct *t, int reg, uint8_t val);
char timer8253_get_output(struct timer8253struct *t, int chn); char timer8253_get_output(struct timer8253struct *t, int chn);