Some work on the Voodoo emulation

- fixed behaviour of the initEnable register
- fixed some uninitialized variables
- some other small fixes and cleanups
This commit is contained in:
Volker Ruppert 2014-01-02 22:34:01 +00:00
parent 98634946e6
commit 7173b6ee0f
2 changed files with 15 additions and 8 deletions

View File

@ -195,6 +195,9 @@ void bx_voodoo_c::init(void)
50000, 1, 0, "voodoo_update");
}
BX_VOODOO_THIS s.vdraw.clock_enabled = 1;
BX_VOODOO_THIS s.vdraw.output_on = 0;
BX_VOODOO_THIS s.vdraw.override_on = 0;
BX_VOODOO_THIS s.vdraw.screen_update_pending = 0;
v = new voodoo_state;
Bit8u model = (Bit8u)SIM->get_param_enum("model", base)->get();
@ -211,7 +214,8 @@ void bx_voodoo_c::init(void)
voodoo_init(model);
BX_INFO(("Voodoo initialized"));
BX_INFO(("3dfx Voodoo Graphics adapter (model=%s) initialized",
SIM->get_param_enum("model", base)->get_selected()));
}
void bx_voodoo_c::reset(unsigned type)
@ -242,6 +246,7 @@ void bx_voodoo_c::reset(unsigned type)
for (i = 0; i < sizeof(reset_vals) / sizeof(*reset_vals); ++i) {
BX_VOODOO_THIS pci_conf[reset_vals[i].addr] = reset_vals[i].val;
}
v->pci.init_enable = 0x00;
// Deassert IRQ
set_irq_level(0);
@ -644,6 +649,8 @@ void bx_voodoo_c::pci_write_handler(Bit8u address, Bit32u value, unsigned io_len
break;
case 0x40:
case 0x41:
case 0x42:
case 0x43:
v->pci.init_enable &= ~(0xff << (i*8));
v->pci.init_enable |= (value8 << (i*8));
break;

View File

@ -1884,9 +1884,8 @@ void register_w(Bit32u offset, Bit32u data)
/* fbiInit0 can only be written if initEnable says we can -- Voodoo/Voodoo2 only */
case fbiInit0:
poly_wait(v->poly, v->regnames[regnum]);
Voodoo_Output_Enable(data&1);
if (v->type <= VOODOO_2 && (chips & 1) && INITEN_ENABLE_HW_INIT(v->pci.init_enable))
{
if (v->type <= VOODOO_2 && (chips & 1) && INITEN_ENABLE_HW_INIT(v->pci.init_enable)) {
Voodoo_Output_Enable(data & 1);
v->reg[fbiInit0].u = data;
if (FBIINIT0_GRAPHICS_RESET(data))
soft_reset(v);
@ -2172,9 +2171,8 @@ Bit32s texture_w(Bit32u offset, Bit32u data)
return 0;
}
Bit32u lfb_w(Bit32u offset, Bit32u data, Bit32u mem_mask)
Bit32u lfb_w(Bit32u offset, Bit32u data, Bit32u mem_mask)
{
BX_DEBUG(("write LFB offset 0x%x value 0x%08x", offset, data));
Bit16u *dest, *depth;
Bit32u destmax, depthmax;
// Bit32u mem_mask=0xffffffff;
@ -2184,6 +2182,8 @@ Bit32s texture_w(Bit32u offset, Bit32u data)
int x, y, scry, mask;
int pix, destbuf;
BX_DEBUG(("write LFB offset 0x%x value 0x%08x", offset, data));
/* statistics */
v->stats.lfb_writes++;
@ -2648,7 +2648,6 @@ Bit32u register_r(Bit32u offset)
Bit32u lfb_r(Bit32u offset)
{
BX_DEBUG(("Voodoo:read LFB offset 0x%x", offset));
Bit16u *buffer;
Bit32u bufmax;
Bit32u bufoffs;
@ -2657,6 +2656,8 @@ Bit32u lfb_r(Bit32u offset)
int x, y, scry;
Bit32u destbuf;
BX_DEBUG(("read LFB offset 0x%x", offset));
/* statistics */
v->stats.lfb_reads++;
@ -2850,7 +2851,6 @@ void voodoo_init(Bit8u _type)
v->regaccess = voodoo_register_access;
}
v->regnames = voodoo_reg_name;
v->pci.init_enable = (1<<2) | 1;
v->chipmask = 0x01 | 0x02 | 0x04 | 0x08;
memset(v->dac.reg, 0, sizeof(v->dac.reg));
v->dac.read_result = 0;