From f7c27285825a234b8846af20635ca0e18e796f56 Mon Sep 17 00:00:00 2001 From: OBattler Date: Sat, 17 May 2025 05:41:53 +0200 Subject: [PATCH] Fix the incorrect high intensity attribute bit checking (bit 3 is 0x08, not 0x03!). --- src/machine/m_at_compaq.c | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/src/machine/m_at_compaq.c b/src/machine/m_at_compaq.c index ddd3f2a0c..1d1770b46 100644 --- a/src/machine/m_at_compaq.c +++ b/src/machine/m_at_compaq.c @@ -355,11 +355,12 @@ compaq_plasma_poll(void *priv) chr = 0x00; attr = 0x00; } + uint8_t hi_bit = attr & 0x08; /* check if cursor has to be drawn */ drawcursor = ((ma == ca) && cursorline && (self->cga.cgamode & 0x08) && (self->cga.cgablink & 0x10)); /* check if character underline mode should be set */ underline = ((attr & 0x07) == 0x01); - underline |= ((self->port_23c6 >> 5) == 2) && (attr & 0x03); + underline = underline || (((self->port_23c6 >> 5) == 2) && hi_bit); if (underline) { /* set forecolor to white */ attr = attr | 0x7; @@ -384,7 +385,7 @@ compaq_plasma_poll(void *priv) /* character address */ uint16_t chr_addr = ((chr * 16) + sc) & 0x0fff; - if (((self->port_23c6 >> 5) == 3) && (attr & 0x03)) + if (((self->port_23c6 >> 5) == 3) && hi_bit) chr_addr |= 0x1000; /* character underline active and 7th row of pixels in character height being drawn */ @@ -400,7 +401,7 @@ compaq_plasma_poll(void *priv) buffer32->line[self->cga.displine][(x << 3) + c] = cols[(self->font_ram[chr_addr] & (1 << (c ^ 7))) ? 1 : 0]; } - if (attr & 0x03) { + if (hi_bit) { if ((self->port_23c6 >> 5) == 1) { for (c = 0; c < 8; c++) buffer32->line[self->cga.displine][(x << 3) + c] ^= (amber ^ black); @@ -438,11 +439,12 @@ compaq_plasma_poll(void *priv) chr = 0x00; attr = 0x00; } + uint8_t hi_bit = attr & 0x08; /* check if cursor has to be drawn */ drawcursor = ((ma == ca) && cursorline && (self->cga.cgamode & 0x08) && (self->cga.cgablink & 0x10)); /* check if character underline mode should be set */ underline = ((attr & 0x07) == 0x01); - underline |= ((self->port_23c6 >> 5) == 2) && (attr & 0x03); + underline = underline || (((self->port_23c6 >> 5) == 2) && hi_bit); if (underline) { /* set forecolor to white */ attr = attr | 0x7; @@ -467,7 +469,7 @@ compaq_plasma_poll(void *priv) /* character address */ uint16_t chr_addr = ((chr * 16) + sc) & 0x0fff; - if (((self->port_23c6 >> 5) == 3) && (attr & 0x03)) + if (((self->port_23c6 >> 5) == 3) && hi_bit) chr_addr |= 0x1000; /* character underline active and 7th row of pixels in character height being drawn */ @@ -483,7 +485,7 @@ compaq_plasma_poll(void *priv) buffer32->line[self->cga.displine][(x << 4) + (c << 1)] = buffer32->line[self->cga.displine][(x << 4) + (c << 1) + 1] = cols[(self->font_ram[chr_addr] & (1 << (c ^ 7))) ? 1 : 0]; } - if (attr & 0x03) { + if (hi_bit) { if ((self->port_23c6 >> 5) == 1) for (c = 0; c < 8; c++) { buffer32->line[self->cga.displine][(x << 4) + (c << 1)] ^= (amber ^ black);