XGA: Revert to the rom_init routine to load the XGA-1/XGA-2 bios, this fixes intermittent hangs on the XGA-2 end (MCA only, ISA version is intact).
This commit is contained in:
@@ -671,6 +671,7 @@ xga_ext_inb(uint16_t addr, void *p)
|
|||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
#define READ(addr, dat) \
|
#define READ(addr, dat) \
|
||||||
dat = xga->vram[(addr) & (xga->vram_mask)];
|
dat = xga->vram[(addr) & (xga->vram_mask)];
|
||||||
|
|
||||||
@@ -694,75 +695,30 @@ xga_ext_inb(uint16_t addr, void *p)
|
|||||||
xga->vram[((addr)) & (xga->vram_mask - 1)] = dat >> 8; \
|
xga->vram[((addr)) & (xga->vram_mask - 1)] = dat >> 8; \
|
||||||
xga->changedvram[(((addr)) & (xga->vram_mask)) >> 12] = changeframecount;
|
xga->changedvram[(((addr)) & (xga->vram_mask)) >> 12] = changeframecount;
|
||||||
|
|
||||||
#define ROP(mix, d, s) \
|
#define ROP(mix, d, s) { \
|
||||||
{ \
|
|
||||||
switch ((mix) ? (xga->accel.frgd_mix & 0x1f) : (xga->accel.bkgd_mix & 0x1f)) { \
|
switch ((mix) ? (xga->accel.frgd_mix & 0x1f) : (xga->accel.bkgd_mix & 0x1f)) { \
|
||||||
case 0x00: \
|
case 0x00: d = 0; break; \
|
||||||
d = 0; \
|
case 0x01: d = s & d; break; \
|
||||||
break; \
|
case 0x02: d = s & ~d; break; \
|
||||||
case 0x01: \
|
case 0x03: d = s; break; \
|
||||||
d = s & d; \
|
case 0x04: d = ~s & d; break; \
|
||||||
break; \
|
case 0x05: d = d; break; \
|
||||||
case 0x02: \
|
case 0x06: d = s ^ d; break; \
|
||||||
d = s & ~d; \
|
case 0x07: d = s | d; break; \
|
||||||
break; \
|
case 0x08: d = ~s & ~d; break; \
|
||||||
case 0x03: \
|
case 0x09: d = s ^ ~d; break; \
|
||||||
d = s; \
|
case 0x0a: d = ~d; break; \
|
||||||
break; \
|
case 0x0b: d = s | ~d; break; \
|
||||||
case 0x04: \
|
case 0x0c: d = ~s; break; \
|
||||||
d = ~s & d; \
|
case 0x0d: d = ~s | d; break; \
|
||||||
break; \
|
case 0x0e: d = ~s | ~d; break; \
|
||||||
case 0x05: \
|
case 0x0f: d = ~0; break; \
|
||||||
d = d; \
|
case 0x10: d = MAX(s, d); break; \
|
||||||
break; \
|
case 0x11: d = MIN(s, d); break; \
|
||||||
case 0x06: \
|
case 0x12: d = MIN(0xff, s + d); break; \
|
||||||
d = s ^ d; \
|
case 0x13: d = MAX(0, d - s); break; \
|
||||||
break; \
|
case 0x14: d = MAX(0, s - d); break; \
|
||||||
case 0x07: \
|
case 0x15: d = (s + d) >> 1; break; \
|
||||||
d = s | d; \
|
|
||||||
break; \
|
|
||||||
case 0x08: \
|
|
||||||
d = ~s & ~d; \
|
|
||||||
break; \
|
|
||||||
case 0x09: \
|
|
||||||
d = s ^ ~d; \
|
|
||||||
break; \
|
|
||||||
case 0x0a: \
|
|
||||||
d = ~d; \
|
|
||||||
break; \
|
|
||||||
case 0x0b: \
|
|
||||||
d = s | ~d; \
|
|
||||||
break; \
|
|
||||||
case 0x0c: \
|
|
||||||
d = ~s; \
|
|
||||||
break; \
|
|
||||||
case 0x0d: \
|
|
||||||
d = ~s | d; \
|
|
||||||
break; \
|
|
||||||
case 0x0e: \
|
|
||||||
d = ~s | ~d; \
|
|
||||||
break; \
|
|
||||||
case 0x0f: \
|
|
||||||
d = ~0; \
|
|
||||||
break; \
|
|
||||||
case 0x10: \
|
|
||||||
d = MAX(s, d); \
|
|
||||||
break; \
|
|
||||||
case 0x11: \
|
|
||||||
d = MIN(s, d); \
|
|
||||||
break; \
|
|
||||||
case 0x12: \
|
|
||||||
d = MIN(0xff, s + d); \
|
|
||||||
break; \
|
|
||||||
case 0x13: \
|
|
||||||
d = MAX(0, d - s); \
|
|
||||||
break; \
|
|
||||||
case 0x14: \
|
|
||||||
d = MAX(0, s - d); \
|
|
||||||
break; \
|
|
||||||
case 0x15: \
|
|
||||||
d = (s + d) >> 1; \
|
|
||||||
break; \
|
|
||||||
} \
|
} \
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -803,6 +759,7 @@ xga_accel_read_pattern_map_pixel(svga_t *svga, int x, int y, int map, uint32_t b
|
|||||||
return px;
|
return px;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static uint32_t
|
static uint32_t
|
||||||
xga_accel_read_map_pixel(svga_t *svga, int x, int y, int map, uint32_t base, int width)
|
xga_accel_read_map_pixel(svga_t *svga, int x, int y, int map, uint32_t base, int width)
|
||||||
{
|
{
|
||||||
@@ -1004,11 +961,18 @@ xga_short_stroke(svga_t *svga, uint8_t ssv)
|
|||||||
if (xga->accel.pat_src == 8) {
|
if (xga->accel.pat_src == 8) {
|
||||||
while (y >= 0) {
|
while (y >= 0) {
|
||||||
if (xga->accel.command & 0xc0) {
|
if (xga->accel.command & 0xc0) {
|
||||||
if ((dx >= xga->accel.mask_map_origin_x_off) && (dx <= ((xga->accel.px_map_width[0] & 0xfff) + xga->accel.mask_map_origin_x_off)) && (dy >= xga->accel.mask_map_origin_y_off) && (dy <= ((xga->accel.px_map_height[0] & 0xfff) + xga->accel.mask_map_origin_y_off))) {
|
if ((dx >= xga->accel.mask_map_origin_x_off) && (dx <= ((xga->accel.px_map_width[0] & 0xfff) + xga->accel.mask_map_origin_x_off)) &&
|
||||||
|
(dy >= xga->accel.mask_map_origin_y_off) && (dy <= ((xga->accel.px_map_height[0] & 0xfff) + xga->accel.mask_map_origin_y_off))) {
|
||||||
src_dat = (((xga->accel.command >> 28) & 3) == 2) ? xga_accel_read_map_pixel(svga, xga->accel.src_map_x & 0xfff, xga->accel.src_map_y & 0xfff, xga->accel.src_map, srcbase, xga->accel.px_map_width[xga->accel.src_map] + 1) : xga->accel.frgd_color;
|
src_dat = (((xga->accel.command >> 28) & 3) == 2) ? xga_accel_read_map_pixel(svga, xga->accel.src_map_x & 0xfff, xga->accel.src_map_y & 0xfff, xga->accel.src_map, srcbase, xga->accel.px_map_width[xga->accel.src_map] + 1) : xga->accel.frgd_color;
|
||||||
dest_dat = xga_accel_read_map_pixel(svga, dx, dy, xga->accel.dst_map, dstbase, xga->accel.px_map_width[xga->accel.dst_map] + 1);
|
dest_dat = xga_accel_read_map_pixel(svga, dx, dy, xga->accel.dst_map, dstbase, xga->accel.px_map_width[xga->accel.dst_map] + 1);
|
||||||
|
|
||||||
if ((xga->accel.cc_cond == 4) || ((xga->accel.cc_cond == 1) && (dest_dat > color_cmp)) || ((xga->accel.cc_cond == 2) && (dest_dat == color_cmp)) || ((xga->accel.cc_cond == 3) && (dest_dat < color_cmp)) || ((xga->accel.cc_cond == 5) && (dest_dat >= color_cmp)) || ((xga->accel.cc_cond == 6) && (dest_dat != color_cmp)) || ((xga->accel.cc_cond == 7) && (dest_dat <= color_cmp))) {
|
if ((xga->accel.cc_cond == 4) ||
|
||||||
|
((xga->accel.cc_cond == 1) && (dest_dat > color_cmp)) ||
|
||||||
|
((xga->accel.cc_cond == 2) && (dest_dat == color_cmp)) ||
|
||||||
|
((xga->accel.cc_cond == 3) && (dest_dat < color_cmp)) ||
|
||||||
|
((xga->accel.cc_cond == 5) && (dest_dat >= color_cmp)) ||
|
||||||
|
((xga->accel.cc_cond == 6) && (dest_dat != color_cmp)) ||
|
||||||
|
((xga->accel.cc_cond == 7) && (dest_dat <= color_cmp))) {
|
||||||
old_dest_dat = dest_dat;
|
old_dest_dat = dest_dat;
|
||||||
ROP(1, dest_dat, src_dat);
|
ROP(1, dest_dat, src_dat);
|
||||||
dest_dat = (dest_dat & plane_mask) | (old_dest_dat & ~plane_mask);
|
dest_dat = (dest_dat & plane_mask) | (old_dest_dat & ~plane_mask);
|
||||||
@@ -1028,7 +992,13 @@ xga_short_stroke(svga_t *svga, uint8_t ssv)
|
|||||||
src_dat = (((xga->accel.command >> 28) & 3) == 2) ? xga_accel_read_map_pixel(svga, xga->accel.src_map_x & 0xfff, xga->accel.src_map_y & 0xfff, xga->accel.src_map, srcbase, xga->accel.px_map_width[xga->accel.src_map] + 1) : xga->accel.frgd_color;
|
src_dat = (((xga->accel.command >> 28) & 3) == 2) ? xga_accel_read_map_pixel(svga, xga->accel.src_map_x & 0xfff, xga->accel.src_map_y & 0xfff, xga->accel.src_map, srcbase, xga->accel.px_map_width[xga->accel.src_map] + 1) : xga->accel.frgd_color;
|
||||||
dest_dat = xga_accel_read_map_pixel(svga, dx, dy, xga->accel.dst_map, dstbase, xga->accel.px_map_width[xga->accel.dst_map] + 1);
|
dest_dat = xga_accel_read_map_pixel(svga, dx, dy, xga->accel.dst_map, dstbase, xga->accel.px_map_width[xga->accel.dst_map] + 1);
|
||||||
|
|
||||||
if ((xga->accel.cc_cond == 4) || ((xga->accel.cc_cond == 1) && (dest_dat > color_cmp)) || ((xga->accel.cc_cond == 2) && (dest_dat == color_cmp)) || ((xga->accel.cc_cond == 3) && (dest_dat < color_cmp)) || ((xga->accel.cc_cond == 5) && (dest_dat >= color_cmp)) || ((xga->accel.cc_cond == 6) && (dest_dat != color_cmp)) || ((xga->accel.cc_cond == 7) && (dest_dat <= color_cmp))) {
|
if ((xga->accel.cc_cond == 4) ||
|
||||||
|
((xga->accel.cc_cond == 1) && (dest_dat > color_cmp)) ||
|
||||||
|
((xga->accel.cc_cond == 2) && (dest_dat == color_cmp)) ||
|
||||||
|
((xga->accel.cc_cond == 3) && (dest_dat < color_cmp)) ||
|
||||||
|
((xga->accel.cc_cond == 5) && (dest_dat >= color_cmp)) ||
|
||||||
|
((xga->accel.cc_cond == 6) && (dest_dat != color_cmp)) ||
|
||||||
|
((xga->accel.cc_cond == 7) && (dest_dat <= color_cmp))) {
|
||||||
old_dest_dat = dest_dat;
|
old_dest_dat = dest_dat;
|
||||||
ROP(1, dest_dat, src_dat);
|
ROP(1, dest_dat, src_dat);
|
||||||
dest_dat = (dest_dat & plane_mask) | (old_dest_dat & ~plane_mask);
|
dest_dat = (dest_dat & plane_mask) | (old_dest_dat & ~plane_mask);
|
||||||
@@ -1061,10 +1031,7 @@ xga_short_stroke(svga_t *svga, uint8_t ssv)
|
|||||||
xga->accel.dst_map_y = dy;
|
xga->accel.dst_map_y = dy;
|
||||||
}
|
}
|
||||||
|
|
||||||
#define SWAP(a, b) \
|
#define SWAP(a,b) tmpswap = a; a = b; b = tmpswap;
|
||||||
tmpswap = a; \
|
|
||||||
a = b; \
|
|
||||||
b = tmpswap;
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
xga_line_draw_write(svga_t *svga)
|
xga_line_draw_write(svga_t *svga)
|
||||||
@@ -1127,11 +1094,18 @@ xga_line_draw_write(svga_t *svga)
|
|||||||
while (y >= 0) {
|
while (y >= 0) {
|
||||||
if (xga->accel.command & 0xc0) {
|
if (xga->accel.command & 0xc0) {
|
||||||
if (steep) {
|
if (steep) {
|
||||||
if ((dx >= xga->accel.mask_map_origin_x_off) && (dx <= ((xga->accel.px_map_width[0] & 0xfff) + xga->accel.mask_map_origin_x_off)) && (dy >= xga->accel.mask_map_origin_y_off) && (dy <= ((xga->accel.px_map_height[0] & 0xfff) + xga->accel.mask_map_origin_y_off))) {
|
if ((dx >= xga->accel.mask_map_origin_x_off) && (dx <= ((xga->accel.px_map_width[0] & 0xfff) + xga->accel.mask_map_origin_x_off)) &&
|
||||||
|
(dy >= xga->accel.mask_map_origin_y_off) && (dy <= ((xga->accel.px_map_height[0] & 0xfff) + xga->accel.mask_map_origin_y_off))) {
|
||||||
src_dat = (((xga->accel.command >> 28) & 3) == 2) ? xga_accel_read_map_pixel(svga, xga->accel.src_map_x & 0xfff, xga->accel.src_map_y & 0xfff, xga->accel.src_map, srcbase, xga->accel.px_map_width[xga->accel.src_map] + 1) : xga->accel.frgd_color;
|
src_dat = (((xga->accel.command >> 28) & 3) == 2) ? xga_accel_read_map_pixel(svga, xga->accel.src_map_x & 0xfff, xga->accel.src_map_y & 0xfff, xga->accel.src_map, srcbase, xga->accel.px_map_width[xga->accel.src_map] + 1) : xga->accel.frgd_color;
|
||||||
dest_dat = xga_accel_read_map_pixel(svga, dx, dy, xga->accel.dst_map, dstbase, xga->accel.px_map_width[xga->accel.dst_map] + 1);
|
dest_dat = xga_accel_read_map_pixel(svga, dx, dy, xga->accel.dst_map, dstbase, xga->accel.px_map_width[xga->accel.dst_map] + 1);
|
||||||
|
|
||||||
if ((xga->accel.cc_cond == 4) || ((xga->accel.cc_cond == 1) && (dest_dat > color_cmp)) || ((xga->accel.cc_cond == 2) && (dest_dat == color_cmp)) || ((xga->accel.cc_cond == 3) && (dest_dat < color_cmp)) || ((xga->accel.cc_cond == 5) && (dest_dat >= color_cmp)) || ((xga->accel.cc_cond == 6) && (dest_dat != color_cmp)) || ((xga->accel.cc_cond == 7) && (dest_dat <= color_cmp))) {
|
if ((xga->accel.cc_cond == 4) ||
|
||||||
|
((xga->accel.cc_cond == 1) && (dest_dat > color_cmp)) ||
|
||||||
|
((xga->accel.cc_cond == 2) && (dest_dat == color_cmp)) ||
|
||||||
|
((xga->accel.cc_cond == 3) && (dest_dat < color_cmp)) ||
|
||||||
|
((xga->accel.cc_cond == 5) && (dest_dat >= color_cmp)) ||
|
||||||
|
((xga->accel.cc_cond == 6) && (dest_dat != color_cmp)) ||
|
||||||
|
((xga->accel.cc_cond == 7) && (dest_dat <= color_cmp))) {
|
||||||
old_dest_dat = dest_dat;
|
old_dest_dat = dest_dat;
|
||||||
ROP(1, dest_dat, src_dat);
|
ROP(1, dest_dat, src_dat);
|
||||||
dest_dat = (dest_dat & plane_mask) | (old_dest_dat & ~plane_mask);
|
dest_dat = (dest_dat & plane_mask) | (old_dest_dat & ~plane_mask);
|
||||||
@@ -1144,11 +1118,18 @@ xga_line_draw_write(svga_t *svga)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if ((dy >= xga->accel.mask_map_origin_x_off) && (dy <= ((xga->accel.px_map_width[0] & 0xfff) + xga->accel.mask_map_origin_x_off)) && (dx >= xga->accel.mask_map_origin_y_off) && (dx <= ((xga->accel.px_map_height[0] & 0xfff) + xga->accel.mask_map_origin_y_off))) {
|
if ((dy >= xga->accel.mask_map_origin_x_off) && (dy <= ((xga->accel.px_map_width[0] & 0xfff) + xga->accel.mask_map_origin_x_off)) &&
|
||||||
|
(dx >= xga->accel.mask_map_origin_y_off) && (dx <= ((xga->accel.px_map_height[0] & 0xfff) + xga->accel.mask_map_origin_y_off))) {
|
||||||
src_dat = (((xga->accel.command >> 28) & 3) == 2) ? xga_accel_read_map_pixel(svga, xga->accel.src_map_x & 0xfff, xga->accel.src_map_y & 0xfff, xga->accel.src_map, srcbase, xga->accel.px_map_width[xga->accel.src_map] + 1) : xga->accel.frgd_color;
|
src_dat = (((xga->accel.command >> 28) & 3) == 2) ? xga_accel_read_map_pixel(svga, xga->accel.src_map_x & 0xfff, xga->accel.src_map_y & 0xfff, xga->accel.src_map, srcbase, xga->accel.px_map_width[xga->accel.src_map] + 1) : xga->accel.frgd_color;
|
||||||
dest_dat = xga_accel_read_map_pixel(svga, dy, dx, xga->accel.dst_map, dstbase, xga->accel.px_map_width[xga->accel.dst_map] + 1);
|
dest_dat = xga_accel_read_map_pixel(svga, dy, dx, xga->accel.dst_map, dstbase, xga->accel.px_map_width[xga->accel.dst_map] + 1);
|
||||||
|
|
||||||
if ((xga->accel.cc_cond == 4) || ((xga->accel.cc_cond == 1) && (dest_dat > color_cmp)) || ((xga->accel.cc_cond == 2) && (dest_dat == color_cmp)) || ((xga->accel.cc_cond == 3) && (dest_dat < color_cmp)) || ((xga->accel.cc_cond == 5) && (dest_dat >= color_cmp)) || ((xga->accel.cc_cond == 6) && (dest_dat != color_cmp)) || ((xga->accel.cc_cond == 7) && (dest_dat <= color_cmp))) {
|
if ((xga->accel.cc_cond == 4) ||
|
||||||
|
((xga->accel.cc_cond == 1) && (dest_dat > color_cmp)) ||
|
||||||
|
((xga->accel.cc_cond == 2) && (dest_dat == color_cmp)) ||
|
||||||
|
((xga->accel.cc_cond == 3) && (dest_dat < color_cmp)) ||
|
||||||
|
((xga->accel.cc_cond == 5) && (dest_dat >= color_cmp)) ||
|
||||||
|
((xga->accel.cc_cond == 6) && (dest_dat != color_cmp)) ||
|
||||||
|
((xga->accel.cc_cond == 7) && (dest_dat <= color_cmp))) {
|
||||||
old_dest_dat = dest_dat;
|
old_dest_dat = dest_dat;
|
||||||
ROP(1, dest_dat, src_dat);
|
ROP(1, dest_dat, src_dat);
|
||||||
dest_dat = (dest_dat & plane_mask) | (old_dest_dat & ~plane_mask);
|
dest_dat = (dest_dat & plane_mask) | (old_dest_dat & ~plane_mask);
|
||||||
@@ -1166,7 +1147,13 @@ xga_line_draw_write(svga_t *svga)
|
|||||||
src_dat = (((xga->accel.command >> 28) & 3) == 2) ? xga_accel_read_map_pixel(svga, xga->accel.src_map_x & 0xfff, xga->accel.src_map_y & 0xfff, xga->accel.src_map, srcbase, xga->accel.px_map_width[xga->accel.src_map] + 1) : xga->accel.frgd_color;
|
src_dat = (((xga->accel.command >> 28) & 3) == 2) ? xga_accel_read_map_pixel(svga, xga->accel.src_map_x & 0xfff, xga->accel.src_map_y & 0xfff, xga->accel.src_map, srcbase, xga->accel.px_map_width[xga->accel.src_map] + 1) : xga->accel.frgd_color;
|
||||||
dest_dat = xga_accel_read_map_pixel(svga, dx, dy, xga->accel.dst_map, dstbase, xga->accel.px_map_width[xga->accel.dst_map] + 1);
|
dest_dat = xga_accel_read_map_pixel(svga, dx, dy, xga->accel.dst_map, dstbase, xga->accel.px_map_width[xga->accel.dst_map] + 1);
|
||||||
|
|
||||||
if ((xga->accel.cc_cond == 4) || ((xga->accel.cc_cond == 1) && (dest_dat > color_cmp)) || ((xga->accel.cc_cond == 2) && (dest_dat == color_cmp)) || ((xga->accel.cc_cond == 3) && (dest_dat < color_cmp)) || ((xga->accel.cc_cond == 5) && (dest_dat >= color_cmp)) || ((xga->accel.cc_cond == 6) && (dest_dat != color_cmp)) || ((xga->accel.cc_cond == 7) && (dest_dat <= color_cmp))) {
|
if ((xga->accel.cc_cond == 4) ||
|
||||||
|
((xga->accel.cc_cond == 1) && (dest_dat > color_cmp)) ||
|
||||||
|
((xga->accel.cc_cond == 2) && (dest_dat == color_cmp)) ||
|
||||||
|
((xga->accel.cc_cond == 3) && (dest_dat < color_cmp)) ||
|
||||||
|
((xga->accel.cc_cond == 5) && (dest_dat >= color_cmp)) ||
|
||||||
|
((xga->accel.cc_cond == 6) && (dest_dat != color_cmp)) ||
|
||||||
|
((xga->accel.cc_cond == 7) && (dest_dat <= color_cmp))) {
|
||||||
old_dest_dat = dest_dat;
|
old_dest_dat = dest_dat;
|
||||||
ROP(1, dest_dat, src_dat);
|
ROP(1, dest_dat, src_dat);
|
||||||
dest_dat = (dest_dat & plane_mask) | (old_dest_dat & ~plane_mask);
|
dest_dat = (dest_dat & plane_mask) | (old_dest_dat & ~plane_mask);
|
||||||
@@ -1181,7 +1168,13 @@ xga_line_draw_write(svga_t *svga)
|
|||||||
src_dat = (((xga->accel.command >> 28) & 3) == 2) ? xga_accel_read_map_pixel(svga, xga->accel.src_map_x & 0xfff, xga->accel.src_map_y & 0xfff, xga->accel.src_map, srcbase, xga->accel.px_map_width[xga->accel.src_map] + 1) : xga->accel.frgd_color;
|
src_dat = (((xga->accel.command >> 28) & 3) == 2) ? xga_accel_read_map_pixel(svga, xga->accel.src_map_x & 0xfff, xga->accel.src_map_y & 0xfff, xga->accel.src_map, srcbase, xga->accel.px_map_width[xga->accel.src_map] + 1) : xga->accel.frgd_color;
|
||||||
dest_dat = xga_accel_read_map_pixel(svga, dy, dx, xga->accel.dst_map, dstbase, xga->accel.px_map_width[xga->accel.dst_map] + 1);
|
dest_dat = xga_accel_read_map_pixel(svga, dy, dx, xga->accel.dst_map, dstbase, xga->accel.px_map_width[xga->accel.dst_map] + 1);
|
||||||
|
|
||||||
if ((xga->accel.cc_cond == 4) || ((xga->accel.cc_cond == 1) && (dest_dat > color_cmp)) || ((xga->accel.cc_cond == 2) && (dest_dat == color_cmp)) || ((xga->accel.cc_cond == 3) && (dest_dat < color_cmp)) || ((xga->accel.cc_cond == 5) && (dest_dat >= color_cmp)) || ((xga->accel.cc_cond == 6) && (dest_dat != color_cmp)) || ((xga->accel.cc_cond == 7) && (dest_dat <= color_cmp))) {
|
if ((xga->accel.cc_cond == 4) ||
|
||||||
|
((xga->accel.cc_cond == 1) && (dest_dat > color_cmp)) ||
|
||||||
|
((xga->accel.cc_cond == 2) && (dest_dat == color_cmp)) ||
|
||||||
|
((xga->accel.cc_cond == 3) && (dest_dat < color_cmp)) ||
|
||||||
|
((xga->accel.cc_cond == 5) && (dest_dat >= color_cmp)) ||
|
||||||
|
((xga->accel.cc_cond == 6) && (dest_dat != color_cmp)) ||
|
||||||
|
((xga->accel.cc_cond == 7) && (dest_dat <= color_cmp))) {
|
||||||
old_dest_dat = dest_dat;
|
old_dest_dat = dest_dat;
|
||||||
ROP(1, dest_dat, src_dat);
|
ROP(1, dest_dat, src_dat);
|
||||||
dest_dat = (dest_dat & plane_mask) | (old_dest_dat & ~plane_mask);
|
dest_dat = (dest_dat & plane_mask) | (old_dest_dat & ~plane_mask);
|
||||||
@@ -1221,6 +1214,7 @@ xga_line_draw_write(svga_t *svga)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static int16_t
|
static int16_t
|
||||||
xga_dst_wrap(int16_t addr)
|
xga_dst_wrap(int16_t addr)
|
||||||
{
|
{
|
||||||
@@ -1287,11 +1281,18 @@ xga_bitblt(svga_t *svga)
|
|||||||
//pclog("CMD = %08x: Y = %d, X = %d, patsrc = %02x, srcmap = %d, dstmap = %d, py = %d, sy = %d, dy = %d, width0 = %d, width1 = %d, width2 = %d, width3 = %d\n", xga->accel.command, xga->accel.y, xga->accel.x, xga->accel.pat_src, xga->accel.src_map, xga->accel.dst_map, xga->accel.py, xga->accel.sy, xga->accel.dy, xga->accel.px_map_width[0], xga->accel.px_map_width[1], xga->accel.px_map_width[2], xga->accel.px_map_width[3]);
|
//pclog("CMD = %08x: Y = %d, X = %d, patsrc = %02x, srcmap = %d, dstmap = %d, py = %d, sy = %d, dy = %d, width0 = %d, width1 = %d, width2 = %d, width3 = %d\n", xga->accel.command, xga->accel.y, xga->accel.x, xga->accel.pat_src, xga->accel.src_map, xga->accel.dst_map, xga->accel.py, xga->accel.sy, xga->accel.dy, xga->accel.px_map_width[0], xga->accel.px_map_width[1], xga->accel.px_map_width[2], xga->accel.px_map_width[3]);
|
||||||
while (xga->accel.y >= 0) {
|
while (xga->accel.y >= 0) {
|
||||||
if (xga->accel.command & 0xc0) {
|
if (xga->accel.command & 0xc0) {
|
||||||
if ((xga->accel.dx >= xga->accel.mask_map_origin_x_off) && (xga->accel.dx <= ((xga->accel.px_map_width[0] & 0xfff) + xga->accel.mask_map_origin_x_off)) && (xga->accel.dy >= xga->accel.mask_map_origin_y_off) && (xga->accel.dy <= ((xga->accel.px_map_height[0] & 0xfff) + xga->accel.mask_map_origin_y_off))) {
|
if ((xga->accel.dx >= xga->accel.mask_map_origin_x_off) && (xga->accel.dx <= ((xga->accel.px_map_width[0] & 0xfff) + xga->accel.mask_map_origin_x_off)) &&
|
||||||
|
(xga->accel.dy >= xga->accel.mask_map_origin_y_off) && (xga->accel.dy <= ((xga->accel.px_map_height[0] & 0xfff) + xga->accel.mask_map_origin_y_off))) {
|
||||||
src_dat = (((xga->accel.command >> 28) & 3) == 2) ? xga_accel_read_map_pixel(svga, xga->accel.sx, xga->accel.sy, xga->accel.src_map, srcbase, srcwidth + 1) : xga->accel.frgd_color;
|
src_dat = (((xga->accel.command >> 28) & 3) == 2) ? xga_accel_read_map_pixel(svga, xga->accel.sx, xga->accel.sy, xga->accel.src_map, srcbase, srcwidth + 1) : xga->accel.frgd_color;
|
||||||
dest_dat = xga_accel_read_map_pixel(svga, xga->accel.dx, xga->accel.dy, xga->accel.dst_map, dstbase, dstwidth + 1);
|
dest_dat = xga_accel_read_map_pixel(svga, xga->accel.dx, xga->accel.dy, xga->accel.dst_map, dstbase, dstwidth + 1);
|
||||||
|
|
||||||
if ((xga->accel.cc_cond == 4) || ((xga->accel.cc_cond == 1) && (dest_dat > color_cmp)) || ((xga->accel.cc_cond == 2) && (dest_dat == color_cmp)) || ((xga->accel.cc_cond == 3) && (dest_dat < color_cmp)) || ((xga->accel.cc_cond == 5) && (dest_dat >= color_cmp)) || ((xga->accel.cc_cond == 6) && (dest_dat != color_cmp)) || ((xga->accel.cc_cond == 7) && (dest_dat <= color_cmp))) {
|
if ((xga->accel.cc_cond == 4) ||
|
||||||
|
((xga->accel.cc_cond == 1) && (dest_dat > color_cmp)) ||
|
||||||
|
((xga->accel.cc_cond == 2) && (dest_dat == color_cmp)) ||
|
||||||
|
((xga->accel.cc_cond == 3) && (dest_dat < color_cmp)) ||
|
||||||
|
((xga->accel.cc_cond == 5) && (dest_dat >= color_cmp)) ||
|
||||||
|
((xga->accel.cc_cond == 6) && (dest_dat != color_cmp)) ||
|
||||||
|
((xga->accel.cc_cond == 7) && (dest_dat <= color_cmp))) {
|
||||||
old_dest_dat = dest_dat;
|
old_dest_dat = dest_dat;
|
||||||
ROP(1, dest_dat, src_dat);
|
ROP(1, dest_dat, src_dat);
|
||||||
dest_dat = (dest_dat & plane_mask) | (old_dest_dat & ~plane_mask);
|
dest_dat = (dest_dat & plane_mask) | (old_dest_dat & ~plane_mask);
|
||||||
@@ -1302,7 +1303,13 @@ xga_bitblt(svga_t *svga)
|
|||||||
src_dat = (((xga->accel.command >> 28) & 3) == 2) ? xga_accel_read_map_pixel(svga, xga->accel.sx, xga->accel.sy, xga->accel.src_map, srcbase, srcwidth + 1) : xga->accel.frgd_color;
|
src_dat = (((xga->accel.command >> 28) & 3) == 2) ? xga_accel_read_map_pixel(svga, xga->accel.sx, xga->accel.sy, xga->accel.src_map, srcbase, srcwidth + 1) : xga->accel.frgd_color;
|
||||||
dest_dat = xga_accel_read_map_pixel(svga, xga->accel.dx, xga->accel.dy, xga->accel.dst_map, dstbase, dstwidth + 1);
|
dest_dat = xga_accel_read_map_pixel(svga, xga->accel.dx, xga->accel.dy, xga->accel.dst_map, dstbase, dstwidth + 1);
|
||||||
|
|
||||||
if ((xga->accel.cc_cond == 4) || ((xga->accel.cc_cond == 1) && (dest_dat > color_cmp)) || ((xga->accel.cc_cond == 2) && (dest_dat == color_cmp)) || ((xga->accel.cc_cond == 3) && (dest_dat < color_cmp)) || ((xga->accel.cc_cond == 5) && (dest_dat >= color_cmp)) || ((xga->accel.cc_cond == 6) && (dest_dat != color_cmp)) || ((xga->accel.cc_cond == 7) && (dest_dat <= color_cmp))) {
|
if ((xga->accel.cc_cond == 4) ||
|
||||||
|
((xga->accel.cc_cond == 1) && (dest_dat > color_cmp)) ||
|
||||||
|
((xga->accel.cc_cond == 2) && (dest_dat == color_cmp)) ||
|
||||||
|
((xga->accel.cc_cond == 3) && (dest_dat < color_cmp)) ||
|
||||||
|
((xga->accel.cc_cond == 5) && (dest_dat >= color_cmp)) ||
|
||||||
|
((xga->accel.cc_cond == 6) && (dest_dat != color_cmp)) ||
|
||||||
|
((xga->accel.cc_cond == 7) && (dest_dat <= color_cmp))) {
|
||||||
old_dest_dat = dest_dat;
|
old_dest_dat = dest_dat;
|
||||||
ROP(1, dest_dat, src_dat);
|
ROP(1, dest_dat, src_dat);
|
||||||
dest_dat = (dest_dat & plane_mask) | (old_dest_dat & ~plane_mask);
|
dest_dat = (dest_dat & plane_mask) | (old_dest_dat & ~plane_mask);
|
||||||
@@ -1367,7 +1374,8 @@ xga_bitblt(svga_t *svga)
|
|||||||
mix = xga_accel_read_pattern_map_pixel(svga, xga->accel.px, xga->accel.py, xga->accel.pat_src, patbase, patwidth + 1);
|
mix = xga_accel_read_pattern_map_pixel(svga, xga->accel.px, xga->accel.py, xga->accel.pat_src, patbase, patwidth + 1);
|
||||||
|
|
||||||
if (xga->accel.command & 0xc0) {
|
if (xga->accel.command & 0xc0) {
|
||||||
if ((xga->accel.dx >= xga->accel.mask_map_origin_x_off) && (xga->accel.dx <= ((xga->accel.px_map_width[0] & 0xfff) + xga->accel.mask_map_origin_x_off)) && (xga->accel.dy >= xga->accel.mask_map_origin_y_off) && (xga->accel.dy <= ((xga->accel.px_map_height[0] & 0xfff) + xga->accel.mask_map_origin_y_off))) {
|
if ((xga->accel.dx >= xga->accel.mask_map_origin_x_off) && (xga->accel.dx <= ((xga->accel.px_map_width[0] & 0xfff) + xga->accel.mask_map_origin_x_off)) &&
|
||||||
|
(xga->accel.dy >= xga->accel.mask_map_origin_y_off) && (xga->accel.dy <= ((xga->accel.px_map_height[0] & 0xfff) + xga->accel.mask_map_origin_y_off))) {
|
||||||
if (mix)
|
if (mix)
|
||||||
src_dat = (((xga->accel.command >> 28) & 3) == 2) ? xga_accel_read_map_pixel(svga, xga->accel.sx, xga->accel.sy, xga->accel.src_map, srcbase, srcwidth + 1) : xga->accel.frgd_color;
|
src_dat = (((xga->accel.command >> 28) & 3) == 2) ? xga_accel_read_map_pixel(svga, xga->accel.sx, xga->accel.sy, xga->accel.src_map, srcbase, srcwidth + 1) : xga->accel.frgd_color;
|
||||||
else
|
else
|
||||||
@@ -1375,7 +1383,13 @@ xga_bitblt(svga_t *svga)
|
|||||||
|
|
||||||
dest_dat = xga_accel_read_map_pixel(svga, xga->accel.dx, xga->accel.dy, xga->accel.dst_map, dstbase, dstwidth + 1);
|
dest_dat = xga_accel_read_map_pixel(svga, xga->accel.dx, xga->accel.dy, xga->accel.dst_map, dstbase, dstwidth + 1);
|
||||||
|
|
||||||
if ((xga->accel.cc_cond == 4) || ((xga->accel.cc_cond == 1) && (dest_dat > color_cmp)) || ((xga->accel.cc_cond == 2) && (dest_dat == color_cmp)) || ((xga->accel.cc_cond == 3) && (dest_dat < color_cmp)) || ((xga->accel.cc_cond == 5) && (dest_dat >= color_cmp)) || ((xga->accel.cc_cond == 6) && (dest_dat != color_cmp)) || ((xga->accel.cc_cond == 7) && (dest_dat <= color_cmp))) {
|
if ((xga->accel.cc_cond == 4) ||
|
||||||
|
((xga->accel.cc_cond == 1) && (dest_dat > color_cmp)) ||
|
||||||
|
((xga->accel.cc_cond == 2) && (dest_dat == color_cmp)) ||
|
||||||
|
((xga->accel.cc_cond == 3) && (dest_dat < color_cmp)) ||
|
||||||
|
((xga->accel.cc_cond == 5) && (dest_dat >= color_cmp)) ||
|
||||||
|
((xga->accel.cc_cond == 6) && (dest_dat != color_cmp)) ||
|
||||||
|
((xga->accel.cc_cond == 7) && (dest_dat <= color_cmp))) {
|
||||||
old_dest_dat = dest_dat;
|
old_dest_dat = dest_dat;
|
||||||
ROP(mix, dest_dat, src_dat);
|
ROP(mix, dest_dat, src_dat);
|
||||||
dest_dat = (dest_dat & plane_mask) | (old_dest_dat & ~plane_mask);
|
dest_dat = (dest_dat & plane_mask) | (old_dest_dat & ~plane_mask);
|
||||||
@@ -1390,7 +1404,13 @@ xga_bitblt(svga_t *svga)
|
|||||||
|
|
||||||
dest_dat = xga_accel_read_map_pixel(svga, xga->accel.dx, xga->accel.dy, xga->accel.dst_map, dstbase, dstwidth + 1);
|
dest_dat = xga_accel_read_map_pixel(svga, xga->accel.dx, xga->accel.dy, xga->accel.dst_map, dstbase, dstwidth + 1);
|
||||||
|
|
||||||
if ((xga->accel.cc_cond == 4) || ((xga->accel.cc_cond == 1) && (dest_dat > color_cmp)) || ((xga->accel.cc_cond == 2) && (dest_dat == color_cmp)) || ((xga->accel.cc_cond == 3) && (dest_dat < color_cmp)) || ((xga->accel.cc_cond == 5) && (dest_dat >= color_cmp)) || ((xga->accel.cc_cond == 6) && (dest_dat != color_cmp)) || ((xga->accel.cc_cond == 7) && (dest_dat <= color_cmp))) {
|
if ((xga->accel.cc_cond == 4) ||
|
||||||
|
((xga->accel.cc_cond == 1) && (dest_dat > color_cmp)) ||
|
||||||
|
((xga->accel.cc_cond == 2) && (dest_dat == color_cmp)) ||
|
||||||
|
((xga->accel.cc_cond == 3) && (dest_dat < color_cmp)) ||
|
||||||
|
((xga->accel.cc_cond == 5) && (dest_dat >= color_cmp)) ||
|
||||||
|
((xga->accel.cc_cond == 6) && (dest_dat != color_cmp)) ||
|
||||||
|
((xga->accel.cc_cond == 7) && (dest_dat <= color_cmp))) {
|
||||||
old_dest_dat = dest_dat;
|
old_dest_dat = dest_dat;
|
||||||
ROP(mix, dest_dat, src_dat);
|
ROP(mix, dest_dat, src_dat);
|
||||||
dest_dat = (dest_dat & plane_mask) | (old_dest_dat & ~plane_mask);
|
dest_dat = (dest_dat & plane_mask) | (old_dest_dat & ~plane_mask);
|
||||||
@@ -1398,6 +1418,7 @@ xga_bitblt(svga_t *svga)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
xga->accel.sx += xdir;
|
xga->accel.sx += xdir;
|
||||||
if (xga->accel.pattern)
|
if (xga->accel.pattern)
|
||||||
xga->accel.px = ((xga->accel.px + xdir) & patwidth) | (xga->accel.px & ~patwidth);
|
xga->accel.px = ((xga->accel.px + xdir) & patwidth) | (xga->accel.px & ~patwidth);
|
||||||
@@ -2412,7 +2433,8 @@ xga_readl_linear(uint32_t addr, void *p)
|
|||||||
if (!xga->on)
|
if (!xga->on)
|
||||||
return svga_readl_linear(addr, svga);
|
return svga_readl_linear(addr, svga);
|
||||||
|
|
||||||
return xga_read_linear(addr, p) | (xga_read_linear(addr + 1, p) << 8) | (xga_read_linear(addr + 2, p) << 16) | (xga_read_linear(addr + 3, p) << 24);
|
return xga_read_linear(addr, p) | (xga_read_linear(addr + 1, p) << 8) |
|
||||||
|
(xga_read_linear(addr + 2, p) << 16) | (xga_read_linear(addr + 3, p) << 24);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
@@ -2454,7 +2476,8 @@ xga_poll(xga_t *xga, svga_t *svga)
|
|||||||
xga->hwcursor_oddeven = 0;
|
xga->hwcursor_oddeven = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (xga->displine == (xga->hwcursor_latch.y + 1) && xga->hwcursor_latch.ena && xga->interlace) {
|
if (xga->displine == (xga->hwcursor_latch.y + 1) && xga->hwcursor_latch.ena &&
|
||||||
|
xga->interlace) {
|
||||||
xga->hwcursor_on = xga->hwcursor_latch.cur_ysize - (xga->cursor_data_on ? 33 : 1);
|
xga->hwcursor_on = xga->hwcursor_latch.cur_ysize - (xga->cursor_data_on ? 33 : 1);
|
||||||
xga->hwcursor_oddeven = 1;
|
xga->hwcursor_oddeven = 1;
|
||||||
}
|
}
|
||||||
@@ -2473,7 +2496,8 @@ xga_poll(xga_t *xga, svga_t *svga)
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (xga->hwcursor_on) {
|
if (xga->hwcursor_on) {
|
||||||
xga->changedvram[xga->ma >> 12] = xga->changedvram[(xga->ma >> 12) + 1] = xga->interlace ? 3 : 2;
|
xga->changedvram[xga->ma >> 12] = xga->changedvram[(xga->ma >> 12) + 1] =
|
||||||
|
xga->interlace ? 3 : 2;
|
||||||
}
|
}
|
||||||
|
|
||||||
xga_do_render(svga);
|
xga_do_render(svga);
|
||||||
@@ -2622,6 +2646,7 @@ xga_mca_write(int port, uint8_t val, void *priv)
|
|||||||
xga->rom_addr = 0xc0000 + (((xga->pos_regs[2] & 0xf0) >> 4) * 0x2000);
|
xga->rom_addr = 0xc0000 + (((xga->pos_regs[2] & 0xf0) >> 4) * 0x2000);
|
||||||
|
|
||||||
io_sethandler(0x2100 + (xga->instance << 4), 0x0010, xga_ext_inb, NULL, NULL, xga_ext_outb, NULL, NULL, svga);
|
io_sethandler(0x2100 + (xga->instance << 4), 0x0010, xga_ext_inb, NULL, NULL, xga_ext_outb, NULL, NULL, svga);
|
||||||
|
if ((port & 7) == 2)
|
||||||
mem_mapping_set_addr(&xga->bios_rom.mapping, xga->rom_addr, 0x2000);
|
mem_mapping_set_addr(&xga->bios_rom.mapping, xga->rom_addr, 0x2000);
|
||||||
mem_mapping_set_addr(&xga->memio_mapping, xga->rom_addr + 0x1c00 + (xga->instance * 0x80), 0x80);
|
mem_mapping_set_addr(&xga->memio_mapping, xga->rom_addr + 0x1c00 + (xga->instance * 0x80), 0x80);
|
||||||
}
|
}
|
||||||
@@ -2653,8 +2678,7 @@ xga_pos_in(uint16_t addr, void *priv)
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
*
|
*xga_init(const device_t *info)
|
||||||
xga_init(const device_t *info)
|
|
||||||
{
|
{
|
||||||
svga_t *svga = svga_get_pri();
|
svga_t *svga = svga_get_pri();
|
||||||
xga_t *xga = &svga->xga;
|
xga_t *xga = &svga->xga;
|
||||||
@@ -2684,7 +2708,7 @@ static void
|
|||||||
|
|
||||||
rom = malloc(xga->bios_rom.sz);
|
rom = malloc(xga->bios_rom.sz);
|
||||||
memset(rom, 0xff, xga->bios_rom.sz);
|
memset(rom, 0xff, xga->bios_rom.sz);
|
||||||
(void) !fread(rom, xga->bios_rom.sz, 1, f);
|
(void)fread(rom, xga->bios_rom.sz, 1, f);
|
||||||
temp -= xga->bios_rom.sz;
|
temp -= xga->bios_rom.sz;
|
||||||
(void)fclose(f);
|
(void)fclose(f);
|
||||||
|
|
||||||
@@ -2699,11 +2723,7 @@ static void
|
|||||||
xga->linear_base = 0;
|
xga->linear_base = 0;
|
||||||
xga->instance = 0;
|
xga->instance = 0;
|
||||||
xga->rom_addr = 0;
|
xga->rom_addr = 0;
|
||||||
mem_mapping_add(&xga->bios_rom.mapping,
|
rom_init(&xga->bios_rom, xga->type ? XGA2_BIOS_PATH : XGA_BIOS_PATH, initial_bios_addr, 0x2000, 0x1fff, 0, MEM_MAPPING_EXTERNAL);
|
||||||
initial_bios_addr, xga->bios_rom.sz,
|
|
||||||
rom_read, rom_readw, rom_readl,
|
|
||||||
NULL, NULL, NULL,
|
|
||||||
xga->bios_rom.rom, MEM_MAPPING_EXTERNAL, &xga->bios_rom);
|
|
||||||
} else {
|
} else {
|
||||||
xga->pos_regs[2] = 1 | 0x0c | 0xf0;
|
xga->pos_regs[2] = 1 | 0x0c | 0xf0;
|
||||||
xga->instance = (xga->pos_regs[2] & 0x0e) >> 1;
|
xga->instance = (xga->pos_regs[2] & 0x0e) >> 1;
|
||||||
|
Reference in New Issue
Block a user