New batch of ATI Mach8/32 changes:

1. Hopefully fixed the passthrough stuff for good and fixed typo's in the IBM 8514/A poll function about the cursor.
2. Eliminated the ibm8514_on global variable in favor of a struct variable to be consistent with XGA.
This commit is contained in:
TC1995
2023-08-15 00:11:56 +02:00
parent 9810269d39
commit 59811075db
5 changed files with 547 additions and 273 deletions

View File

@@ -42,6 +42,8 @@ typedef struct ibm8514_t {
int type;
int local;
int bpp;
int on;
int accel_bpp;
uint32_t vram_size;
uint32_t vram_mask;

View File

@@ -182,6 +182,7 @@ typedef struct svga_t {
hwcursor_t overlay_latch;
void (*render)(struct svga_t *svga);
void (*render8514)(struct svga_t *svga);
void (*recalctimings_ex)(struct svga_t *svga);
void (*video_out)(uint16_t addr, uint8_t val, void *priv);
@@ -271,7 +272,6 @@ typedef struct svga_t {
} svga_t;
extern int vga_on;
extern int ibm8514_on;
extern void ibm8514_poll(ibm8514_t *dev, svga_t *svga);
extern void ibm8514_recalctimings(svga_t *svga);

View File

@@ -962,8 +962,8 @@ ibm8514_accel_out(uint16_t port, uint32_t val, svga_t *svga, int len)
if (!val)
break;
dev->accel.advfunc_cntl = val & 0x0f;
ibm8514_on = val & 0x01;
vga_on = !ibm8514_on;
dev->on = val & 0x01;
vga_on = !dev->on;
ibm8514_log("IBM 8514/A: VGA ON = %i, val = %02x\n", vga_on, val);
svga_recalctimings(svga);
break;
@@ -4028,7 +4028,7 @@ ibm8514_poll(ibm8514_t *dev, svga_t *svga)
dev->hwcursor_oddeven = 0;
}
if ((dev->displine == (svga->hwcursor_latch.y + 1)) && dev->hwcursor_latch.ena && dev->interlace) {
if ((dev->displine == (dev->hwcursor_latch.y + 1)) && dev->hwcursor_latch.ena && dev->interlace) {
dev->hwcursor_on = dev->hwcursor_latch.cur_ysize - (dev->hwcursor_latch.yoff + 1);
dev->hwcursor_oddeven = 1;
}
@@ -4044,13 +4044,13 @@ ibm8514_poll(ibm8514_t *dev, svga_t *svga)
if (dev->firstline == 2000) {
dev->firstline = dev->displine;
video_wait_for_buffer();
video_wait_for_buffer_monitor(svga->monitor_index);
}
if (dev->hwcursor_on)
dev->changedvram[dev->ma >> 12] = dev->changedvram[(dev->ma >> 12) + 1] = dev->interlace ? 3 : 2;
svga->render(svga);
svga->render8514(svga);
svga->x_add = (overscan_x >> 1);
ibm8514_render_overscan_left(dev, svga);
@@ -4136,7 +4136,7 @@ ibm8514_poll(ibm8514_t *dev, svga_t *svga)
dev->oddeven ^= 1;
changeframecount = dev->interlace ? 3 : 2;
svga->monitor->mon_changeframecount = dev->interlace ? 3 : 2;
svga->vslines = 0;
if (dev->interlace && dev->oddeven)
@@ -4166,7 +4166,7 @@ ibm8514_recalctimings(svga_t *svga)
{
ibm8514_t *dev = &svga->dev8514;
if (ibm8514_on) {
if (dev->on) {
dev->h_disp = (dev->hdisp + 1) << 3;
dev->pitch = (dev->accel.advfunc_cntl & 4) ? 1024 : 640;
dev->h_total = (dev->htotal + 1);
@@ -4223,7 +4223,7 @@ ibm8514_recalctimings(svga_t *svga)
svga->clock = (cpuclock * (double) (1ULL << 32)) / 25175000.0;
}
svga->render = ibm8514_render_8bpp;
svga->render8514 = ibm8514_render_8bpp;
ibm8514_log("BPP=%d, Pitch = %d, rowoffset = %d, crtc13 = %02x, mode = %d, highres bit = %02x, has_vga? = %d.\n", dev->bpp, dev->pitch, dev->rowoffset, svga->crtc[0x13], dev->ibm_mode, dev->accel.advfunc_cntl & 4, ibm8514_has_vga);
}
ibm8514_log("8514 enabled, hdisp=%d, vtotal=%d, htotal=%d, dispend=%d, rowoffset=%d, split=%d, vsyncstart=%d, split=%08x\n", dev->hdisp, dev->vtotal, dev->htotal, dev->dispend, dev->rowoffset, dev->split, dev->vsyncstart, dev->split);

File diff suppressed because it is too large Load Diff

View File

@@ -56,7 +56,6 @@ uint8_t svga_rotate[8][256];
only SVGA device.*/
static svga_t *svga_pri;
int vga_on;
int ibm8514_on;
#ifdef ENABLE_SVGA_LOG
int svga_do_log = ENABLE_SVGA_LOG;
@@ -211,7 +210,7 @@ svga_out(uint16_t addr, uint8_t val, void *priv)
if (xga_enabled)
xga->on = (val & 0x01) ? 0 : 1;
if (ibm8514_enabled)
ibm8514_on = (val & 0x01) ? 0 : 1;
dev->on = (val & 0x01) ? 0 : 1;
vga_on = val & 0x01;
break;
@@ -518,21 +517,20 @@ svga_set_ramdac_type(svga_t *svga, int type)
svga->ramdac_type = type;
for (int c = 0; c < 256; c++) {
if (ibm8514_on) {
if (ibm8514_enabled) {
if (svga->ramdac_type == RAMDAC_8BIT)
dev->pallook[c] = makecol32(svga->vgapal[c].r, svga->vgapal[c].g, svga->vgapal[c].b);
else
dev->pallook[c] = makecol32((svga->vgapal[c].r & 0x3f) * 4,
(svga->vgapal[c].g & 0x3f) * 4,
(svga->vgapal[c].b & 0x3f) * 4);
} else {
if (svga->ramdac_type == RAMDAC_8BIT)
svga->pallook[c] = makecol32(svga->vgapal[c].r, svga->vgapal[c].g, svga->vgapal[c].b);
else
svga->pallook[c] = makecol32((svga->vgapal[c].r & 0x3f) * 4,
(svga->vgapal[c].g & 0x3f) * 4,
(svga->vgapal[c].b & 0x3f) * 4);
}
if (svga->ramdac_type == RAMDAC_8BIT)
svga->pallook[c] = makecol32(svga->vgapal[c].r, svga->vgapal[c].g, svga->vgapal[c].b);
else
svga->pallook[c] = makecol32((svga->vgapal[c].r & 0x3f) * 4,
(svga->vgapal[c].g & 0x3f) * 4,
(svga->vgapal[c].b & 0x3f) * 4);
}
}
}
@@ -540,7 +538,7 @@ svga_set_ramdac_type(svga_t *svga, int type)
void
svga_recalctimings(svga_t *svga)
{
const ibm8514_t *dev = &svga->dev8514;
ibm8514_t *dev = &svga->dev8514;
double crtcconst;
double _dispontime;
double _dispofftime;
@@ -727,13 +725,8 @@ svga_recalctimings(svga_t *svga)
crtcconst = svga->clock * svga->char_width;
if (ibm8514_on) {
disptime = dev->h_total;
_dispontime = dev->h_disp;
} else {
disptime = svga->htotal;
_dispontime = svga->hdisp_time;
}
disptime = svga->htotal;
_dispontime = svga->hdisp_time;
if (svga->seqregs[1] & 8) {
disptime *= 2;
@@ -822,10 +815,11 @@ svga_poll(void *priv)
int ret;
int old_ma;
if (ibm8514_enabled && ibm8514_on) {
if (ibm8514_enabled && dev->on) {
ibm8514_poll(dev, svga);
return;
} else if (xga_enabled && xga->on) {
}
if (xga_enabled && xga->on) {
xga_poll(xga, svga);
return;
}
@@ -1283,18 +1277,10 @@ svga_write_common(uint32_t addr, uint8_t val, uint8_t linear, void *priv)
if (addr & 1)
writemask2 <<= 1;
addr &= ~1;
if (linear && ibm8514_on && (svga->adv_flags & FLAG_ATI)) {
addr &= svga->vram_mask;
} else
addr <<= 2;
} else {
if (linear && ibm8514_on && (svga->adv_flags & FLAG_ATI)) {
writemask2 = 1 << (addr & 3);
addr &= ~3;
addr &= svga->vram_mask;
} else
addr <<= 2;
}
addr <<= 2;
} else
addr <<= 2;
addr &= svga->decode_mask;
if (svga->translate_address)
@@ -1504,22 +1490,10 @@ svga_read_common(uint32_t addr, uint8_t linear, void *priv)
} else if (svga->chain2_read) {
readplane = (readplane & 2) | (addr & 1);
addr &= ~1;
if (linear && ibm8514_on && (svga->adv_flags & FLAG_ATI))
addr &= svga->vram_mask;
else
addr <<= 2;
} else {
if (linear && ibm8514_on && (svga->adv_flags & FLAG_ATI)) {
addr &= svga->decode_mask;
if (addr >= svga->vram_max)
return 0xff;
latch_addr = (addr & svga->vram_mask) & ~3;
for (uint8_t i = 0; i < count; i++)
svga->latch.b[i] = svga->vram[latch_addr | i];
return svga->vram[addr & svga->vram_mask];
} else
addr <<= 2;
}
addr <<= 2;
} else
addr <<= 2;
addr &= svga->decode_mask;
if (svga->translate_address) {