Add zero() to (s)vga_device: zeroes all private variables but vtbls.

The vga.memory is resized to 0.
This commit is contained in:
jbu 2014-11-01 13:41:13 +01:00
parent 4b2e3674ef
commit 3efeb980ac
4 changed files with 26 additions and 9 deletions

View File

@ -45,9 +45,7 @@ s3virgedx_rev1_vga_device::s3virgedx_rev1_vga_device(const machine_config &mconf
void s3virge_vga_device::device_start()
{
// FIXME: this kills the vptr of vga.memory
memset(&vga, 0, sizeof(vga));
memset(&svga, 0, sizeof(svga));
zero();
int x;
int i;

View File

@ -155,9 +155,7 @@ void trident_vga_device::WRITEPIXEL(INT16 x,INT16 y, UINT32 data)
void trident_vga_device::device_start()
{
// FIXME: this kill the vga.memory vptr
memset(&vga, 0, sizeof(vga));
memset(&svga, 0, sizeof(svga));
zero();
int i;
for (i = 0; i < 0x100; i++)

View File

@ -198,6 +198,27 @@ mach8_device::mach8_device(const machine_config &mconfig, const char *tag, devic
{
}
// zero everything, keep vtbls
void vga_device::zero()
{
memset(&vga.svga_intf, 0, sizeof(vga.svga_intf));
vga.memory.resize(0);
memset(vga.pens, 0, sizeof(vga.pens));
vga.miscellaneous_output = 0;
vga.feature_control = 0;
memset(&vga.sequencer, 0, sizeof(vga.sequencer));
memset(&vga.crtc, 0, sizeof(vga.crtc));
memset(&vga.gc, 0, sizeof(vga.gc));
memset(&vga.attribute, 0, sizeof(vga.attribute));
memset(&vga.dac, 0, sizeof(vga.dac));
memset(&vga.oak, 0, sizeof(vga.oak));
}
void svga_device::zero()
{
vga_device::zero();
memset(&svga, 0, sizeof(svga));
}
/* VBLANK callback, start address definitely updates AT vblank, not before. */
TIMER_CALLBACK_MEMBER(vga_device::vblank_timer_cb)
@ -208,8 +229,7 @@ TIMER_CALLBACK_MEMBER(vga_device::vblank_timer_cb)
void vga_device::device_start()
{
// FIXME: this kills the vga.memory vptr
memset(&vga, 0, sizeof(vga));
zero();
int i;
for (i = 0; i < 0x100; i++)

View File

@ -26,7 +26,7 @@ public:
vga_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
vga_device(const machine_config &mconfig, device_type type, const char *name, const char *tag, device_t *owner, UINT32 clock, const char *shortname, const char *source);
virtual void zero();
virtual UINT32 screen_update(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect);
virtual READ8_MEMBER(port_03b0_r);
@ -205,6 +205,7 @@ public:
// construction/destruction
svga_device(const machine_config &mconfig, device_type type, const char *name, const char *tag, device_t *owner, UINT32 clock, const char *shortname, const char *source);
virtual void zero();
virtual UINT32 screen_update(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect);
protected:
void svga_vh_rgb8(bitmap_rgb32 &bitmap, const rectangle &cliprect);