8514/A compatible changes on Mach32 of the day (November 3rd, 2024)

Mark the ATI extended 8514/A mode accordingly (that is, if bit 5 of ATI reg 0xb0 and using ATI extended ports at the same time). Fixes wrong colors in some instances using standard IBM 8514/A drivers on Mach32.
This commit is contained in:
TC1995 2024-11-03 23:21:18 +01:00
parent 558176e454
commit c966538324

View file

@ -2312,7 +2312,8 @@ mach_out(uint16_t addr, uint8_t val, void *priv)
rs2 = !!(mach->accel.ext_ge_config & 0x1000);
rs3 = !!(mach->accel.ext_ge_config & 0x2000);
if ((dev->local & 0xff) >= 0x02) {
if (mach->regs[0xb0] & 0x20) {
if (mach->regs[0xb0] & 0x20) { /*ATI extended 8514/A mode.*/
dev->vendor_mode = 1;
dev->on |= 0x01;
svga_recalctimings(svga);
mach32_updatemapping(mach, svga);
@ -2333,6 +2334,7 @@ mach_out(uint16_t addr, uint8_t val, void *priv)
rs3 = !!(mach->regs[0xa0] & 0x40);
if ((dev->local & 0xff) >= 0x02) {
if (!(mach->regs[0xb0] & 0x20)) {
dev->vendor_mode = 0;
dev->on &= ~0x01;
svga_recalctimings(svga);
mach32_updatemapping(mach, svga);
@ -2490,29 +2492,7 @@ ati8514_out(uint16_t addr, uint8_t val, void *priv)
mach_log("[%04X:%08X]: ADDON OUT addr=%03x, val=%02x.\n", CS, cpu_state.pc, addr, val);
switch (addr) {
case 0x0102:
dev->pos_regs[2] = val;
mem_mapping_disable(&dev->bios_rom.mapping);
if (dev->pos_regs[2] & 0x01)
mem_mapping_enable(&dev->bios_rom.mapping);
break;
case 0x0103:
dev->pos_regs[3] = val;
dev->bios_addr = 0xc0000 + (((dev->pos_regs[3] >> 1) & 0x7f) << 11);
if (dev->pos_regs[3] & 0x01)
mem_mapping_set_addr(&dev->bios_rom.mapping, dev->bios_addr, 0x2000);
break;
case 0x0104:
case 0x0105:
case 0x0106:
case 0x0107:
dev->pos_regs[addr & 7] = val;
break;
default:
svga_out(addr, val, priv);
break;
}
svga_out(addr, val, priv);
}
uint8_t
@ -2522,22 +2502,7 @@ ati8514_in(uint16_t addr, void *priv)
ibm8514_t *dev = (ibm8514_t *) svga->dev8514;
uint8_t temp = 0xff;
switch (addr) {
case 0x0100:
case 0x0101:
case 0x0102:
case 0x0103:
case 0x0104:
case 0x0105:
case 0x0106:
case 0x0107:
temp = dev->pos_regs[addr & 7];
break;
default:
temp = svga_in(addr, priv);
break;
}
temp = svga_in(addr, priv);
mach_log("[%04X:%08X]: ADDON IN addr=%03x, temp=%02x.\n", CS, cpu_state.pc, addr, temp);
return temp;
@ -2583,7 +2548,6 @@ ati8514_recalctimings(svga_t *svga)
dev->dispend >>= 1;
mach_log("cntl=%d, hv(%d,%d), pitch=%d, rowoffset=%d, gextconfig=%03x, shadow=%x interlace=%d.\n", dev->accel.advfunc_cntl & 0x04, dev->h_disp, dev->dispend, dev->pitch, dev->rowoffset, mach->accel.ext_ge_config & 0xcec0, mach->shadow_set & 3, dev->interlace);
svga->map8 = dev->pallook;
if (dev->vram_512k_8514) {
if (dev->h_disp == 640) {
dev->ext_pitch = 640;
@ -3387,6 +3351,7 @@ mach_accel_out_call(uint16_t port, uint8_t val, mach_t *mach, svga_t *svga, ibm8
case 0x4ae8:
dev->accel.advfunc_cntl = val;
dev->on = dev->accel.advfunc_cntl & 0x01;
dev->vendor_mode = 0;
mach_log("[%04X:%08X]: ATI 8514/A: (0x%04x): ON=%d, shadow crt=%x, hdisp=%d, vdisp=%d.\n", CS, cpu_state.pc, port, val & 0x01, dev->accel.advfunc_cntl & 0x04, dev->hdisp, dev->vdisp);
if ((dev->local & 0xff) < 0x02) {
@ -3476,6 +3441,7 @@ mach_accel_out_call(uint16_t port, uint8_t val, mach_t *mach, svga_t *svga, ibm8
dev->ext_crt_pitch <<= 1;
}
dev->on |= 0x01;
dev->vendor_mode = 1;
svga_recalctimings(svga);
mach32_updatemapping(mach, svga);
mach_log("ATI 8514/A: (0x%04x) val=0x%02x.\n", port, val);
@ -3524,6 +3490,7 @@ mach_accel_out_call(uint16_t port, uint8_t val, mach_t *mach, svga_t *svga, ibm8
case 0x4aef:
WRITE8(port, mach->accel.clock_sel, val);
dev->on = mach->accel.clock_sel & 0x01;
dev->vendor_mode = 1;
mach_log("ATI 8514/A: (0x%04x): ON=%d, val=%04x, hdisp=%d, vdisp=%d.\n", port, mach->accel.clock_sel & 0x01, val, dev->hdisp, dev->vdisp);
mach_log("Vendor ATI mode set %s resolution.\n", (dev->accel.advfunc_cntl & 0x04) ? "2: 1024x768" : "1: 640x480");
svga_recalctimings(svga);
@ -5220,6 +5187,7 @@ mach32_updatemapping(mach_t *mach, svga_t *svga)
if (((dev->local & 0xff) >= 0x02) && !(dev->accel.advfunc_cntl & 0x01) && !(mach->accel.clock_sel & 0x01)) {
if ((svga->gdcreg[6] & 0x01) || (svga->attrregs[0x10] & 0x01)) {
if (svga->attrregs[0x10] & 0x40) {
dev->vendor_mode = 0;
dev->on &= ~0x01;
svga_recalctimings(svga);
}
@ -5251,7 +5219,7 @@ mach32_updatemapping(mach_t *mach, svga_t *svga)
mem_mapping_disable(&mach->mmio_linear_mapping);
}
if ((dev->local & 0xff) >= 0x02) {
if (dev->on) {
if (dev->on && dev->vendor_mode) {
mach_log("Mach32 banked mapping.\n");
mem_mapping_set_handler(&svga->mapping, mach32_read, mach32_readw, mach32_readl, mach32_write, mach32_writew, mach32_writel);
mem_mapping_set_p(&svga->mapping, mach);