Added vertical retrace emulation support for Voodoo Banshee. Now the screen

resolution can be set to 800 x 600 in Win95 guest. Minor other changes.
This commit is contained in:
Volker Ruppert 2017-11-25 10:27:53 +00:00
parent 03f63453f5
commit 690919ae0e
3 changed files with 32 additions and 13 deletions

View File

@ -495,7 +495,7 @@ void bx_voodoo_c::register_state(void)
for (i = 0; i < 2; i++) {
sprintf(name, "%d", i);
bx_list_c *num = new bx_list_c(cmdfifo, name, "");
new bx_shadow_bool_c(num, "enabled", &v->fbi.cmdfifo[i].enabled, BASE_HEX);
new bx_shadow_bool_c(num, "enabled", &v->fbi.cmdfifo[i].enabled);
new bx_shadow_num_c(num, "base", &v->fbi.cmdfifo[i].base, BASE_HEX);
new bx_shadow_num_c(num, "end", &v->fbi.cmdfifo[i].end, BASE_HEX);
new bx_shadow_num_c(num, "rdptr", &v->fbi.cmdfifo[i].rdptr, BASE_HEX);
@ -1199,19 +1199,23 @@ void bx_voodoo_c::redraw_area(unsigned x0, unsigned y0, unsigned width,
Bit32u bx_voodoo_c::get_retrace(bx_bool hv)
{
Bit64u time_in_frame = bx_virt_timer.time_usec(0) - BX_VOODOO_THIS s.vdraw.frame_start;
if (time_in_frame >= BX_VOODOO_THIS s.vdraw.vsync_usec) {
return 0;
} else {
Bit32u value = (Bit32u)(time_in_frame / BX_VOODOO_THIS s.vdraw.htotal_usec + 1);
if (hv) {
Bit32u time_in_line = (Bit32u)(time_in_frame % BX_VOODOO_THIS s.vdraw.htotal_usec);
Bit32u hpixel = (Bit32u)(time_in_line * BX_VOODOO_THIS s.vdraw.htime_to_pixel);
if (time_in_line < BX_VOODOO_THIS s.vdraw.hsync_usec) {
value |= ((hpixel + 1) << 16);
if (BX_VOODOO_THIS s.model < VOODOO_BANSHEE) {
Bit64u time_in_frame = bx_virt_timer.time_usec(0) - BX_VOODOO_THIS s.vdraw.frame_start;
if (time_in_frame >= BX_VOODOO_THIS s.vdraw.vsync_usec) {
return 0;
} else {
Bit32u value = (Bit32u)(time_in_frame / BX_VOODOO_THIS s.vdraw.htotal_usec + 1);
if (hv) {
Bit32u time_in_line = (Bit32u)(time_in_frame % BX_VOODOO_THIS s.vdraw.htotal_usec);
Bit32u hpixel = (Bit32u)(time_in_line * BX_VOODOO_THIS s.vdraw.htime_to_pixel);
if (time_in_line < BX_VOODOO_THIS s.vdraw.hsync_usec) {
value |= ((hpixel + 1) << 16);
}
}
return value;
}
return value;
} else {
return theVoodooVga->get_retrace();
}
}
@ -2969,6 +2973,17 @@ void bx_voodoo_vga_c::banshee_set_vclk3(Bit32u value)
}
}
Bit32u bx_voodoo_vga_c::get_retrace()
{
Bit32u retval = 1;
Bit64u display_usec = bx_virt_timer.time_usec(0) % BX_VVGA_THIS s.vtotal_usec;
if ((display_usec >= BX_VVGA_THIS s.vrstart_usec) &&
(display_usec <= BX_VVGA_THIS s.vrend_usec)) {
retval = 0;
}
return retval;
}
void bx_voodoo_vga_c::get_crtc_params(Bit32u *htotal, Bit32u *vtotal)
{
*htotal = BX_VVGA_THIS s.CRTC.reg[0] + ((v->banshee.crtc[0x1a] & 0x01) << 8) + 5;

View File

@ -135,6 +135,7 @@ public:
virtual bx_bool init_vga_extension(void);
virtual void get_crtc_params(Bit32u *htotal, Bit32u *vtotal);
bx_bool get_retrace(void);
void banshee_update_mode(void);
void banshee_set_dac_mode(bx_bool mode);

View File

@ -2445,11 +2445,11 @@ void cmdfifo_w(Bit32u fbi_offset, Bit32u data)
BX_LOCK(cmdfifo_mutex);
*(Bit32u*)(&v->fbi.ram[fbi_offset]) = data;
if (v->fbi.cmdfifo[0].count_holes) {
v->fbi.cmdfifo[0].amax = fbi_offset;
if (fbi_offset == (v->fbi.cmdfifo[0].amin + 4)) {
v->fbi.cmdfifo[0].amin = fbi_offset;
v->fbi.cmdfifo[0].depth = (v->fbi.cmdfifo[0].amin - v->fbi.cmdfifo[0].rdptr) / 4;
}
v->fbi.cmdfifo[0].amax = fbi_offset;
} else {
v->fbi.cmdfifo[0].depth++;
}
@ -2502,6 +2502,9 @@ void cmdfifo_process(void)
break;
case 3: // JMP
v->fbi.cmdfifo[0].rdptr = (command >> 4) & 0xfffffc;
if (v->fbi.cmdfifo[0].count_holes) {
BX_INFO(("cmdfifo_process(): JMP 0x%08x", v->fbi.cmdfifo[0].rdptr));
}
break;
default:
BX_ERROR(("CMDFIFO packet type 0: unsupported code %d", code));