clarify vga/8514 separation

This commit is contained in:
starfrost013
2025-06-21 01:32:59 +01:00
parent adb8b388a8
commit 7abb817012
6 changed files with 200 additions and 277 deletions

View File

@@ -371,18 +371,14 @@ mach_accel_start(int cmd_type, int cpu_input, int count, uint32_t mix_dat, uint3
if (mach_pixel_write(mach)) {
mach_log("Extended Bresenham Write pixtrans.\n");
dev->force_busy = 1;
dev->force_busy2 = 1;
mach->force_busy = 1;
dev->data_available = 0;
dev->data_available2 = 0;
return;
} else if (mach_pixel_read(mach)) {
mach_log("Extended Bresenham Read pixtrans.\n");
dev->force_busy = 1;
dev->force_busy2 = 1;
mach->force_busy = 1;
dev->data_available = 1;
dev->data_available2 = 1;
return;
}
}
@@ -530,7 +526,6 @@ mach_accel_start(int cmd_type, int cpu_input, int count, uint32_t mix_dat, uint3
if (cpu_input) {
mach->force_busy = 0;
dev->force_busy = 0;
dev->force_busy2 = 0;
}
dev->fifo_idx = 0;
dev->accel.cmd_back = 1;
@@ -539,7 +534,6 @@ mach_accel_start(int cmd_type, int cpu_input, int count, uint32_t mix_dat, uint3
if (cpu_input) {
mach->force_busy = 0;
dev->force_busy = 0;
dev->force_busy2 = 0;
}
dev->fifo_idx = 0;
dev->accel.cmd_back = 1;
@@ -740,7 +734,6 @@ mach_accel_start(int cmd_type, int cpu_input, int count, uint32_t mix_dat, uint3
if ((mono_src == 1) && !count) {
if (cpu_input) {
dev->force_busy = 0;
dev->force_busy2 = 0;
mach->force_busy = 0;
}
dev->fifo_idx = 0;
@@ -749,7 +742,6 @@ mach_accel_start(int cmd_type, int cpu_input, int count, uint32_t mix_dat, uint3
} else if ((mono_src != 1) && (dev->accel.sx >= mach->accel.width)) {
if (cpu_input) {
dev->force_busy = 0;
dev->force_busy2 = 0;
mach->force_busy = 0;
}
dev->fifo_idx = 0;
@@ -959,18 +951,14 @@ mach_accel_start(int cmd_type, int cpu_input, int count, uint32_t mix_dat, uint3
if (mach_pixel_write(mach)) {
mach_log("Non-Conforming BitBLT Write pixtrans.\n");
dev->force_busy = 1;
dev->force_busy2 = 1;
mach->force_busy = 1;
dev->data_available = 0;
dev->data_available2 = 0;
return;
} else if (mach_pixel_read(mach)) {
mach_log("Non-Conforming BitBLT Read pixtrans.\n");
dev->force_busy = 1;
dev->force_busy2 = 1;
mach->force_busy = 1;
dev->data_available = 1;
dev->data_available2 = 1;
return;
}
}
@@ -989,7 +977,6 @@ mach_accel_start(int cmd_type, int cpu_input, int count, uint32_t mix_dat, uint3
mach_log("No DEST.\n");
if (cpu_input) {
dev->force_busy = 0;
dev->force_busy2 = 0;
mach->force_busy = 0;
}
dev->fifo_idx = 0;
@@ -1001,7 +988,6 @@ mach_accel_start(int cmd_type, int cpu_input, int count, uint32_t mix_dat, uint3
if (mach->accel.sx_end == mach->accel.sx_start) {
if (cpu_input) {
dev->force_busy = 0;
dev->force_busy2 = 0;
mach->force_busy = 0;
}
mach_log("No SRC.\n");
@@ -1018,7 +1004,6 @@ mach_accel_start(int cmd_type, int cpu_input, int count, uint32_t mix_dat, uint3
if (dev->accel.sy == mach->accel.height) {
mach_log("No Blit on DPCONFIG=3251.\n");
dev->force_busy = 0;
dev->force_busy2 = 0;
mach->force_busy = 0;
dev->fifo_idx = 0;
dev->accel.cmd_back = 1;
@@ -1228,7 +1213,6 @@ mach_accel_start(int cmd_type, int cpu_input, int count, uint32_t mix_dat, uint3
if (dev->accel.sy >= mach->accel.height) {
if (cpu_input) {
dev->force_busy = 0;
dev->force_busy2 = 0;
mach->force_busy = 0;
}
dev->fifo_idx = 0;
@@ -1276,18 +1260,14 @@ mach_accel_start(int cmd_type, int cpu_input, int count, uint32_t mix_dat, uint3
if (mach_pixel_write(mach)) {
mach_log("Direct Linedraw Write pixtrans.\n");
dev->force_busy = 1;
dev->force_busy2 = 1;
mach->force_busy = 1;
dev->data_available = 0;
dev->data_available2 = 0;
return;
} else if (mach_pixel_read(mach)) {
mach_log("Direct Linedraw Read pixtrans.\n");
dev->force_busy = 1;
dev->force_busy2 = 1;
mach->force_busy = 1;
dev->data_available = 1;
dev->data_available2 = 1;
return;
}
}
@@ -1392,7 +1372,6 @@ mach_accel_start(int cmd_type, int cpu_input, int count, uint32_t mix_dat, uint3
if (!count) {
if (cpu_input) {
dev->force_busy = 0;
dev->force_busy2 = 0;
mach->force_busy = 0;
}
dev->fifo_idx = 0;
@@ -1538,7 +1517,6 @@ mach_accel_start(int cmd_type, int cpu_input, int count, uint32_t mix_dat, uint3
if (dev->accel.sx >= mach->accel.width) {
if (cpu_input) {
dev->force_busy = 0;
dev->force_busy2 = 0;
mach->force_busy = 0;
}
dev->fifo_idx = 0;
@@ -1659,7 +1637,6 @@ mach_accel_start(int cmd_type, int cpu_input, int count, uint32_t mix_dat, uint3
if (!count) {
if (cpu_input) {
dev->force_busy = 0;
dev->force_busy2 = 0;
mach->force_busy = 0;
}
dev->fifo_idx = 0;
@@ -1797,7 +1774,6 @@ mach_accel_start(int cmd_type, int cpu_input, int count, uint32_t mix_dat, uint3
if (dev->accel.sx >= mach->accel.width) {
if (cpu_input) {
dev->force_busy = 0;
dev->force_busy2 = 0;
mach->force_busy = 0;
}
dev->fifo_idx = 0;
@@ -1930,18 +1906,14 @@ mach_accel_start(int cmd_type, int cpu_input, int count, uint32_t mix_dat, uint3
if (mach_pixel_write(mach)) {
mach_log("Scan To X Write pixtrans.\n");
dev->force_busy = 1;
dev->force_busy2 = 1;
mach->force_busy = 1;
dev->data_available = 0;
dev->data_available2 = 0;
return;
} else if (mach_pixel_read(mach)) {
mach_log("Scan To X Read pixtrans.\n");
dev->force_busy = 1;
dev->force_busy2 = 1;
mach->force_busy = 1;
dev->data_available = 1;
dev->data_available2 = 1;
return;
}
}
@@ -2038,7 +2010,6 @@ mach_accel_start(int cmd_type, int cpu_input, int count, uint32_t mix_dat, uint3
dev->fifo_idx = 0;
dev->force_busy = 0;
dev->force_busy2 = 0;
mach->force_busy = 0;
dev->accel.cmd_back = 1;
dev->accel.cur_x = dev->accel.dx;
@@ -2212,7 +2183,6 @@ mach_accel_start(int cmd_type, int cpu_input, int count, uint32_t mix_dat, uint3
dev->fifo_idx = 0;
dev->force_busy = 0;
dev->force_busy2 = 0;
mach->force_busy = 0;
dev->accel.cmd_back = 1;
return;
@@ -2627,7 +2597,7 @@ ati_render_24bpp(svga_t *svga)
dev->lastline_draw = dev->displine;
if (mach->accel.ext_ge_config & 0x400) { /*BGR, Blue-(23:16), Green-(15:8), Red-(7:0)*/
for (int x = 0; x <= dev->h_disp; x += 4) {
for (int x = 0; x <= dev->hdisp_8514; x += 4) {
dat = *(uint32_t *) (&dev->vram[dev->memaddr & dev->vram_mask]);
p[x] = ((dat & 0xff0000) >> 16) | (dat & 0x00ff00) | ((dat & 0x0000ff) << 16);
@@ -2643,7 +2613,7 @@ ati_render_24bpp(svga_t *svga)
dev->memaddr += 12;
}
} else { /*RGB, Red-(23:16), Green-(15:8), Blue-(7:0)*/
for (int x = 0; x <= dev->h_disp; x += 4) {
for (int x = 0; x <= dev->hdisp_8514; x += 4) {
dat = *(uint32_t *) (&dev->vram[dev->memaddr & dev->vram_mask]);
p[x] = dat & 0xffffff;
@@ -2683,12 +2653,12 @@ ati_render_32bpp(svga_t *svga)
dev->lastline_draw = dev->displine;
if (mach->accel.ext_ge_config & 0x400) { /*BGR, Blue-(23:16), Green-(15:8), Red-(7:0)*/
for (x = 0; x <= dev->h_disp; x++) {
for (x = 0; x <= dev->hdisp_8514; x++) {
dat = *(uint32_t *) (&dev->vram[(dev->memaddr + (x << 2)) & dev->vram_mask]);
*p++ = ((dat & 0x00ff0000) >> 16) | (dat & 0x0000ff00) | ((dat & 0x000000ff) << 16);
}
} else { /*RGB, Red-(31:24), Green-(23:16), Blue-(15:8)*/
for (x = 0; x <= dev->h_disp; x++) {
for (x = 0; x <= dev->hdisp_8514; x++) {
dat = *(uint32_t *) (&dev->vram[(dev->memaddr + (x << 2)) & dev->vram_mask]);
*p++ = ((dat & 0xffffff00) >> 8);
}
@@ -2708,22 +2678,22 @@ mach_set_resolution(mach_t *mach, svga_t *svga)
ibm8514_t *dev = (ibm8514_t *) svga->dev8514;
int ret = 0;
dev->h_total = dev->htotal + 1;
dev->htotal_8514 = dev->htotal + 1;
if (dev->h_total == 1) /*Default to 1024x768 87hz 8514/A htotal timings if it goes to 0.*/
dev->h_total = 0x9e;
if (dev->htotal_8514 == 1) /*Default to 1024x768 87hz 8514/A htotal timings if it goes to 0.*/
dev->htotal_8514 = 0x9e;
dev->hdisp = (dev->hdisped + 1) << 3;
dev->hdisp_vga = (dev->hdisped + 1) << 3;
dev->vdisp = (dev->vdisp_latch + 1) >> 1;
if ((dev->vdisp == 478) || (dev->vdisp == 598) || (dev->vdisp == 766) || (dev->vdisp == 1022))
dev->vdisp += 2;
dev->vdisp_vga = (dev->vdisp_8514 + 1) >> 1;
if ((dev->vdisp_vga == 478) || (dev->vdisp_vga == 598) || (dev->vdisp_vga == 766) || (dev->vdisp_vga == 1022))
dev->vdisp_vga += 2;
dev->v_total = dev->v_total_reg + 1;
dev->vtotal_8514 = dev->vtotal_reg + 1;
dev->v_syncstart = dev->v_sync_start + 1;
dev->vsyncstart++;
mach_log("VSYNCSTART=%d, VTOTAL=%d, interlace=%02x, vdisp=%d.\n", dev->v_syncstart, dev->v_total, dev->interlace, dev->vdisp);
mach_log("VSYNCSTART=%d, VTOTAL=%d, interlace=%02x, vdisp=%d.\n", dev->vsyncstart, dev->vtotal_8514, dev->interlace, dev->vdisp_vga);
if (!ATI_MACH32) {
if ((mach->accel.clock_sel & 0x01) &&
@@ -2757,15 +2727,15 @@ mach_set_resolution(mach_t *mach, svga_t *svga)
svga_recalctimings(svga);
else {
if (dev->accel.advfunc_cntl & 0x04) {
if (dev->hdisp == 640) {
dev->hdisp = 1024;
dev->vdisp = 768;
if (dev->hdisp_vga == 640) {
dev->hdisp_vga = 1024;
dev->vdisp_vga = 768;
mach_log("1024x768.\n");
}
} else {
if (dev->hdisp == 1024) {
dev->hdisp = 640;
dev->vdisp = 480;
if (dev->hdisp_vga == 1024) {
dev->hdisp_vga = 640;
dev->vdisp_vga = 480;
mach_log("640x480.\n");
}
}
@@ -2785,7 +2755,7 @@ mach_set_resolution(mach_t *mach, svga_t *svga)
} else
svga_recalctimings(svga);
mach_log("Shadow set ATI=%x, shadow set 8514/A and on1=%x, on2=%x, resolution h=%d, v=%d, vtotal=%d, vsyncstart=%d, crtres=%d, ret=%d, actual passthrough=%x.\n", mach->shadow_set & 0x03, dev->accel.advfunc_cntl & 0x05, mach->accel.clock_sel & 0x01, dev->hdisp, dev->vdisp, dev->v_total, dev->v_syncstart, mach->crt_resolution, ret, dev->on);
mach_log("Shadow set ATI=%x, shadow set 8514/A and on1=%x, on2=%x, resolution h=%d, v=%d, vtotal=%d, vsyncstart=%d, crtres=%d, ret=%d, actual passthrough=%x.\n", mach->shadow_set & 0x03, dev->accel.advfunc_cntl & 0x05, mach->accel.clock_sel & 0x01, dev->hdisp_vga, dev->vdisp_vga, dev->vtotal_8514, dev->v_syncstart, mach->crt_resolution, ret, dev->on);
}
void
@@ -2806,7 +2776,7 @@ ati8514_recalctimings(svga_t *svga)
dev->accel.ge_offset -= mach->accel.crt_offset;
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_vga, dev->vdisp_vga, mach->shadow_set & 0x03, dev->accel.advfunc_cntl & 0x05, mach->accel.clock_sel & 0x01);
mach->accel.src_pitch = dev->pitch;
mach->accel.dst_pitch = dev->pitch;
@@ -2817,11 +2787,11 @@ ati8514_recalctimings(svga_t *svga)
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->dispend = dev->vdisp;
dev->hdisp_8514 = dev->hdisp_vga;
dev->dispend = dev->vdisp_vga;
if (dev->dispend == 600)
dev->h_disp = 800;
else if (dev->h_disp == 640)
dev->hdisp_8514 = 800;
else if (dev->hdisp_8514 == 640)
dev->dispend = 480;
if (dev->accel.advfunc_cntl & 0x04)
@@ -2833,10 +2803,10 @@ 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,
dev->accel.advfunc_cntl & 0x04, dev->hdisp_8514, dev->dispend, dev->pitch, dev->rowoffset,
mach->accel.ext_ge_config & 0xcec0, mach->shadow_set & 3, dev->interlace);
if (dev->vram_is_512k) {
if (dev->h_disp == 640)
if (dev->hdisp_8514 == 640)
dev->pitch = 640;
else
dev->pitch = 1024;
@@ -2926,17 +2896,17 @@ mach_recalctimings(svga_t *svga)
mach_log("RowCount=%x, rowoffset=%x, pitch=%d, geoffset=%x, crtoffset=%x.\n", dev->rowcount, dev->rowoffset, dev->pitch, dev->accel.ge_offset, mach->accel.crt_offset);
mach_log("HDISP=%d, VDISP=%d, shadowset=%x, 8514/A mode=%x, clocksel=%02x, interlace=%x.\n",
dev->hdisp, dev->vdisp, mach->shadow_set & 0x03, dev->accel.advfunc_cntl & 0x04,
dev->hdisp_vga, dev->vdisp_vga, mach->shadow_set & 0x03, dev->accel.advfunc_cntl & 0x04,
mach->accel.clock_sel & 0xfe, dev->interlace);
dev->h_disp = dev->hdisp;
dev->dispend = dev->vdisp;
dev->hdisp_8514 = dev->hdisp_vga;
dev->dispend = dev->vdisp_vga;
if (dev->dispend == 959) { /*FIXME: vertical resolution mess on EEPROM tests on Mach8*/
dev->dispend >>= 1;
dev->dispend++;
} else if (dev->dispend == 600)
dev->h_disp = 800;
else if (dev->h_disp == 640)
dev->hdisp_8514 = 800;
else if (dev->hdisp_8514 == 640)
dev->dispend = 480;
svga->clock_8514 = (cpuclock * (double) (1ULL << 32)) / svga->getclock((mach->accel.clock_sel >> 2) & 0x0f, svga->clock_gen);
@@ -3005,18 +2975,18 @@ mach_recalctimings(svga_t *svga)
break;
}
mach_log("cntl=%d, clksel=%x, hv(%d,%d), pitch=%d, rowoffset=%d, gextconfig=%03x, shadow=%x interlace=%d, vgahdisp=%d.\n",
dev->accel.advfunc_cntl & 0x04, mach->accel.clock_sel & 0x01, dev->h_disp, dev->dispend, dev->pitch, dev->rowoffset,
dev->accel.advfunc_cntl & 0x04, mach->accel.clock_sel & 0x01, dev->hdisp_8514, dev->dispend, dev->pitch, dev->rowoffset,
mach->accel.ext_ge_config & 0xcec0, mach->shadow_set & 3, dev->interlace, svga->hdisp);
if ((mach->accel.ext_ge_config & 0x800) || (!(mach->accel.ext_ge_config & 0x8000) && !(mach->accel.ext_ge_config & 0x800))) {
mach_log("hv=%d,%d, pitch=%d, rowoffset=%d, gextconfig=%03x, bpp=%d, shadow=%x, vgahdisp=%d.\n",
dev->h_disp, dev->dispend, dev->pitch, dev->ext_crt_pitch, mach->accel.ext_ge_config & 0xcec0,
dev->hdisp_8514, dev->dispend, dev->pitch, dev->ext_crt_pitch, mach->accel.ext_ge_config & 0xcec0,
dev->accel_bpp, mach->shadow_set & 0x03, svga->hdisp);
switch (dev->accel_bpp) {
case 8:
if ((mach->accel.ext_ge_config & 0x30) == 0x00) {
if (dev->vram_is_512k) {
if (dev->h_disp == 640)
if (dev->hdisp_8514 == 640)
dev->pitch = 640;
else
dev->pitch = 1024;
@@ -3054,10 +3024,10 @@ mach_recalctimings(svga_t *svga)
mach->accel.dst_ge_offset -= mach->accel.crt_offset;
mach_log("cntl=%d, clksel=%x, hv(%d,%d), pitch=%d, rowoffset=%d, gextconfig=%03x, shadow=%x interlace=%d, vgahdisp=%d.\n",
dev->accel.advfunc_cntl & 0x04, mach->accel.clock_sel & 0x01, dev->h_disp, dev->dispend, dev->pitch, dev->rowoffset,
dev->accel.advfunc_cntl & 0x04, mach->accel.clock_sel & 0x01, dev->hdisp_8514, dev->dispend, dev->pitch, dev->rowoffset,
mach->accel.ext_ge_config & 0xcec0, mach->shadow_set & 0x03, dev->interlace, svga->hdisp);
if (dev->vram_is_512k) {
if (dev->h_disp == 640)
if (dev->hdisp_8514 == 640)
dev->pitch = 640;
else
dev->pitch = 1024;
@@ -3199,15 +3169,15 @@ mach_accel_out_fifo(mach_t *mach, svga_t *svga, ibm8514_t *dev, uint16_t port, u
if (len == 2) {
if ((mach->accel.clock_sel & 0x01) || (!(mach->accel.clock_sel & 0x01) && (mach->shadow_set & 0x03))) { /*For 8514/A mode, take the shadow sets into account.*/
if (!(mach->shadow_cntl & 0x10) && val) {
dev->v_total_reg = val;
dev->v_total_reg &= 0x1fff;
dev->vtotal_reg = val;
dev->vtotal_reg &= 0x1fff;
}
}
} else {
if ((mach->accel.clock_sel & 0x01) || (!(mach->accel.clock_sel & 0x01) && (mach->shadow_set & 0x03))) { /*For 8514/A mode, take the shadow sets into account.*/
if (!(mach->shadow_cntl & 0x10)) {
WRITE8(port, dev->v_total_reg, val);
dev->v_total_reg &= 0x1fff;
WRITE8(port, dev->vtotal_reg, val);
dev->vtotal_reg &= 0x1fff;
}
}
}
@@ -3219,8 +3189,8 @@ mach_accel_out_fifo(mach_t *mach, svga_t *svga, ibm8514_t *dev, uint16_t port, u
if (len == 1) {
if ((mach->accel.clock_sel & 0x01) || (!(mach->accel.clock_sel & 0x01) && (mach->shadow_set & 0x03))) {
if (!(mach->shadow_cntl & 0x10)) { /*For 8514/A mode, take the shadow sets into account.*/
WRITE8(port, dev->v_total_reg, val >> 8);
dev->v_total_reg &= 0x1fff;
WRITE8(port, dev->vtotal_reg, val >> 8);
dev->vtotal_reg &= 0x1fff;
}
}
mach_log("[%04X:%08X]: ATI 8514/A: (0x%04x): hdisp=0x%02x.\n", CS, cpu_state.pc, port, val);
@@ -3232,17 +3202,17 @@ mach_accel_out_fifo(mach_t *mach, svga_t *svga, ibm8514_t *dev, uint16_t port, u
if (len == 2) {
if ((mach->accel.clock_sel & 0x01) || (!(mach->accel.clock_sel & 0x01) && (mach->shadow_set & 0x03))) { /*For 8514/A mode, take the shadow sets into account.*/
if (!(mach->shadow_cntl & 0x20) && val) {
dev->vdisp_latch = val;
dev->vdisp_latch &= 0x1fff;
dev->vdisp_8514 = val;
dev->vdisp_8514 &= 0x1fff;
}
}
mach_log("ATI 8514/A: V_DISP write 16E8=%d\n", dev->vdisp_latch);
mach_log("ATI 8514/A: V_DISP write 16E8=%d\n", dev->vdisp_8514);
mach_log("ATI 8514/A: (0x%04x): vdisp=0x%02x.\n", port, val);
} else {
if ((mach->accel.clock_sel & 0x01) || (!(mach->accel.clock_sel & 0x01) && (mach->shadow_set & 0x03))) { /*For 8514/A mode, take the shadow sets into account.*/
if (!(mach->shadow_cntl & 0x20)) {
WRITE8(port, dev->vdisp_latch, val);
dev->vdisp_latch &= 0x1fff;
WRITE8(port, dev->vdisp_8514, val);
dev->vdisp_8514 &= 0x1fff;
}
}
}
@@ -3252,11 +3222,11 @@ mach_accel_out_fifo(mach_t *mach, svga_t *svga, ibm8514_t *dev, uint16_t port, u
if (len == 1) {
if ((mach->accel.clock_sel & 0x01) || (!(mach->accel.clock_sel & 0x01) && (mach->shadow_set & 0x03))) { /*For 8514/A mode, take the shadow sets into account.*/
if (!(mach->shadow_cntl & 0x20)) {
WRITE8(port, dev->vdisp_latch, val >> 8);
dev->vdisp_latch &= 0x1fff;
WRITE8(port, dev->vdisp_8514, val >> 8);
dev->vdisp_8514 &= 0x1fff;
}
}
mach_log("ATI 8514/A: V_DISP write 16E8=%d.\n", dev->vdisp_latch);
mach_log("ATI 8514/A: V_DISP write 16E8=%d.\n", dev->vdisp_8514);
mach_log("ATI 8514/A: (0x%04x): vdisp=0x%02x.\n", port, val);
}
svga_recalctimings(svga);
@@ -3266,17 +3236,17 @@ mach_accel_out_fifo(mach_t *mach, svga_t *svga, ibm8514_t *dev, uint16_t port, u
if (len == 2) {
if ((mach->accel.clock_sel & 0x01) || (!(mach->accel.clock_sel & 0x01) && (mach->shadow_set & 0x03))) { /*For 8514/A mode, take the shadow sets into account.*/
if (!(mach->shadow_cntl & 0x10) && val) {
dev->v_sync_start = val;
dev->v_sync_start &= 0x1fff;
dev->vsyncstart = val;
dev->vsyncstart &= 0x1fff;
}
}
mach_log("ATI 8514/A: V_SYNCSTART write 1AE8 = %d\n", dev->v_syncstart);
mach_log("ATI 8514/A: VSYNCSTART write 1AE8 = %d\n", dev->vsyncstart);
mach_log("ATI 8514/A: (0x%04x): vsyncstart=0x%02x.\n", port, val);
} else {
if ((mach->accel.clock_sel & 0x01) || (!(mach->accel.clock_sel & 0x01) && (mach->shadow_set & 0x03))) { /*For 8514/A mode, take the shadow sets into account.*/
if (!(mach->shadow_cntl & 0x10)) {
WRITE8(port, dev->v_sync_start, val);
dev->v_sync_start &= 0x1fff;
WRITE8(port, dev->vsyncstart, val);
dev->vsyncstart &= 0x1fff;
}
}
}
@@ -3286,11 +3256,11 @@ mach_accel_out_fifo(mach_t *mach, svga_t *svga, ibm8514_t *dev, uint16_t port, u
if (len == 1) {
if ((mach->accel.clock_sel & 0x01) || (!(mach->accel.clock_sel & 0x01) && (mach->shadow_set & 0x03))) { /*For 8514/A mode, take the shadow sets into account.*/
if (!(mach->shadow_cntl & 0x10)) {
WRITE8(port, dev->v_sync_start, val >> 8);
dev->v_sync_start &= 0x1fff;
WRITE8(port, dev->vsyncstart, val >> 8);
dev->vsyncstart &= 0x1fff;
}
}
mach_log("ATI 8514/A: V_SYNCSTART write 1AE8 = %d\n", dev->v_syncstart);
mach_log("ATI 8514/A: VSYNCSTART write 1AE8 = %d\n", dev->vsyncstart);
mach_log("ATI 8514/A: (0x%04x): vsyncstart=0x%02x.\n", port, val);
}
svga_recalctimings(svga);
@@ -3322,7 +3292,6 @@ mach_accel_out_fifo(mach_t *mach, svga_t *svga, ibm8514_t *dev, uint16_t port, u
if ((dev->subsys_cntl & 0xc000) == 0x8000) {
mach->force_busy = 0;
dev->force_busy = 0;
dev->force_busy2 = 0;
}
break;
@@ -3348,7 +3317,7 @@ mach_accel_out_fifo(mach_t *mach, svga_t *svga, ibm8514_t *dev, uint16_t port, u
}
mach_log("[%04X:%08X]: ATI 8514/A: (0x%04x): ON=%d, valxor=%x, shadow crt=%x, hdisp=%d, vdisp=%d, extmode=%02x, accelbpp=%d, crt=%d, crtres=%d.\n",
CS, cpu_state.pc, port, val & 0x01, dev->on, dev->accel.advfunc_cntl & 0x04, dev->hdisp, dev->vdisp, mach->regs[0xb0] & 0x20, dev->accel_bpp, dev->_8514crt, mach->crt_resolution);
CS, cpu_state.pc, port, val & 0x01, dev->on, dev->accel.advfunc_cntl & 0x04, dev->hdisp_vga, dev->vdisp_vga, mach->regs[0xb0] & 0x20, dev->accel_bpp, dev->_8514crt, mach->crt_resolution);
if (ATI_MACH32) {
mach_set_resolution(mach, svga);
@@ -3531,7 +3500,7 @@ mach_accel_out_fifo(mach_t *mach, svga_t *svga, ibm8514_t *dev, uint16_t port, u
}
}
}
mach_log("Write Port=%04x, Busy=%02x.\n", port, dev->force_busy2);
mach_log("Write Port=%04x, Busy=%02x.\n", port, dev->force_busy);
break;
case 0xaae8:
@@ -3787,7 +3756,7 @@ mach_accel_out_fifo(mach_t *mach, svga_t *svga, ibm8514_t *dev, uint16_t port, u
dev->vendor_mode = 1;
mach_log("[%04X:%08X]: ATI 8514/A: (0x%04x): ON=%d, val=%04x, xor=%d, hdisp=%d, vdisp=%d, accelbpp=%d.\n",
CS, cpu_state.pc, port, mach->accel.clock_sel & 0x01, val, dev->on, dev->hdisp, dev->vdisp, dev->accel_bpp);
CS, cpu_state.pc, port, mach->accel.clock_sel & 0x01, val, dev->on, dev->hdisp_vga, dev->vdisp_vga, dev->accel_bpp);
mach_log("Vendor ATI mode set %s resolution.\n",
(dev->accel.advfunc_cntl & 0x04) ? "2: 1024x768" : "1: 640x480");
@@ -3995,7 +3964,6 @@ mach_accel_out_fifo(mach_t *mach, svga_t *svga, ibm8514_t *dev, uint16_t port, u
mach->accel.bres_count = val & 0x7ff;
mach_log("BresenhamDraw=%04x.\n", mach->accel.dp_config);
dev->data_available = 0;
dev->data_available2 = 0;
mach->accel.cmd_type = 1;
frgd_sel = (mach->accel.dp_config >> 13) & 7;
bkgd_sel = (mach->accel.dp_config >> 7) & 3;
@@ -4048,7 +4016,6 @@ mach_accel_out_fifo(mach_t *mach, svga_t *svga, ibm8514_t *dev, uint16_t port, u
mach->accel.dest_y_end = 0;
}
dev->data_available = 0;
dev->data_available2 = 0;
mach_log("BitBLT=%04x, pattidx=%d.\n", mach->accel.dp_config, mach->accel.patt_idx);
mach_log(".\n");
mach->accel.cmd_type = 2; /*Non-conforming BitBLT from dest_y_end register (0xaeee)*/
@@ -4111,7 +4078,6 @@ mach_accel_out_fifo(mach_t *mach, svga_t *svga, ibm8514_t *dev, uint16_t port, u
mach->accel.scan_to_x = 0;
}
dev->data_available = 0;
dev->data_available2 = 0;
mach->accel.cmd_type = 5; /*Horizontal Raster Draw from scan_to_x register (0xcaee)*/
mach_log("ScanToX len=%d.\n", val);
mach_log(".\n");
@@ -4133,7 +4099,6 @@ mach_accel_out_fifo(mach_t *mach, svga_t *svga, ibm8514_t *dev, uint16_t port, u
mach_log("Data Path Configuration (%04x) write val=%04x, len=%d.\n", port, val, len);
if (len == 2) {
dev->data_available = 0;
dev->data_available2 = 0;
mach->accel.dp_config = val;
}
break;
@@ -4371,26 +4336,26 @@ mach_accel_in_fifo(mach_t *mach, svga_t *svga, ibm8514_t *dev, uint16_t port, in
if (len == 1) {
dev->fifo_idx = 0;
if (dev->force_busy2)
if (dev->force_busy)
temp |= 0x02; /*Hardware busy*/
dev->force_busy2 = 0;
dev->force_busy = 0;
if (dev->data_available2) {
if (dev->data_available) {
temp |= 0x01; /*Read Data available*/
if (mach->accel.cmd_type >= 0) {
switch (mach->accel.cmd_type) {
case 2:
if (dev->accel.sy >= mach->accel.height)
dev->data_available2 = 0;
dev->data_available = 0;
break;
case 5:
if (dev->accel.sx >= mach->accel.width)
dev->data_available2 = 0;
dev->data_available = 0;
break;
default:
if (dev->accel.sy < 0)
dev->data_available2 = 0;
dev->data_available = 0;
break;
}
} else {
@@ -4400,11 +4365,11 @@ mach_accel_in_fifo(mach_t *mach, svga_t *svga, ibm8514_t *dev, uint16_t port, in
case 4:
case 6:
if (dev->accel.sy < 0)
dev->data_available2 = 0;
dev->data_available = 0;
break;
default:
if (!dev->accel.sy)
dev->data_available2 = 0;
dev->data_available = 0;
break;
}
}
@@ -4595,35 +4560,35 @@ mach_accel_in_fifo(mach_t *mach, svga_t *svga, ibm8514_t *dev, uint16_t port, in
case 0xc2ee:
if (len == 2)
temp = dev->v_total_reg;
temp = dev->vtotal_reg;
else
temp = dev->v_total_reg & 0xff;
temp = dev->vtotal_reg & 0xff;
break;
case 0xc2ef:
if (len == 1)
temp = dev->v_total_reg >> 8;
temp = dev->vtotal_reg >> 8;
break;
case 0xc6ee:
if (len == 2)
temp = dev->vdisp_latch;
temp = dev->vdisp_8514;
else
temp = dev->vdisp_latch & 0xff;
temp = dev->vdisp_8514 & 0xff;
break;
case 0xc6ef:
if (len == 1)
temp = dev->vdisp_latch >> 8;
temp = dev->vdisp_8514 >> 8;
break;
case 0xcaee:
if (len == 2)
temp = dev->v_sync_start;
temp = dev->vsyncstart;
else
temp = dev->v_sync_start & 0xff;
temp = dev->vsyncstart & 0xff;
break;
case 0xcaef:
if (len == 1)
temp = dev->v_sync_start >> 8;
temp = dev->vsyncstart >> 8;
break;
case 0xceee:
@@ -4787,10 +4752,8 @@ mach_accel_in_call(uint16_t port, mach_t *mach, svga_t *svga, ibm8514_t *dev)
if (!dev->fifo_idx && !dev->on) {
dev->force_busy = 0;
dev->force_busy2 = 0;
mach->force_busy = 0;
dev->data_available = 0;
dev->data_available2 = 0;
temp |= INT_FIFO_EMP;
mach_log("Fifo Empty.\n");
}
@@ -5224,7 +5187,7 @@ mach32_write_common(uint32_t addr, uint8_t val, int linear, mach_t *mach, svga_t
ibm8514_t *dev = (ibm8514_t *) svga->dev8514;
int writemask2 = svga->writemask;
int reset_wm = 0;
latch8514_t vall;
ibm8514_latch_t vall;
uint8_t wm = svga->writemask;
uint8_t i;
@@ -7039,7 +7002,6 @@ mach_reset(void *priv)
mach_disable_handlers(mach);
mach->force_busy = 0;
dev->force_busy = 0;
dev->force_busy2 = 0;
if (mach->pci_bus)
reset_state->pci_slot = mach->pci_slot;
@@ -7246,10 +7208,10 @@ ati8514_init(svga_t *svga, void *ext8514, void *dev8514)
dev->accel_bpp = 8;
dev->rowoffset = 0x80;
dev->hdisped = 0x7f;
dev->vdisp_latch = 0x05ff;
dev->vdisp_8514 = 0x05ff;
dev->htotal = 0x9d;
dev->v_total_reg = 0x0668;
dev->v_sync_start = 0x0600;
dev->vtotal_reg = 0x0668;
dev->vsyncstart = 0x0600;
dev->disp_cntl = 0x33;
mach->accel.clock_sel = 0x1c;
dev->accel.cmd_back = 1;