From d32a06d3059813636cdb7824f2bf0341c4fb7c09 Mon Sep 17 00:00:00 2001 From: starfrost013 Date: Mon, 9 Jun 2025 17:16:01 +0100 Subject: [PATCH] Rename "con" to "cursorvisible" as it determines if the cursor is visible for the current scanline. --- src/include/86box/vid_cga.h | 2 +- src/machine/m_amstrad.c | 8 ++++---- src/video/vid_cga.c | 9 +++++---- src/video/vid_colorplus.c | 4 ++-- src/video/vid_compaq_cga.c | 8 ++++---- src/video/vid_nga.c | 8 ++++---- src/video/vid_ogc.c | 8 ++++---- 7 files changed, 24 insertions(+), 23 deletions(-) diff --git a/src/include/86box/vid_cga.h b/src/include/86box/vid_cga.h index 2a36eeade..a84373d84 100644 --- a/src/include/86box/vid_cga.h +++ b/src/include/86box/vid_cga.h @@ -88,7 +88,7 @@ typedef struct cga_t { int sc; int vc; int cgadispon; - int con; + int cursorvisible; // Determines if the cursor is visible FOR THE CURRENT SCANLINE. int cursoron; int cgablink; int vsynctime; diff --git a/src/machine/m_amstrad.c b/src/machine/m_amstrad.c index 57e8367ff..b57eac60d 100644 --- a/src/machine/m_amstrad.c +++ b/src/machine/m_amstrad.c @@ -1423,7 +1423,7 @@ lcdc_poll(amsvid_t *vid) for (x = 0; x < cga->crtc[1]; x++) { chr = cga->charbuffer[x << 1]; attr = cga->charbuffer[(x << 1) + 1]; - drawcursor = ((cga->ma == ca) && cga->con && cga->cursoron); + drawcursor = ((cga->ma == ca) && cga->cursorvisible && cga->cursoron); blink = ((cga->cgablink & 16) && (cga->cgamode & 0x20) && (attr & 0x80) && !drawcursor); lcd_draw_char_80(vid, &(buffer32->line[cga->displine << 1])[x * 8], chr, attr, drawcursor, blink, cga->sc, cga->cgamode & 0x40, cga->cgamode); lcd_draw_char_80(vid, &(buffer32->line[(cga->displine << 1) + 1])[x * 8], chr, attr, drawcursor, blink, cga->sc, cga->cgamode & 0x40, cga->cgamode); @@ -1433,7 +1433,7 @@ lcdc_poll(amsvid_t *vid) for (x = 0; x < cga->crtc[1]; x++) { chr = cga->vram[(cga->ma << 1) & 0x3fff]; attr = cga->vram[((cga->ma << 1) + 1) & 0x3fff]; - drawcursor = ((cga->ma == ca) && cga->con && cga->cursoron); + drawcursor = ((cga->ma == ca) && cga->cursorvisible && cga->cursoron); blink = ((cga->cgablink & 16) && (cga->cgamode & 0x20) && (attr & 0x80) && !drawcursor); lcd_draw_char_40(vid, &(buffer32->line[cga->displine << 1])[x * 16], chr, attr, drawcursor, blink, cga->sc, cga->cgamode); lcd_draw_char_40(vid, &(buffer32->line[(cga->displine << 1) + 1])[x * 16], chr, attr, drawcursor, blink, cga->sc, cga->cgamode); @@ -1479,7 +1479,7 @@ lcdc_poll(amsvid_t *vid) cga->cgastat &= ~8; } if (cga->sc == (cga->crtc[11] & 31) || ((cga->crtc[8] & 3) == 3 && cga->sc == ((cga->crtc[11] & 31) >> 1))) { - cga->con = 0; + cga->cursorvisible = 0; } if ((cga->crtc[8] & 3) == 3 && cga->sc == (cga->crtc[9] >> 1)) cga->maback = cga->ma; @@ -1580,7 +1580,7 @@ lcdc_poll(amsvid_t *vid) if (cga->cgadispon) cga->cgastat &= ~1; if (cga->sc == (cga->crtc[10] & 31) || ((cga->crtc[8] & 3) == 3 && cga->sc == ((cga->crtc[10] & 31) >> 1))) - cga->con = 1; + cga->cursorvisible = 1; if (cga->cgadispon && (cga->cgamode & 1)) { for (x = 0; x < (cga->crtc[1] << 1); x++) cga->charbuffer[x] = cga->vram[((cga->ma << 1) + x) & 0x3fff]; diff --git a/src/video/vid_cga.c b/src/video/vid_cga.c index bfd03d03a..0fb1a1402 100644 --- a/src/video/vid_cga.c +++ b/src/video/vid_cga.c @@ -289,7 +289,7 @@ cga_render(cga_t *cga, int line) attr = cga->charbuffer[(x << 1) + 1]; } else chr = attr = 0; - drawcursor = ((cga->ma == ca) && cga->con && cga->cursoron); + drawcursor = ((cga->ma == ca) && cga->cursorvisible && cga->cursoron); cols[1] = (attr & 15) + 16; if (cga->cgamode & CGA_MODE_FLAG_BLINK) { cols[0] = ((attr >> 4) & 7) + 16; @@ -317,7 +317,7 @@ cga_render(cga_t *cga, int line) attr = cga->vram[((cga->ma << 1) + 1) & 0x3fff]; } else chr = attr = 0; - drawcursor = ((cga->ma == ca) && cga->con && cga->cursoron); + drawcursor = ((cga->ma == ca) && cga->cursorvisible && cga->cursoron); cols[1] = (attr & 15) + 16; if (cga->cgamode & CGA_MODE_FLAG_BLINK) { cols[0] = ((attr >> 4) & 7) + 16; @@ -594,7 +594,7 @@ cga_poll(void *priv) } if (cga->sc == (cga->crtc[CGA_CRTC_CURSOR_END] & 31) || ((cga->crtc[CGA_CRTC_INTERLACE] & 3) == 3 && cga->sc == ((cga->crtc[CGA_CRTC_CURSOR_END] & 31) >> 1))) { - cga->con = 0; + cga->cursorvisible = 0; } if ((cga->crtc[CGA_CRTC_INTERLACE] & 3) == 3 && cga->sc == (cga->crtc[CGA_CRTC_MAX_SCANLINE_ADDR] >> 1)) cga->maback = cga->ma; @@ -625,6 +625,7 @@ cga_poll(void *priv) cga->cgadispon = 1; cga->ma = cga->maback = (cga->crtc[CGA_CRTC_START_ADDR_LOW] | (cga->crtc[CGA_CRTC_START_ADDR_HIGH] << 8)) & 0x3fff; } + switch (cga->crtc[CGA_CRTC_CURSOR_START] & 0x60) { case 0x20: cga->cursoron = 0; @@ -724,7 +725,7 @@ cga_poll(void *priv) cga->cgastat &= ~1; if (cga->sc == (cga->crtc[CGA_CRTC_CURSOR_START] & 31) || ((cga->crtc[CGA_CRTC_INTERLACE] & 3) == 3 && cga->sc == ((cga->crtc[CGA_CRTC_CURSOR_START] & 31) >> 1))) - cga->con = 1; + cga->cursorvisible = 1; if (cga->cgadispon && (cga->cgamode & CGA_MODE_FLAG_HIGHRES)) { for (x = 0; x < (cga->crtc[CGA_CRTC_HDISP] << 1); x++) cga->charbuffer[x] = cga->vram[((cga->ma << 1) + x) & 0x3fff]; diff --git a/src/video/vid_colorplus.c b/src/video/vid_colorplus.c index 48217765e..d15865c1e 100644 --- a/src/video/vid_colorplus.c +++ b/src/video/vid_colorplus.c @@ -226,7 +226,7 @@ colorplus_poll(void *priv) } if (colorplus->cga.sc == (colorplus->cga.crtc[CGA_CRTC_CURSOR_END] & 31) || ((colorplus->cga.crtc[CGA_CRTC_INTERLACE] & 3) == 3 && colorplus->cga.sc == ((colorplus->cga.crtc[CGA_CRTC_CURSOR_END] & 31) >> 1))) { - colorplus->cga.con = 0; + colorplus->cga.cursorvisible = 0; } if ((colorplus->cga.crtc[CGA_CRTC_INTERLACE] & 3) == 3 && colorplus->cga.sc == (colorplus->cga.crtc[CGA_CRTC_MAX_SCANLINE_ADDR] >> 1)) colorplus->cga.maback = colorplus->cga.ma; @@ -316,7 +316,7 @@ colorplus_poll(void *priv) if (colorplus->cga.cgadispon) colorplus->cga.cgastat &= ~1; if (colorplus->cga.sc == (colorplus->cga.crtc[CGA_CRTC_CURSOR_START] & 31) || ((colorplus->cga.crtc[CGA_CRTC_INTERLACE] & 3) == 3 && colorplus->cga.sc == ((colorplus->cga.crtc[CGA_CRTC_CURSOR_START] & 31) >> 1))) - colorplus->cga.con = 1; + colorplus->cga.cursorvisible = 1; if (colorplus->cga.cgadispon && (colorplus->cga.cgamode & 1)) { for (x = 0; x < (colorplus->cga.crtc[CGA_CRTC_HDISP] << 1); x++) colorplus->cga.charbuffer[x] = colorplus->cga.vram[((colorplus->cga.ma << 1) + x) & 0x3fff]; diff --git a/src/video/vid_compaq_cga.c b/src/video/vid_compaq_cga.c index f9fec32d0..80c6ecb9e 100644 --- a/src/video/vid_compaq_cga.c +++ b/src/video/vid_compaq_cga.c @@ -139,7 +139,7 @@ compaq_cga_poll(void *priv) for (x = 0; x < self->cga.crtc[1]; x++) { chr = self->cga.charbuffer[x << 1]; attr = self->cga.charbuffer[(x << 1) + 1]; - drawcursor = ((self->cga.ma == ca) && self->cga.con && self->cga.cursoron); + drawcursor = ((self->cga.ma == ca) && self->cga.cursorvisible && self->cga.cursoron); if (vflags) { underline = 0; @@ -184,7 +184,7 @@ compaq_cga_poll(void *priv) for (x = 0; x < self->cga.crtc[1]; x++) { chr = self->cga.vram[(self->cga.ma << 1) & 0x3fff]; attr = self->cga.vram[((self->cga.ma << 1) + 1) & 0x3fff]; - drawcursor = ((self->cga.ma == ca) && self->cga.con && self->cga.cursoron); + drawcursor = ((self->cga.ma == ca) && self->cga.cursorvisible && self->cga.cursoron); if (vflags) { underline = 0; @@ -268,7 +268,7 @@ compaq_cga_poll(void *priv) } if (self->cga.sc == (self->cga.crtc[11] & 31) || ((self->cga.crtc[8] & 3) == 3 && self->cga.sc == ((self->cga.crtc[11] & 31) >> 1))) { - self->cga.con = 0; + self->cga.cursorvisible = 0; } if ((self->cga.crtc[8] & 3) == 3 && self->cga.sc == (self->cga.crtc[9] >> 1)) self->cga.maback = self->cga.ma; @@ -386,7 +386,7 @@ compaq_cga_poll(void *priv) self->cga.cgastat &= ~1; if (self->cga.sc == (self->cga.crtc[10] & 31) || ((self->cga.crtc[8] & 3) == 3 && self->cga.sc == ((self->cga.crtc[10] & 31) >> 1))) - self->cga.con = 1; + self->cga.cursorvisible = 1; if (self->cga.cgadispon && (self->cga.cgamode & 1)) { for (x = 0; x < (self->cga.crtc[1] << 1); x++) diff --git a/src/video/vid_nga.c b/src/video/vid_nga.c index 5fc81109c..7a30bf173 100644 --- a/src/video/vid_nga.c +++ b/src/video/vid_nga.c @@ -197,7 +197,7 @@ nga_poll(void *priv) } else chr = attr = 0; /* check if cursor has to be drawn */ - drawcursor = ((nga->cga.ma == ca) && nga->cga.con && nga->cga.cursoron); + drawcursor = ((nga->cga.ma == ca) && nga->cga.cursorvisible && nga->cga.cursoron); /* set foreground */ cols[1] = (attr & 15) + 16; /* blink active */ @@ -233,7 +233,7 @@ nga_poll(void *priv) } else { chr = attr = 0; } - drawcursor = ((nga->cga.ma == ca) && nga->cga.con && nga->cga.cursoron); + drawcursor = ((nga->cga.ma == ca) && nga->cga.cursorvisible && nga->cga.cursoron); /* set foreground */ cols[1] = (attr & 15) + 16; /* blink active */ @@ -391,7 +391,7 @@ nga_poll(void *priv) } /* cursor stop scanline */ if (nga->cga.sc == (nga->cga.crtc[11] & 31) || ((nga->cga.crtc[8] & 3) == 3 && nga->cga.sc == ((nga->cga.crtc[11] & 31) >> 1))) { - nga->cga.con = 0; + nga->cga.cursorvisible = 0; } /* interlaced and max scanline per char reached */ if ((nga->cga.crtc[8] & 3) == 3 && nga->cga.sc == (nga->cga.crtc[9] >> 1)) @@ -524,7 +524,7 @@ nga_poll(void *priv) /* enable cursor if its scanline was reached */ if (nga->cga.sc == (nga->cga.crtc[10] & 31) || ((nga->cga.crtc[8] & 3) == 3 && nga->cga.sc == ((nga->cga.crtc[10] & 31) >> 1))) - nga->cga.con = 1; + nga->cga.cursorvisible = 1; } /* 80-columns */ if (nga->cga.cgadispon && (nga->cga.cgamode & 1)) { diff --git a/src/video/vid_ogc.c b/src/video/vid_ogc.c index 162cb9073..afbc778a6 100644 --- a/src/video/vid_ogc.c +++ b/src/video/vid_ogc.c @@ -252,7 +252,7 @@ ogc_poll(void *priv) } else chr = attr = 0; /* check if cursor has to be drawn */ - drawcursor = ((ogc->cga.ma == ca) && ogc->cga.con && ogc->cga.cursoron); + drawcursor = ((ogc->cga.ma == ca) && ogc->cga.cursorvisible && ogc->cga.cursoron); /* check if character underline mode should be set */ underline = ((ogc->ctrl_3de & 0x40) && (attr & 0x1) && !(attr & 0x6)); if (underline) { @@ -301,7 +301,7 @@ ogc_poll(void *priv) } else { chr = attr = 0; } - drawcursor = ((ogc->cga.ma == ca) && ogc->cga.con && ogc->cga.cursoron); + drawcursor = ((ogc->cga.ma == ca) && ogc->cga.cursorvisible && ogc->cga.cursoron); /* check if character underline mode should be set */ underline = ((ogc->ctrl_3de & 0x40) && (attr & 0x1) && !(attr & 0x6)); if (underline) { @@ -406,7 +406,7 @@ ogc_poll(void *priv) ogc->cga.cgastat &= ~8; } if (ogc->cga.sc == (ogc->cga.crtc[11] & 31) || ((ogc->cga.crtc[8] & 3) == 3 && ogc->cga.sc == ((ogc->cga.crtc[11] & 31) >> 1))) { - ogc->cga.con = 0; + ogc->cga.cursorvisible = 0; } if ((ogc->cga.crtc[8] & 3) == 3 && ogc->cga.sc == (ogc->cga.crtc[9] >> 1)) ogc->cga.maback = ogc->cga.ma; @@ -525,7 +525,7 @@ ogc_poll(void *priv) ogc->cga.cgastat &= ~1; if (ogc->cga.sc == (ogc->cga.crtc[10] & 31) || ((ogc->cga.crtc[8] & 3) == 3 && ogc->cga.sc == ((ogc->cga.crtc[10] & 31) >> 1))) - ogc->cga.con = 1; + ogc->cga.cursorvisible = 1; } /* 80-columns */ if (ogc->cga.cgadispon && (ogc->cga.cgamode & 1)) {