EGA: Fix colors in mono mode and attribute registers, fixes #5395.
This commit is contained in:
@@ -112,10 +112,13 @@ ega_out(uint16_t addr, uint8_t val, void *priv)
|
||||
ega->fullchange = changeframecount;
|
||||
if (ega->attraddr == 0x10 || ega->attraddr == 0x14 || ega->attraddr < 0x10) {
|
||||
for (uint8_t c = 0; c < 16; c++) {
|
||||
if (ega->attrregs[0x10] & 0x80)
|
||||
ega->egapal[c] = (ega->attrregs[c] & 0xf) | ((ega->attrregs[0x14] & 0xf) << 4);
|
||||
else
|
||||
ega->egapal[c] = (ega->attrregs[c] & 0x3f) | ((ega->attrregs[0x14] & 0xc) << 4);
|
||||
if (ega->chipset) {
|
||||
if (ega->attrregs[0x10] & 0x80)
|
||||
ega->egapal[c] = (ega->attrregs[c] & 0xf) | ((ega->attrregs[0x14] & 0xf) << 4);
|
||||
else
|
||||
ega->egapal[c] = (ega->attrregs[c] & 0x3f) | ((ega->attrregs[0x14] & 0xc) << 4);
|
||||
} else
|
||||
ega->egapal[c] = ega->attrregs[c] & 0x3f;
|
||||
}
|
||||
ega->fullchange = changeframecount;
|
||||
}
|
||||
|
||||
@@ -172,15 +172,19 @@ ega_render_text(ega_t *ega)
|
||||
|
||||
uint32_t dat = ega->vram[charaddr + (ega->sc << 2)];
|
||||
dat <<= 1;
|
||||
if ((chr & ~0x1F) == 0xC0 && attrlinechars)
|
||||
if (((chr & ~0x1f) == 0xc0) && attrlinechars)
|
||||
dat |= (dat >> 1) & 1;
|
||||
|
||||
for (int xx = 0; xx < charwidth; xx++) {
|
||||
if (monoattrs) {
|
||||
int bit = (dat & (0x100 >> (xx >> dwshift))) ? 1 : 0;
|
||||
int blink = (!drawcursor && (attr & 0x80) && attrblink && blinked);
|
||||
if ((ega->sc == ega->crtc[0x14]) && ((attr & 7) == 1))
|
||||
p[xx] = ega->mdacols[attr][attrblink][1];
|
||||
p[xx] = ega->mdacols[attr][blink][1];
|
||||
else
|
||||
p[xx] = ega->mdacols[attr][attrblink][dat & (0x100 >> (xx >> dwshift))];
|
||||
p[xx] = ega->mdacols[attr][blink][bit];
|
||||
if (drawcursor)
|
||||
p[xx] ^= ega->mdacols[attr][0][1];
|
||||
p[xx] = ega->pallook[ega->egapal[p[xx] & 0x0f]];
|
||||
} else
|
||||
p[xx] = (dat & (0x100 >> (xx >> dwshift))) ? fg : bg;
|
||||
|
||||
@@ -430,14 +430,15 @@ jega_out(uint16_t addr, uint8_t val, void *priv)
|
||||
jega->attrregs[jega->attraddr & 31] = val;
|
||||
if (jega->attraddr < 0x10) {
|
||||
for (uint8_t c = 0; c < 16; c++) {
|
||||
if (!jega->is_vga)
|
||||
if (jega->is_vga) {
|
||||
if (jega->attrregs[0x10] & 0x80)
|
||||
jega->egapal[c] = (jega->attrregs[c] & 0xf) | ((jega->attrregs[0x14] & 0xf) << 4);
|
||||
else if (jega->vga.svga.ati_4color)
|
||||
jega->egapal[c] = pal4to16[(c & 0x03) | ((val >> 2) & 0xc)];
|
||||
else
|
||||
jega->egapal[c] = (jega->attrregs[c] & 0x3f) | ((jega->attrregs[0x14] & 0xc) << 4);
|
||||
} else
|
||||
jega->egapal[c] = jega->attrregs[c] & 0x3f;
|
||||
else if (jega->attrregs[0x10] & 0x80)
|
||||
jega->egapal[c] = (jega->attrregs[c] & 0xf) | ((jega->attrregs[0x14] & 0xf) << 4);
|
||||
else if (jega->vga.svga.ati_4color)
|
||||
jega->egapal[c] = pal4to16[(c & 0x03) | ((val >> 2) & 0xc)];
|
||||
else
|
||||
jega->egapal[c] = (jega->attrregs[c] & 0x3f) | ((jega->attrregs[0x14] & 0xc) << 4);
|
||||
}
|
||||
if (jega->is_vga)
|
||||
jega->vga.svga.fullchange = changeframecount;
|
||||
|
||||
Reference in New Issue
Block a user