XGA: made the source file compatible with the 86box clang-format style (ident) and actually fixed the 40 25 POST hang (the key element was bit 0 of MCA port 0x103).
This commit is contained in:
@@ -14,26 +14,26 @@
|
|||||||
*
|
*
|
||||||
* Copyright 2022 TheCollector1995.
|
* Copyright 2022 TheCollector1995.
|
||||||
*/
|
*/
|
||||||
#include <stdio.h>
|
#include "cpu.h"
|
||||||
#include <stdint.h>
|
|
||||||
#include <string.h>
|
|
||||||
#include <stdlib.h>
|
|
||||||
#include <wchar.h>
|
|
||||||
#include <86box/bswap.h>
|
|
||||||
#include <86box/86box.h>
|
#include <86box/86box.h>
|
||||||
|
#include <86box/bswap.h>
|
||||||
|
#include <86box/device.h>
|
||||||
|
#include <86box/dma.h>
|
||||||
#include <86box/io.h>
|
#include <86box/io.h>
|
||||||
#include <86box/machine.h>
|
#include <86box/machine.h>
|
||||||
#include <86box/mem.h>
|
|
||||||
#include <86box/dma.h>
|
|
||||||
#include <86box/rom.h>
|
|
||||||
#include <86box/mca.h>
|
#include <86box/mca.h>
|
||||||
#include <86box/device.h>
|
#include <86box/mem.h>
|
||||||
|
#include <86box/rom.h>
|
||||||
#include <86box/timer.h>
|
#include <86box/timer.h>
|
||||||
#include <86box/video.h>
|
|
||||||
#include <86box/vid_svga.h>
|
#include <86box/vid_svga.h>
|
||||||
#include <86box/vid_svga_render.h>
|
#include <86box/vid_svga_render.h>
|
||||||
#include <86box/vid_xga_device.h>
|
#include <86box/vid_xga_device.h>
|
||||||
#include "cpu.h"
|
#include <86box/video.h>
|
||||||
|
#include <stdint.h>
|
||||||
|
#include <stdio.h>
|
||||||
|
#include <stdlib.h>
|
||||||
|
#include <string.h>
|
||||||
|
#include <wchar.h>
|
||||||
|
|
||||||
#define XGA_BIOS_PATH "roms/video/xga/XGA_37F9576_Ver200.BIN"
|
#define XGA_BIOS_PATH "roms/video/xga/XGA_37F9576_Ver200.BIN"
|
||||||
#define XGA2_BIOS_PATH "roms/video/xga/xga2_v300.bin"
|
#define XGA2_BIOS_PATH "roms/video/xga/xga2_v300.bin"
|
||||||
@@ -671,7 +671,6 @@ 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)];
|
||||||
|
|
||||||
@@ -695,30 +694,75 @@ 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: d = 0; break; \
|
case 0x00: \
|
||||||
case 0x01: d = s & d; break; \
|
d = 0; \
|
||||||
case 0x02: d = s & ~d; break; \
|
break; \
|
||||||
case 0x03: d = s; break; \
|
case 0x01: \
|
||||||
case 0x04: d = ~s & d; break; \
|
d = s & d; \
|
||||||
case 0x05: d = d; break; \
|
break; \
|
||||||
case 0x06: d = s ^ d; break; \
|
case 0x02: \
|
||||||
case 0x07: d = s | d; break; \
|
d = s & ~d; \
|
||||||
case 0x08: d = ~s & ~d; break; \
|
break; \
|
||||||
case 0x09: d = s ^ ~d; break; \
|
case 0x03: \
|
||||||
case 0x0a: d = ~d; break; \
|
d = s; \
|
||||||
case 0x0b: d = s | ~d; break; \
|
break; \
|
||||||
case 0x0c: d = ~s; break; \
|
case 0x04: \
|
||||||
case 0x0d: d = ~s | d; break; \
|
d = ~s & d; \
|
||||||
case 0x0e: d = ~s | ~d; break; \
|
break; \
|
||||||
case 0x0f: d = ~0; break; \
|
case 0x05: \
|
||||||
case 0x10: d = MAX(s, d); break; \
|
d = d; \
|
||||||
case 0x11: d = MIN(s, d); break; \
|
break; \
|
||||||
case 0x12: d = MIN(0xff, s + d); break; \
|
case 0x06: \
|
||||||
case 0x13: d = MAX(0, d - s); break; \
|
d = s ^ d; \
|
||||||
case 0x14: d = MAX(0, s - d); break; \
|
break; \
|
||||||
case 0x15: d = (s + d) >> 1; break; \
|
case 0x07: \
|
||||||
|
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; \
|
||||||
} \
|
} \
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -759,7 +803,6 @@ 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)
|
||||||
{
|
{
|
||||||
@@ -961,18 +1004,11 @@ 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)) &&
|
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))) {
|
||||||
(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) ||
|
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))) {
|
||||||
((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);
|
||||||
@@ -992,13 +1028,7 @@ 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) ||
|
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))) {
|
||||||
((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);
|
||||||
@@ -1031,7 +1061,10 @@ 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) tmpswap = a; a = b; b = tmpswap;
|
#define SWAP(a, b) \
|
||||||
|
tmpswap = a; \
|
||||||
|
a = b; \
|
||||||
|
b = tmpswap;
|
||||||
|
|
||||||
static void
|
static void
|
||||||
xga_line_draw_write(svga_t *svga)
|
xga_line_draw_write(svga_t *svga)
|
||||||
@@ -1094,18 +1127,11 @@ 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)) &&
|
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))) {
|
||||||
(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) ||
|
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))) {
|
||||||
((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);
|
||||||
@@ -1118,18 +1144,11 @@ 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)) &&
|
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))) {
|
||||||
(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) ||
|
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))) {
|
||||||
((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);
|
||||||
@@ -1147,13 +1166,7 @@ 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) ||
|
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))) {
|
||||||
((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);
|
||||||
@@ -1168,13 +1181,7 @@ 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) ||
|
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))) {
|
||||||
((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);
|
||||||
@@ -1214,7 +1221,6 @@ 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)
|
||||||
{
|
{
|
||||||
@@ -1281,18 +1287,11 @@ 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)) &&
|
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))) {
|
||||||
(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) ||
|
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))) {
|
||||||
((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);
|
||||||
@@ -1303,13 +1302,7 @@ 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) ||
|
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))) {
|
||||||
((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);
|
||||||
@@ -1374,8 +1367,7 @@ 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)) &&
|
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))) {
|
||||||
(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
|
||||||
@@ -1383,13 +1375,7 @@ 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) ||
|
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))) {
|
||||||
((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);
|
||||||
@@ -1404,13 +1390,7 @@ 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) ||
|
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))) {
|
||||||
((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);
|
||||||
@@ -1418,7 +1398,6 @@ 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);
|
||||||
@@ -2433,8 +2412,7 @@ 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) |
|
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);
|
||||||
(xga_read_linear(addr + 2, p) << 16) | (xga_read_linear(addr + 3, p) << 24);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
@@ -2476,8 +2454,7 @@ 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 &&
|
if (xga->displine == (xga->hwcursor_latch.y + 1) && xga->hwcursor_latch.ena && xga->interlace) {
|
||||||
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;
|
||||||
}
|
}
|
||||||
@@ -2496,8 +2473,7 @@ 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->changedvram[xga->ma >> 12] = xga->changedvram[(xga->ma >> 12) + 1] = xga->interlace ? 3 : 2;
|
||||||
xga->interlace ? 3 : 2;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
xga_do_render(svga);
|
xga_do_render(svga);
|
||||||
@@ -2638,7 +2614,6 @@ xga_mca_write(int port, uint8_t val, void *priv)
|
|||||||
if (!(xga->pos_regs[4] & 1)) /*MCA 4MB addressing on systems with more than 16MB of memory*/
|
if (!(xga->pos_regs[4] & 1)) /*MCA 4MB addressing on systems with more than 16MB of memory*/
|
||||||
xga->pos_regs[4] |= 1;
|
xga->pos_regs[4] |= 1;
|
||||||
|
|
||||||
//pclog("[%04X:%08X]: POS Write Port = %x, val = %02x, linear base = %08x, instance = %d, rom addr = %05x\n", CS, cpu_state.pc, port & 7, val, xga->linear_base, xga->instance, xga->rom_addr);
|
|
||||||
if (xga->pos_regs[2] & 1) {
|
if (xga->pos_regs[2] & 1) {
|
||||||
xga->instance = (xga->pos_regs[2] & 0x0e) >> 1;
|
xga->instance = (xga->pos_regs[2] & 0x0e) >> 1;
|
||||||
xga->base_addr_1mb = (xga->pos_regs[5] & 0x0f) << 20;
|
xga->base_addr_1mb = (xga->pos_regs[5] & 0x0f) << 20;
|
||||||
@@ -2646,11 +2621,15 @@ 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)
|
|
||||||
|
if (xga->pos_regs[3] & 1) {
|
||||||
mem_mapping_set_addr(&xga->bios_rom.mapping, xga->rom_addr, 0x2000);
|
mem_mapping_set_addr(&xga->bios_rom.mapping, xga->rom_addr, 0x2000);
|
||||||
|
} else {
|
||||||
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);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
// pclog("[%04X:%08X]: POS Write Port = %x, val = %02x, linear base = %08x, instance = %d, rom addr = %05x\n", CS, cpu_state.pc, port & 7, val, xga->linear_base, xga->instance, xga->rom_addr);
|
||||||
|
}
|
||||||
|
|
||||||
static uint8_t
|
static uint8_t
|
||||||
xga_mca_feedb(void *priv)
|
xga_mca_feedb(void *priv)
|
||||||
@@ -2678,7 +2657,8 @@ 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;
|
||||||
|
Reference in New Issue
Block a user