diff --git a/src/conio/bitmap_con.c b/src/conio/bitmap_con.c index 91e86f7cc491619ce8671ca8856a6d42165a0b32..ca3d17787d037e9e4bf547e5f55e85bdedfb2f61 100644 --- a/src/conio/bitmap_con.c +++ b/src/conio/bitmap_con.c @@ -267,9 +267,9 @@ bitmap_vmem_puttext_locked(int sx, int sy, int ex, int ey, struct vmem_cell *fil if (vstat.mode == PRESTEL_40X24 && (vc->bg & 0x02000000)) { if (vc->legacy_attr & 0x08) { if (cio_api.options & CONIO_OPT_PRESTEL_REVEAL) - vc->fg |= 0x01000000; + vc->bg |= 0x08000000; else - vc->fg &= ~0x01000000; + vc->bg &= ~0x08000000; } } vc = vmem_next_ptr(vstat.vmem, vc); @@ -307,9 +307,9 @@ set_vmem_cell(size_t x, size_t y, uint16_t cell, uint32_t fg, uint32_t bg) if (vstat.mode == PRESTEL_40X24 && ((vc->bg & 0x02000000) || (bg & 0x02000000))) { if (vc->legacy_attr & 0x08) { if (cio_api.options & CONIO_OPT_PRESTEL_REVEAL) - vc->fg |= 0x01000000; + vc->bg |= 0x08000000; else - vc->fg &= ~0x01000000; + vc->bg &= ~0x08000000; } if ((vc->bg & 0x01000000) != (bg & 0x01000000)) { // *ANY* change to double-height potentially changes @@ -320,9 +320,9 @@ set_vmem_cell(size_t x, size_t y, uint16_t cell, uint32_t fg, uint32_t bg) if (vstat.mode == PRESTEL_40X24 && (vc->bg & 0x02000000)) { if (vc->legacy_attr & 0x08) { if (cio_api.options & CONIO_OPT_PRESTEL_REVEAL) - vc->fg |= 0x01000000; + vc->bg |= 0x08000000; else - vc->fg &= ~0x01000000; + vc->bg &= ~0x08000000; } } vc->bg = bg; @@ -1064,20 +1064,20 @@ same_cell(struct vmem_cell *bitmap_cell, struct vmem_cell *c2) { if (bitmap_cell->ch != c2->ch) return false; - if (bitmap_cell->bg != c2->bg) - return false; // Handles reveal/unreveal updates, modifies vmem if (vstat.mode == PRESTEL_40X24 && (c2->bg & 0x02000000)) { if (c2->legacy_attr & 0x08) { if (cio_api.options & CONIO_OPT_PRESTEL_REVEAL) - c2->fg |= 0x01000000; + c2->bg |= 0x08000000; else - c2->fg &= ~0x01000000; + c2->bg &= ~0x08000000; } } - if (bitmap_cell->fg != c2->fg) + if (bitmap_cell->bg & 0x10000000) // Dirty. return false; - if (bitmap_cell->fg & 0x04000000) // Dirty. + if (bitmap_cell->bg != c2->bg) + return false; + if (bitmap_cell->fg != c2->fg) return false; if (bitmap_cell->font != c2->font) return false; diff --git a/src/conio/ciolib.h b/src/conio/ciolib.h index 12c319e0e160dd8e16402ad7ffcb25dfa6e583cb..e5707fcec500f75619d586f373da19a1b0c7429a 100644 --- a/src/conio/ciolib.h +++ b/src/conio/ciolib.h @@ -278,13 +278,14 @@ struct vmem_cell { uint8_t ch; uint8_t font; uint32_t fg; /* RGB 80RRGGBB High bit clear indicates palette colour - * bit 24 indicates reveal is/was enabled - * bit 26 indicates it is dirty and must be redrawn + * Bits 24..30 are the prestel control character. */ uint32_t bg; /* RGB 80RRGGBB High bit clear indicates palette colour * bit 24 indicates double-height * bit 25 indicates Prestel * bit 26 indicates pixel graphics present + * bit 27 indicates reveal is/was enabled + * bit 28 indicates it is dirty and must be redrawn */ };