More (S)VGA horizontal blanking fixes and CPU CR0 bit 4 fixes.

This commit is contained in:
OBattler
2024-02-09 18:02:33 +01:00
parent 30e7a49558
commit 3f8952a558
8 changed files with 58 additions and 52 deletions

View File

@@ -270,6 +270,8 @@ reset_common(int hard)
cr0 = 1 << 30;
else
cr0 = 0;
if (is386 && !is486 && (fpu_type == FPU_387))
cr0 |= 0x10;
cpu_cache_int_enabled = 0;
cpu_update_waitstates();
cr4 = 0;

View File

@@ -124,7 +124,7 @@ opMOV_CRx_r_a16(uint32_t fetchdat)
if ((cpu_state.regs[cpu_rm].l & 0x01) && !(cr0 & 0x01))
cpu_state.seg_cs.access &= 0x9f;
cr0 = cpu_state.regs[cpu_rm].l;
if ((cpu_s->cpu_type != CPU_386DX) || (fpu_type == FPU_387))
if (cpu_16bitbus)
cr0 |= 0x10;
if (!(cr0 & 0x80000000))
mmu_perm = 4;
@@ -181,7 +181,7 @@ opMOV_CRx_r_a32(uint32_t fetchdat)
if ((cpu_state.regs[cpu_rm].l & 0x01) && !(cr0 & 0x01))
cpu_state.seg_cs.access &= 0x9f;
cr0 = cpu_state.regs[cpu_rm].l;
if ((cpu_s->cpu_type != CPU_386DX) || (fpu_type == FPU_387))
if (cpu_16bitbus)
cr0 |= 0x10;
if (!(cr0 & 0x80000000))
mmu_perm = 4;

View File

@@ -171,6 +171,8 @@ typedef struct svga_t {
double clock;
double clock8514;
double multiplier;
hwcursor_t hwcursor;
hwcursor_t hwcursor_latch;
hwcursor_t dac_hwcursor;

View File

@@ -1762,11 +1762,11 @@ gd54xx_recalctimings(svga_t *svga)
svga->hblank_end_val = (svga->crtc[3] & 0x1f) | ((svga->crtc[5] & 0x80) ? 0x20 : 0x00) |
(((svga->crtc[0x1a] >> 4) & 3) << 6);
svga->hblank_end_mask = 0x0000007f;
svga->hblank_end_mask = 0x000000ff;
if (svga->crtc[0x1b] & 0x20) {
svga->hblankstart = svga->crtc[1] + ((svga->crtc[3] >> 5) & 3) + 1;
svga->hblank_end_val = ((svga->crtc[3] >> 5) & 3);
svga->hblankstart = svga->crtc[1]/* + ((svga->crtc[3] >> 5) & 3)*/ + 1;
svga->hblank_end_val = svga->htotal - 1 /* + ((svga->crtc[3] >> 5) & 3)*/;
/* In this mode, the dots per clock are always 8 or 16, never 9 or 18. */
if (!svga->scrblank && svga->attr_palette_enable)

View File

@@ -3262,9 +3262,9 @@ s3_recalctimings(svga_t *svga)
if (svga->crtc[0x33] & 0x20) {
/* The S3 version of the Cirrus' special blanking mode, with identical behavior. */
svga->hblankstart = (((svga->crtc[0x5d] & 0x02) >> 1) << 8) + svga->crtc[1] +
((svga->crtc[3] >> 5) & 3) + 1;
svga->hblank_end_val = ((svga->crtc[3] >> 5) & 3);
svga->hblankstart = (((svga->crtc[0x5d] & 0x02) >> 1) << 8) + svga->crtc[1]/* +
((svga->crtc[3] >> 5) & 3)*/ + 1;
svga->hblank_end_val = svga->htotal - 1 /* + ((svga->crtc[3] >> 5) & 3)*/;
svga->monitor->mon_overscan_y = 0;
svga->monitor->mon_overscan_x = 0;
@@ -4108,11 +4108,11 @@ s3_trio64v_recalctimings(svga_t *svga)
break;
}
if ((svga->crtc[0x33] & 0x20) ||((svga->crtc[0x67] & 0xc) == 0xc)) {
if ((svga->crtc[0x33] & 0x20) || ((svga->crtc[0x67] & 0xc) == 0xc)) {
/* The S3 version of the Cirrus' special blanking mode, with identical behavior. */
svga->hblankstart = (((svga->crtc[0x5d] & 0x02) >> 1) << 8) + svga->crtc[1] +
((svga->crtc[3] >> 5) & 3) + 1;
svga->hblank_end_val = ((svga->crtc[3] >> 5) & 3);
svga->hblankstart = (((svga->crtc[0x5d] & 0x02) >> 1) << 8) + svga->crtc[1]/* +
((svga->crtc[3] >> 5) & 3)*/ + 1;
svga->hblank_end_val = svga->htotal - 1 /* + ((svga->crtc[3] >> 5) & 3)*/;
svga->monitor->mon_overscan_y = 0;
svga->monitor->mon_overscan_x = 0;
@@ -4204,15 +4204,11 @@ s3_trio64v_recalctimings(svga_t *svga)
svga->render = svga_render_8bpp_highres;
break;
case 3: /*KRGB-16 (1.5.5.5)*/
svga->htotal >>= 1;
svga->hblankstart >>= 1;
svga->hblank_end_val >>= 1;
svga->multiplier = 0.5;
svga->render = svga_render_15bpp_highres;
break;
case 5: /*RGB-16 (5.6.5)*/
svga->htotal >>= 1;
svga->hblankstart >>= 1;
svga->hblank_end_val >>= 1;
svga->multiplier = 0.5;
svga->render = svga_render_16bpp_highres;
break;
case 6: /*RGB-24 (8.8.8)*/

View File

@@ -826,9 +826,9 @@ s3_virge_recalctimings(svga_t *svga)
if ((svga->crtc[0x33] & 0x20) || ((svga->crtc[0x67] & 0xc) == 0xc)) {
/* The S3 version of the Cirrus' special blanking mode, with identical behavior. */
svga->hblankstart = (((svga->crtc[0x5d] & 0x02) >> 1) << 8) + svga->crtc[1] +
((svga->crtc[3] >> 5) & 3) + 1;
svga->hblank_end_val = ((svga->crtc[3] >> 5) & 3);
svga->hblankstart = (((svga->crtc[0x5d] & 0x02) >> 1) << 8) + svga->crtc[1]/* +
((svga->crtc[3] >> 5) & 3)*/ + 1;
svga->hblank_end_val = svga->htotal - 1 /* + ((svga->crtc[3] >> 5) & 3)*/;
svga->monitor->mon_overscan_y = 0;
svga->monitor->mon_overscan_x = 0;
@@ -862,19 +862,21 @@ s3_virge_recalctimings(svga_t *svga)
case 15:
svga->render = svga_render_15bpp_highres;
if (virge->chip != S3_VIRGEVX && virge->chip < S3_VIRGEGX2) {
svga->htotal >>= 1;
// svga->htotal >>= 1;
// if ((svga->crtc[0x33] & 0x20) || ((svga->crtc[0x67] & 0xc) == 0xc))
// svga->hblank_end_val = svga->htotal - 1;
svga->hdisp >>= 1;
svga->hblankstart >>= 1;
svga->hblank_end_val >>= 1;
svga->dots_per_clock >>= 1;
}
break;
case 16:
svga->render = svga_render_16bpp_highres;
if (virge->chip != S3_VIRGEVX && virge->chip < S3_VIRGEGX2) {
svga->htotal >>= 1;
// svga->htotal >>= 1;
// if ((svga->crtc[0x33] & 0x20) || ((svga->crtc[0x67] & 0xc) == 0xc))
// svga->hblank_end_val = svga->htotal - 1;
svga->hdisp >>= 1;
svga->hblankstart >>= 1;
svga->hblank_end_val >>= 1;
svga->dots_per_clock >>= 1;
}
break;
case 24:
@@ -921,15 +923,17 @@ s3_virge_recalctimings(svga_t *svga)
svga->render = svga_render_8bpp_highres;
break;
case 3: /*KRGB-16 (1.5.5.5)*/
svga->htotal >>= 1;
svga->hblankstart >>= 1;
svga->hblank_end_val >>= 1;
// svga->htotal >>= 1;
// if ((svga->crtc[0x33] & 0x20) || ((svga->crtc[0x67] & 0xc) == 0xc))
// svga->hblank_end_val = svga->htotal - 1;
// svga->dots_per_clock >>= 1;
svga->render = svga_render_15bpp_highres;
break;
case 5: /*RGB-16 (5.6.5)*/
svga->htotal >>= 1;
svga->hblankstart >>= 1;
svga->hblank_end_val >>= 1;
// svga->htotal >>= 1;
// if ((svga->crtc[0x33] & 0x20) || ((svga->crtc[0x67] & 0xc) == 0xc))
// svga->hblank_end_val = svga->htotal - 1;
// svga->dots_per_clock >>= 1;
svga->render = svga_render_16bpp_highres;
break;
case 6: /*RGB-24 (8.8.8)*/

View File

@@ -773,6 +773,8 @@ svga_recalctimings(svga_t *svga)
} else
svga->dots_per_clock = 1;
svga->multiplier = 1.0;
if (svga->recalctimings_ex)
svga->recalctimings_ex(svga);
@@ -813,26 +815,26 @@ svga_recalctimings(svga_t *svga)
if (ibm8514_active && (svga->dev8514 != NULL)) {
if (dev->on[0] || dev->on[1]) {
uint32_t dot8514 = dev->h_blankstart;
uint32_t adj_dot8514 = dev->h_blankstart;
uint32_t eff_mask8514 = 0x0000003f;
dev->hblank_sub = 0;
uint32_t dot8514 = dev->h_blankstart;
uint32_t adj_dot8514 = dev->h_blankstart;
uint32_t eff_mask8514 = 0x0000003f;
dev->hblank_sub = 0;
while (1) {
if (dot8514 == dev->h_total)
dot = 0;
while (1) {
if (dot8514 == dev->h_total)
dot = 0;
if (adj_dot8514 >= dev->h_total)
dev->hblank_sub++;
if (adj_dot8514 >= dev->h_total)
dev->hblank_sub++;
if ((dot8514 & eff_mask8514) == (dev->h_blank_end_val & eff_mask8514))
break;
if ((dot8514 & eff_mask8514) == (dev->h_blank_end_val & eff_mask8514))
break;
dot8514++;
adj_dot8514++;
}
dot8514++;
adj_dot8514++;
}
dev->h_disp -= dev->hblank_sub;
dev->h_disp -= dev->hblank_sub;
}
}
}
@@ -889,7 +891,7 @@ svga_recalctimings(svga_t *svga)
svga->htotal, hdispstart, hdispend, hsyncstart, hsyncend,
svga->hblankstart, svga->hblankend);
disptime = svga->htotal;
disptime = svga->htotal * svga->multiplier;
_dispontime = svga->hdisp_time;
if (ibm8514_active && (svga->dev8514 != NULL)) {

View File

@@ -557,14 +557,14 @@ banshee_recalctimings(svga_t *svga)
/* Video processing mode - assume timings akin to Cirrus' special blanking mode,
that is, no overscan and relying on display end to blank. */
if (banshee->vgaInit0 & 0x40) {
svga->hblankstart = svga->crtc[1] + ((svga->crtc[3] >> 5) & 3) +
svga->hblankstart = svga->crtc[1]/* + ((svga->crtc[3] >> 5) & 3)*/ +
(((svga->crtc[0x1a] & 0x04) >> 2) << 8) + 1;
svga->hblank_end_mask = 0x0000007f;
} else {
svga->hblankstart = svga->crtc[1] + ((svga->crtc[3] >> 5) & 3) + 1;
svga->hblankstart = svga->crtc[1]/* + ((svga->crtc[3] >> 5) & 3)*/ + 1;
svga->hblank_end_mask = 0x0000003f;
}
svga->hblank_end_val = ((svga->crtc[3] >> 5) & 3);
svga->hblank_end_val = svga->htotal - 1 /* + ((svga->crtc[3] >> 5) & 3)*/;
/* In this mode, the dots per clock are always 8 or 16, never 9 or 18. */
if (!svga->scrblank && svga->attr_palette_enable)