EGA Render: Apply the (S)VGA Render blink fix by greasemonkey.

This commit is contained in:
OBattler
2024-08-08 00:56:19 +02:00
parent 90592d57dc
commit 479ab87f17

View File

@@ -201,7 +201,8 @@ ega_render_graphics(ega_t *ega)
const bool crtcreset = ((ega->crtc[0x17] & 0x80) == 0); const bool crtcreset = ((ega->crtc[0x17] & 0x80) == 0);
const bool seq9dot = ((ega->seqregs[1] & 1) == 0); const bool seq9dot = ((ega->seqregs[1] & 1) == 0);
const bool seqoddeven = ((ega->seqregs[1] & 4) != 0); const bool seqoddeven = ((ega->seqregs[1] & 4) != 0);
const uint8_t blinkmask = (attrblink && blinked ? 0x8 : 0x0); const uint8_t blinkmask = (attrblink ? 0x8 : 0x0);
const uint8_t blinkval = (attrblink && blinked ? 0x8 : 0x0);
uint32_t *p = &buffer32->line[ega->displine + ega->y_add][ega->x_add]; uint32_t *p = &buffer32->line[ega->displine + ega->y_add][ega->x_add];
const int dwshift = doublewidth ? 1 : 0; const int dwshift = doublewidth ? 1 : 0;
const int dotwidth = 1 << dwshift; const int dotwidth = 1 << dwshift;
@@ -254,8 +255,14 @@ ega_render_graphics(ega_t *ega)
uint8_t dat = (edatlookup[(edat[0] >> inshift) & 3][(edat[1] >> inshift) & 3]) uint8_t dat = (edatlookup[(edat[0] >> inshift) & 3][(edat[1] >> inshift) & 3])
| (edatlookup[(edat[2] >> inshift) & 3][(edat[3] >> inshift) & 3] << 2); | (edatlookup[(edat[2] >> inshift) & 3][(edat[3] >> inshift) & 3] << 2);
// FIXME: Confirm blink behaviour is actually XOR on real hardware // FIXME: Confirm blink behaviour is actually XOR on real hardware
uint32_t p0 = ega->pallook[ega->egapal[((dat >> 4) & ega->plane_mask) ^ blinkmask]]; uint32_t c0 = (dat >> 4) & 0xF;
uint32_t p1 = ega->pallook[ega->egapal[(dat & ega->plane_mask) ^ blinkmask]]; uint32_t c1 = dat & 0xF;
c0 = ((c0 & ega->plane_mask & ~blinkmask) |
((c0 | ~ega->plane_mask) & blinkmask & blinkval)) ^ blinkmask;
c1 = ((c1 & ega->plane_mask & ~blinkmask) |
((c1 | ~ega->plane_mask) & blinkmask & blinkval)) ^ blinkmask;
uint32_t p0 = ega->pallook[ega->egapal[c0]];
uint32_t p1 = ega->pallook[ega->egapal[c1]];
for (int subx = 0; subx < dotwidth; subx++) for (int subx = 0; subx < dotwidth; subx++)
p[outoffs + subx] = p0; p[outoffs + subx] = p0;
for (int subx = 0; subx < dotwidth; subx++) for (int subx = 0; subx < dotwidth; subx++)