Late night fixes for the Mach8 (May 5th, 2025)

1. The Mach8 doesn't have separate graphics pitches a la Mach32 (68800-6 and up), fixes the rendering in some drivers for Windows.
2. Special case for the add-on Mach8 for the mode switching (resolution only).
This commit is contained in:
TC1995
2025-05-05 02:02:02 +02:00
parent dca7ed737c
commit 6a6be85852

View File

@@ -2681,7 +2681,6 @@ ati_render_32bpp(svga_t *svga)
When ATI mode is selected, allow complete auto-detection. When ATI mode is selected, allow complete auto-detection.
But when 8514/A mode is selected, allow detection based on the shadow register sets. But when 8514/A mode is selected, allow detection based on the shadow register sets.
*/ */
static void static void
mach_set_resolution(mach_t *mach, svga_t *svga) mach_set_resolution(mach_t *mach, svga_t *svga)
{ {
@@ -2707,6 +2706,17 @@ mach_set_resolution(mach_t *mach, svga_t *svga)
if (dev->interlace) if (dev->interlace)
dev->v_syncstart >>= 1; dev->v_syncstart >>= 1;
if (ATI_8514A_ULTRA) {
if ((mach->accel.clock_sel & 0x01) &&
!(dev->accel.advfunc_cntl & 0x01))
ret = 2;
else if ((dev->accel.advfunc_cntl & 0x01) &&
!(mach->accel.clock_sel & 0x01))
ret = 1;
else if ((!(dev->accel.advfunc_cntl & 0x01) && (mach->old_on1 & 0x01)) ||
(!(mach->accel.clock_sel & 0x01) && (mach->old_on2 & 0x01)))
ret = 0;
} else {
if ((mach->accel.clock_sel & 0x01) && !(mach->old_on2 & 0x01) && if ((mach->accel.clock_sel & 0x01) && !(mach->old_on2 & 0x01) &&
!(dev->accel.advfunc_cntl & 0x01)) !(dev->accel.advfunc_cntl & 0x01))
ret = 2; ret = 2;
@@ -2716,6 +2726,7 @@ mach_set_resolution(mach_t *mach, svga_t *svga)
else if ((!(dev->accel.advfunc_cntl & 0x01) && (mach->old_on1 & 0x01)) || else if ((!(dev->accel.advfunc_cntl & 0x01) && (mach->old_on1 & 0x01)) ||
(!(mach->accel.clock_sel & 0x01) && (mach->old_on2 & 0x01))) (!(mach->accel.clock_sel & 0x01) && (mach->old_on2 & 0x01)))
ret = 0; ret = 0;
}
if (ret) { if (ret) {
if (ret == 2) if (ret == 2)
@@ -2730,11 +2741,13 @@ mach_set_resolution(mach_t *mach, svga_t *svga)
if (dev->hdisp == 640) { if (dev->hdisp == 640) {
dev->hdisp = 1024; dev->hdisp = 1024;
dev->vdisp = 768; dev->vdisp = 768;
mach_log("1024x768.\n");
} }
} else { } else {
if (dev->hdisp == 1024) { if (dev->hdisp == 1024) {
dev->hdisp = 640; dev->hdisp = 640;
dev->vdisp = 480; dev->vdisp = 480;
mach_log("640x480.\n");
} }
} }
svga_recalctimings(svga); svga_recalctimings(svga);
@@ -2764,7 +2777,6 @@ ati8514_recalctimings(svga_t *svga)
mach_log("ON=%d, vgahdisp=%d.\n", dev->on, svga->hdisp); mach_log("ON=%d, vgahdisp=%d.\n", dev->on, svga->hdisp);
if (dev->on) { if (dev->on) {
mach_log("8514/A ON, pitch=%d.\n", dev->ext_pitch);
dev->interlace = !!(dev->disp_cntl & 0x10); dev->interlace = !!(dev->disp_cntl & 0x10);
dev->pitch = dev->ext_pitch; dev->pitch = dev->ext_pitch;
dev->rowoffset = dev->ext_crt_pitch; dev->rowoffset = dev->ext_crt_pitch;
@@ -2773,16 +2785,19 @@ ati8514_recalctimings(svga_t *svga)
mach->accel.crt_offset = (mach->accel.crt_offset_lo | (mach->accel.crt_offset_hi << 16)) << 2; mach->accel.crt_offset = (mach->accel.crt_offset_lo | (mach->accel.crt_offset_hi << 16)) << 2;
dev->accel.ge_offset -= mach->accel.crt_offset; dev->accel.ge_offset -= mach->accel.crt_offset;
mach_log("HDISP=%d, VDISP=%d, shadowset=%x, 8514/A mode=%x, clocksel=%02x.\n", mach_log("HDISP=%d, VDISP=%d, shadowset=%x, 8514/A mode=%x, clocksel=%02x.\n",
dev->hdisp, dev->vdisp, mach->shadow_set & 0x03, dev->accel.advfunc_cntl & 0x05, mach->accel.clock_sel & 0x01); dev->hdisp, dev->vdisp, mach->shadow_set & 0x03, dev->accel.advfunc_cntl & 0x05, mach->accel.clock_sel & 0x01);
mach->accel.src_pitch = ((mach->accel.ge_pitch & 0xff) << 3); mach->accel.src_pitch = dev->pitch;
mach->accel.dst_pitch = ((mach->accel.ge_pitch & 0xff) << 3); mach->accel.dst_pitch = dev->pitch;
mach->accel.src_ge_offset = (mach->accel.ge_offset_lo | (mach->accel.ge_offset_hi << 16)) << 2; mach->accel.src_ge_offset = (mach->accel.ge_offset_lo | (mach->accel.ge_offset_hi << 16)) << 2;
mach->accel.dst_ge_offset = (mach->accel.ge_offset_lo | (mach->accel.ge_offset_hi << 16)) << 2; mach->accel.dst_ge_offset = (mach->accel.ge_offset_lo | (mach->accel.ge_offset_hi << 16)) << 2;
mach->accel.src_ge_offset -= mach->accel.crt_offset; mach->accel.src_ge_offset -= mach->accel.crt_offset;
mach->accel.dst_ge_offset -= mach->accel.crt_offset; mach->accel.dst_ge_offset -= mach->accel.crt_offset;
mach_log("8514/A ON, pitch=%d, GE offset=%08x.\n", ((mach->accel.ge_pitch & 0xff) << 3), dev->accel.ge_offset);
dev->h_disp = dev->hdisp; dev->h_disp = dev->hdisp;
dev->dispend = dev->vdisp; dev->dispend = dev->vdisp;
if (dev->dispend == 600) if (dev->dispend == 600)
@@ -2809,6 +2824,7 @@ ati8514_recalctimings(svga_t *svga)
} }
dev->accel_bpp = 8; dev->accel_bpp = 8;
svga->render8514 = ibm8514_render_8bpp; svga->render8514 = ibm8514_render_8bpp;
} else } else
mach->crt_resolution = 0; mach->crt_resolution = 0;
} }
@@ -3009,17 +3025,12 @@ mach_recalctimings(svga_t *svga)
} }
} }
} else { } else {
mach->accel.src_pitch = ((mach->accel.ge_pitch & 0xff) << 3); mach->accel.src_pitch = dev->pitch;
mach->accel.dst_pitch = ((mach->accel.ge_pitch & 0xff) << 3); mach->accel.dst_pitch = dev->pitch;
mach->accel.src_ge_offset = (mach->accel.ge_offset_lo | (mach->accel.ge_offset_hi << 16)); mach->accel.src_ge_offset = (mach->accel.ge_offset_lo | (mach->accel.ge_offset_hi << 16));
mach->accel.dst_ge_offset = (mach->accel.ge_offset_lo | (mach->accel.ge_offset_hi << 16)); mach->accel.dst_ge_offset = (mach->accel.ge_offset_lo | (mach->accel.ge_offset_hi << 16));
if (dev->bpp) {
mach->accel.src_ge_offset <<= 1;
mach->accel.dst_ge_offset <<= 1;
} else {
mach->accel.src_ge_offset <<= 2; mach->accel.src_ge_offset <<= 2;
mach->accel.dst_ge_offset <<= 2; mach->accel.dst_ge_offset <<= 2;
}
mach->accel.src_ge_offset -= mach->accel.crt_offset; mach->accel.src_ge_offset -= mach->accel.crt_offset;
mach->accel.dst_ge_offset -= mach->accel.crt_offset; mach->accel.dst_ge_offset -= mach->accel.crt_offset;
@@ -7221,7 +7232,6 @@ ati8514_init(svga_t *svga, void *ext8514, void *dev8514)
dev->v_sync_start = 0x0600; dev->v_sync_start = 0x0600;
dev->disp_cntl = 0x33; dev->disp_cntl = 0x33;
mach->accel.clock_sel = 0x1c; mach->accel.clock_sel = 0x1c;
mach->shadow_set = 0x02;
dev->accel.cmd_back = 1; dev->accel.cmd_back = 1;
io_sethandler(0x02ea, 4, ati8514_in, NULL, NULL, ati8514_out, NULL, NULL, svga); io_sethandler(0x02ea, 4, ati8514_in, NULL, NULL, ati8514_out, NULL, NULL, svga);