Rename "con" to "cursorvisible" as it determines if the cursor is visible for the current scanline.

This commit is contained in:
starfrost013
2025-06-09 17:16:01 +01:00
parent 7bf7a84a83
commit d32a06d305
7 changed files with 24 additions and 23 deletions

View File

@@ -88,7 +88,7 @@ typedef struct cga_t {
int sc; int sc;
int vc; int vc;
int cgadispon; int cgadispon;
int con; int cursorvisible; // Determines if the cursor is visible FOR THE CURRENT SCANLINE.
int cursoron; int cursoron;
int cgablink; int cgablink;
int vsynctime; int vsynctime;

View File

@@ -1423,7 +1423,7 @@ lcdc_poll(amsvid_t *vid)
for (x = 0; x < cga->crtc[1]; x++) { for (x = 0; x < cga->crtc[1]; x++) {
chr = cga->charbuffer[x << 1]; chr = cga->charbuffer[x << 1];
attr = cga->charbuffer[(x << 1) + 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); 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])[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); 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++) { for (x = 0; x < cga->crtc[1]; x++) {
chr = cga->vram[(cga->ma << 1) & 0x3fff]; chr = cga->vram[(cga->ma << 1) & 0x3fff];
attr = cga->vram[((cga->ma << 1) + 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); 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])[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); 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; cga->cgastat &= ~8;
} }
if (cga->sc == (cga->crtc[11] & 31) || ((cga->crtc[8] & 3) == 3 && cga->sc == ((cga->crtc[11] & 31) >> 1))) { 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)) if ((cga->crtc[8] & 3) == 3 && cga->sc == (cga->crtc[9] >> 1))
cga->maback = cga->ma; cga->maback = cga->ma;
@@ -1580,7 +1580,7 @@ lcdc_poll(amsvid_t *vid)
if (cga->cgadispon) if (cga->cgadispon)
cga->cgastat &= ~1; cga->cgastat &= ~1;
if (cga->sc == (cga->crtc[10] & 31) || ((cga->crtc[8] & 3) == 3 && cga->sc == ((cga->crtc[10] & 31) >> 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)) { if (cga->cgadispon && (cga->cgamode & 1)) {
for (x = 0; x < (cga->crtc[1] << 1); x++) for (x = 0; x < (cga->crtc[1] << 1); x++)
cga->charbuffer[x] = cga->vram[((cga->ma << 1) + x) & 0x3fff]; cga->charbuffer[x] = cga->vram[((cga->ma << 1) + x) & 0x3fff];

View File

@@ -289,7 +289,7 @@ cga_render(cga_t *cga, int line)
attr = cga->charbuffer[(x << 1) + 1]; attr = cga->charbuffer[(x << 1) + 1];
} else } else
chr = attr = 0; chr = attr = 0;
drawcursor = ((cga->ma == ca) && cga->con && cga->cursoron); drawcursor = ((cga->ma == ca) && cga->cursorvisible && cga->cursoron);
cols[1] = (attr & 15) + 16; cols[1] = (attr & 15) + 16;
if (cga->cgamode & CGA_MODE_FLAG_BLINK) { if (cga->cgamode & CGA_MODE_FLAG_BLINK) {
cols[0] = ((attr >> 4) & 7) + 16; 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]; attr = cga->vram[((cga->ma << 1) + 1) & 0x3fff];
} else } else
chr = attr = 0; chr = attr = 0;
drawcursor = ((cga->ma == ca) && cga->con && cga->cursoron); drawcursor = ((cga->ma == ca) && cga->cursorvisible && cga->cursoron);
cols[1] = (attr & 15) + 16; cols[1] = (attr & 15) + 16;
if (cga->cgamode & CGA_MODE_FLAG_BLINK) { if (cga->cgamode & CGA_MODE_FLAG_BLINK) {
cols[0] = ((attr >> 4) & 7) + 16; 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 && 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->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)) if ((cga->crtc[CGA_CRTC_INTERLACE] & 3) == 3 && cga->sc == (cga->crtc[CGA_CRTC_MAX_SCANLINE_ADDR] >> 1))
cga->maback = cga->ma; cga->maback = cga->ma;
@@ -625,6 +625,7 @@ cga_poll(void *priv)
cga->cgadispon = 1; cga->cgadispon = 1;
cga->ma = cga->maback = (cga->crtc[CGA_CRTC_START_ADDR_LOW] | (cga->crtc[CGA_CRTC_START_ADDR_HIGH] << 8)) & 0x3fff; 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) { switch (cga->crtc[CGA_CRTC_CURSOR_START] & 0x60) {
case 0x20: case 0x20:
cga->cursoron = 0; cga->cursoron = 0;
@@ -724,7 +725,7 @@ cga_poll(void *priv)
cga->cgastat &= ~1; cga->cgastat &= ~1;
if (cga->sc == (cga->crtc[CGA_CRTC_CURSOR_START] & 31) || ((cga->crtc[CGA_CRTC_INTERLACE] & 3) == 3 && 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->sc == ((cga->crtc[CGA_CRTC_CURSOR_START] & 31) >> 1)))
cga->con = 1; cga->cursorvisible = 1;
if (cga->cgadispon && (cga->cgamode & CGA_MODE_FLAG_HIGHRES)) { if (cga->cgadispon && (cga->cgamode & CGA_MODE_FLAG_HIGHRES)) {
for (x = 0; x < (cga->crtc[CGA_CRTC_HDISP] << 1); x++) for (x = 0; x < (cga->crtc[CGA_CRTC_HDISP] << 1); x++)
cga->charbuffer[x] = cga->vram[((cga->ma << 1) + x) & 0x3fff]; cga->charbuffer[x] = cga->vram[((cga->ma << 1) + x) & 0x3fff];

View File

@@ -226,7 +226,7 @@ colorplus_poll(void *priv)
} }
if (colorplus->cga.sc == (colorplus->cga.crtc[CGA_CRTC_CURSOR_END] & 31) 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.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)) 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; colorplus->cga.maback = colorplus->cga.ma;
@@ -316,7 +316,7 @@ colorplus_poll(void *priv)
if (colorplus->cga.cgadispon) if (colorplus->cga.cgadispon)
colorplus->cga.cgastat &= ~1; 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))) 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)) { if (colorplus->cga.cgadispon && (colorplus->cga.cgamode & 1)) {
for (x = 0; x < (colorplus->cga.crtc[CGA_CRTC_HDISP] << 1); x++) 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]; colorplus->cga.charbuffer[x] = colorplus->cga.vram[((colorplus->cga.ma << 1) + x) & 0x3fff];

View File

@@ -139,7 +139,7 @@ compaq_cga_poll(void *priv)
for (x = 0; x < self->cga.crtc[1]; x++) { for (x = 0; x < self->cga.crtc[1]; x++) {
chr = self->cga.charbuffer[x << 1]; chr = self->cga.charbuffer[x << 1];
attr = self->cga.charbuffer[(x << 1) + 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) { if (vflags) {
underline = 0; underline = 0;
@@ -184,7 +184,7 @@ compaq_cga_poll(void *priv)
for (x = 0; x < self->cga.crtc[1]; x++) { for (x = 0; x < self->cga.crtc[1]; x++) {
chr = self->cga.vram[(self->cga.ma << 1) & 0x3fff]; chr = self->cga.vram[(self->cga.ma << 1) & 0x3fff];
attr = self->cga.vram[((self->cga.ma << 1) + 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) { if (vflags) {
underline = 0; 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))) { 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)) if ((self->cga.crtc[8] & 3) == 3 && self->cga.sc == (self->cga.crtc[9] >> 1))
self->cga.maback = self->cga.ma; self->cga.maback = self->cga.ma;
@@ -386,7 +386,7 @@ compaq_cga_poll(void *priv)
self->cga.cgastat &= ~1; 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))) 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)) { if (self->cga.cgadispon && (self->cga.cgamode & 1)) {
for (x = 0; x < (self->cga.crtc[1] << 1); x++) for (x = 0; x < (self->cga.crtc[1] << 1); x++)

View File

@@ -197,7 +197,7 @@ nga_poll(void *priv)
} else } else
chr = attr = 0; chr = attr = 0;
/* check if cursor has to be drawn */ /* 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 */ /* set foreground */
cols[1] = (attr & 15) + 16; cols[1] = (attr & 15) + 16;
/* blink active */ /* blink active */
@@ -233,7 +233,7 @@ nga_poll(void *priv)
} else { } else {
chr = attr = 0; 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 */ /* set foreground */
cols[1] = (attr & 15) + 16; cols[1] = (attr & 15) + 16;
/* blink active */ /* blink active */
@@ -391,7 +391,7 @@ nga_poll(void *priv)
} }
/* cursor stop scanline */ /* 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))) { 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 */ /* interlaced and max scanline per char reached */
if ((nga->cga.crtc[8] & 3) == 3 && nga->cga.sc == (nga->cga.crtc[9] >> 1)) 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 */ /* 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))) 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 */ /* 80-columns */
if (nga->cga.cgadispon && (nga->cga.cgamode & 1)) { if (nga->cga.cgadispon && (nga->cga.cgamode & 1)) {

View File

@@ -252,7 +252,7 @@ ogc_poll(void *priv)
} else } else
chr = attr = 0; chr = attr = 0;
/* check if cursor has to be drawn */ /* 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 */ /* check if character underline mode should be set */
underline = ((ogc->ctrl_3de & 0x40) && (attr & 0x1) && !(attr & 0x6)); underline = ((ogc->ctrl_3de & 0x40) && (attr & 0x1) && !(attr & 0x6));
if (underline) { if (underline) {
@@ -301,7 +301,7 @@ ogc_poll(void *priv)
} else { } else {
chr = attr = 0; 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 */ /* check if character underline mode should be set */
underline = ((ogc->ctrl_3de & 0x40) && (attr & 0x1) && !(attr & 0x6)); underline = ((ogc->ctrl_3de & 0x40) && (attr & 0x1) && !(attr & 0x6));
if (underline) { if (underline) {
@@ -406,7 +406,7 @@ ogc_poll(void *priv)
ogc->cga.cgastat &= ~8; 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))) { 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)) if ((ogc->cga.crtc[8] & 3) == 3 && ogc->cga.sc == (ogc->cga.crtc[9] >> 1))
ogc->cga.maback = ogc->cga.ma; ogc->cga.maback = ogc->cga.ma;
@@ -525,7 +525,7 @@ ogc_poll(void *priv)
ogc->cga.cgastat &= ~1; 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))) 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 */ /* 80-columns */
if (ogc->cga.cgadispon && (ogc->cga.cgamode & 1)) { if (ogc->cga.cgadispon && (ogc->cga.cgamode & 1)) {