Merge pull request #3756 from 86Box/tc1995

Compaq Plasma fixes:
This commit is contained in:
Miran Grča
2023-10-14 20:25:24 +02:00
committed by GitHub
3 changed files with 43 additions and 46 deletions

View File

@@ -187,6 +187,8 @@ extern int video_fullscreen_scale;
extern int video_fullscreen_first; extern int video_fullscreen_first;
extern uint8_t fontdat[2048][8]; extern uint8_t fontdat[2048][8];
extern uint8_t fontdatm[2048][16]; extern uint8_t fontdatm[2048][16];
extern uint8_t fontdat2[2048][8];
extern uint8_t fontdatm2[2048][16];
extern uint8_t fontdatw[512][32]; extern uint8_t fontdatw[512][32];
extern uint8_t fontdat8x12[256][16]; extern uint8_t fontdat8x12[256][16];
extern uint8_t fontdat12x18[256][36]; extern uint8_t fontdat12x18[256][36];

View File

@@ -280,7 +280,7 @@ compaq_plasma_poll(void *priv)
uint32_t fg = (self->cga.cgacol & 0x0f) ? amber : black; uint32_t fg = (self->cga.cgacol & 0x0f) ? amber : black;
uint32_t bg = black; uint32_t bg = black;
uint32_t cols[2]; uint32_t cols[2];
uint8_t dat2; uint8_t dat;
uint8_t pattern; uint8_t pattern;
uint32_t ink0 = 0; uint32_t ink0 = 0;
uint32_t ink1 = 0; uint32_t ink1 = 0;
@@ -315,25 +315,25 @@ compaq_plasma_poll(void *priv)
addr = ((self->cga.displine >> 1) & 1) * 0x2000 + (self->cga.displine >> 2) * 80 + ((ma & ~1) << 1); addr = ((self->cga.displine >> 1) & 1) * 0x2000 + (self->cga.displine >> 2) * 80 + ((ma & ~1) << 1);
} }
for (uint8_t x = 0; x < 80; x++) { for (uint8_t x = 0; x < 80; x++) {
dat2 = self->cga.vram[addr & 0x7FFF]; dat = self->cga.vram[addr & 0x7FFF];
addr++; addr++;
for (uint8_t c = 0; c < 8; c++) { for (uint8_t c = 0; c < 8; c++) {
ink = (dat2 & 0x80) ? fg : bg; ink = (dat & 0x80) ? fg : bg;
if (!(self->cga.cgamode & 8)) if (!(self->cga.cgamode & 8))
ink = black; ink = black;
(buffer32->line[self->cga.displine])[x * 8 + c] = ink; (buffer32->line[self->cga.displine])[x * 8 + c] = ink;
dat2 <<= 1; dat <<= 1;
} }
} }
} else { } else {
addr = ((self->cga.displine >> 1) & 1) * 0x2000 + (self->cga.displine >> 2) * 80 + ((ma & ~1) << 1); addr = ((self->cga.displine >> 1) & 1) * 0x2000 + (self->cga.displine >> 2) * 80 + ((ma & ~1) << 1);
for (uint8_t x = 0; x < 80; x++) { for (uint8_t x = 0; x < 80; x++) {
dat2 = self->cga.vram[addr & 0x7fff]; dat = self->cga.vram[addr & 0x7fff];
addr++; addr++;
for (uint8_t c = 0; c < 4; c++) { for (uint8_t c = 0; c < 4; c++) {
pattern = (dat2 & 0xC0) >> 6; pattern = (dat & 0xC0) >> 6;
if (!(self->cga.cgamode & 8)) if (!(self->cga.cgamode & 8))
pattern = 0; pattern = 0;
@@ -368,7 +368,7 @@ compaq_plasma_poll(void *priv)
} }
buffer32->line[self->cga.displine][x * 8 + 2 * c] = ink0; buffer32->line[self->cga.displine][x * 8 + 2 * c] = ink0;
buffer32->line[self->cga.displine][x * 8 + 2 * c + 1] = ink1; buffer32->line[self->cga.displine][x * 8 + 2 * c + 1] = ink1;
dat2 <<= 2; dat <<= 2;
} }
} }
} }
@@ -386,34 +386,25 @@ compaq_plasma_poll(void *priv)
/* for each text column */ /* for each text column */
for (uint8_t x = 0; x < 80; x++) { for (uint8_t x = 0; x < 80; x++) {
/* video output enabled */ /* video output enabled */
if (self->cga.cgamode & 8) { chr = self->cga.vram[(addr + 2 * x) & 0x7FFF];
chr = self->cga.vram[(addr + 2 * x) & 0x7fff]; attr = self->cga.vram[(addr + 2 * x + 1) & 0x7FFF];
attr = self->cga.vram[(addr + 2 * x + 1) & 0x7fff]; drawcursor = ((ma == ca) && cursorline && (self->cga.cgamode & 8) && (self->cga.cgablink & 16));
} else
chr = attr = 0; blink = ((self->cga.cgablink & 16) && (self->cga.cgamode & 0x20) && (attr & 0x80) && !drawcursor);
/* check if cursor has to be drawn */
drawcursor = ((ma == ca) && cursorline && self->cga.cursoron);
underline = ((self->port_23c6 & 0x40) && (attr & 0x1) && !(attr & 0x6)); underline = ((self->port_23c6 & 0x40) && (attr & 0x1) && !(attr & 0x6));
if (underline) {
/* set forecolor to white */
attr |= 7;
}
blink = 0;
/* blink active */ /* blink active */
if (self->cga.cgamode & 0x20) { if (self->cga.cgamode & 0x20) {
cols[1] = blinkcols[attr][1]; cols[1] = blinkcols[attr][1];
cols[0] = blinkcols[attr][0]; cols[0] = blinkcols[attr][0];
/* attribute 7 active and not cursor */ /* attribute 7 active and not cursor */
if ((self->cga.cgablink & 8) && (attr & 0x80) && !self->cga.drawcursor) { if (blink) {
/* set blinking */ /* set blinking */
cols[1] = cols[0]; cols[1] = cols[0];
blink = 1;
} }
} else { } else {
/* Set intensity bit */ /* Set intensity bit */
cols[1] = normcols[attr][1]; cols[1] = normcols[attr][1];
cols[0] = normcols[attr][0]; cols[0] = normcols[attr][0];
blink = (attr & 0x80) * 8 + 7 + 16;
} }
/* character underline active and 7th row of pixels in character height being drawn */ /* character underline active and 7th row of pixels in character height being drawn */
if (underline && (sc == 7)) { if (underline && (sc == 7)) {
@@ -422,10 +413,10 @@ compaq_plasma_poll(void *priv)
buffer32->line[self->cga.displine][(x << 3) + c] = mdaattr[attr][blink][1]; buffer32->line[self->cga.displine][(x << 3) + c] = mdaattr[attr][blink][1];
} else if (drawcursor) { } else if (drawcursor) {
for (uint8_t c = 0; c < 8; c++) for (uint8_t c = 0; c < 8; c++)
buffer32->line[self->cga.displine][(x << 3) + c] = cols[(fontdatm[chr + self->cga.fontbase][sc] & (1 << (c ^ 7))) ? 1 : 0] ^ (amber ^ black); buffer32->line[self->cga.displine][(x << 3) + c] = cols[(fontdatm2[chr + self->cga.fontbase][sc] & (1 << (c ^ 7))) ? 1 : 0] ^ (amber ^ black);
} else { } else {
for (uint8_t c = 0; c < 8; c++) for (uint8_t c = 0; c < 8; c++)
buffer32->line[self->cga.displine][(x << 3) + c] = cols[(fontdatm[chr + self->cga.fontbase][sc] & (1 << (c ^ 7))) ? 1 : 0]; buffer32->line[self->cga.displine][(x << 3) + c] = cols[(fontdatm2[chr + self->cga.fontbase][sc] & (1 << (c ^ 7))) ? 1 : 0];
} }
++ma; ++ma;
@@ -441,34 +432,25 @@ compaq_plasma_poll(void *priv)
cursorline = ((self->cga.crtc[0x0a] & 0x0f) * 2 <= sc) && ((self->cga.crtc[0x0b] & 0x0F) * 2 >= sc); cursorline = ((self->cga.crtc[0x0a] & 0x0f) * 2 <= sc) && ((self->cga.crtc[0x0b] & 0x0F) * 2 >= sc);
for (uint8_t x = 0; x < 40; x++) { for (uint8_t x = 0; x < 40; x++) {
if (self->cga.cgamode & 8) { chr = self->cga.vram[(addr + 2 * x) & 0x7FFF];
chr = self->cga.vram[(addr + 2 * x) & 0x7fff]; attr = self->cga.vram[(addr + 2 * x + 1) & 0x7FFF];
attr = self->cga.vram[(addr + 2 * x + 1) & 0x7fff]; drawcursor = ((ma == ca) && cursorline && (self->cga.cgamode & 8) && (self->cga.cgablink & 16));
} else {
chr = attr = 0; blink = ((self->cga.cgablink & 16) && (self->cga.cgamode & 0x20) && (attr & 0x80) && !drawcursor);
}
drawcursor = ((ma == ca) && cursorline && self->cga.cursoron);
underline = ((self->port_23c6 & 0x40) && (attr & 0x1) && !(attr & 0x6)); underline = ((self->port_23c6 & 0x40) && (attr & 0x1) && !(attr & 0x6));
if (underline) {
/* set forecolor to white */
attr |= 7;
}
blink = 0;
/* blink active */ /* blink active */
if (self->cga.cgamode & 0x20) { if (self->cga.cgamode & 0x20) {
cols[1] = blinkcols[attr][1]; cols[1] = blinkcols[attr][1];
cols[0] = blinkcols[attr][0]; cols[0] = blinkcols[attr][0];
/* attribute 7 active and not cursor */ /* attribute 7 active and not cursor */
if ((self->cga.cgablink & 8) && (attr & 0x80) && !self->cga.drawcursor) { if (blink) {
/* set blinking */ /* set blinking */
cols[1] = cols[0]; cols[1] = cols[0];
blink = 1;
} }
} else { } else {
/* Set intensity bit */ /* Set intensity bit */
cols[1] = normcols[attr][1]; cols[1] = normcols[attr][1];
cols[0] = normcols[attr][0]; cols[0] = normcols[attr][0];
blink = (attr & 0x80) * 8 + 7 + 16;
} }
/* character underline active and 7th row of pixels in character height being drawn */ /* character underline active and 7th row of pixels in character height being drawn */
if (underline && (sc == 7)) { if (underline && (sc == 7)) {
@@ -476,13 +458,11 @@ compaq_plasma_poll(void *priv)
for (uint8_t c = 0; c < 8; c++) for (uint8_t c = 0; c < 8; c++)
buffer32->line[self->cga.displine][(x << 4) + (c * 2)] = buffer32->line[self->cga.displine][(x << 4) + (c * 2) + 1] = mdaattr[attr][blink][1]; buffer32->line[self->cga.displine][(x << 4) + (c * 2)] = buffer32->line[self->cga.displine][(x << 4) + (c * 2) + 1] = mdaattr[attr][blink][1];
} else if (drawcursor) { } else if (drawcursor) {
for (uint8_t c = 0; c < 8; c++) { for (uint8_t c = 0; c < 8; c++)
buffer32->line[self->cga.displine][(x << 4) + c * 2] = buffer32->line[self->cga.displine][(x << 4) + c * 2 + 1] = cols[(fontdatm[chr][sc] & (1 << (c ^ 7))) ? 1 : 0] ^ (amber ^ black); buffer32->line[self->cga.displine][(x << 4) + c * 2] = buffer32->line[self->cga.displine][(x << 4) + c * 2 + 1] = cols[(fontdatm2[chr][sc] & (1 << (c ^ 7))) ? 1 : 0] ^ (amber ^ black);
}
} else { } else {
for (uint8_t c = 0; c < 8; c++) { for (uint8_t c = 0; c < 8; c++)
buffer32->line[self->cga.displine][(x << 4) + c * 2] = buffer32->line[self->cga.displine][(x << 4) + c * 2 + 1] = cols[(fontdatm[chr][sc] & (1 << (c ^ 7))) ? 1 : 0]; buffer32->line[self->cga.displine][(x << 4) + c * 2] = buffer32->line[self->cga.displine][(x << 4) + c * 2 + 1] = cols[(fontdatm2[chr][sc] & (1 << (c ^ 7))) ? 1 : 0];
}
} }
++ma; ++ma;
} }
@@ -653,7 +633,7 @@ compaq_plasma_init(UNUSED(const device_t *info))
memset(self, 0, sizeof(compaq_plasma_t)); memset(self, 0, sizeof(compaq_plasma_t));
video_inform(VIDEO_FLAG_TYPE_CGA, &timing_compaq_plasma); video_inform(VIDEO_FLAG_TYPE_CGA, &timing_compaq_plasma);
loadfont_ex("roms/machines/portableiii/K Combined.bin", 1, 0x4bb2); loadfont_ex("roms/machines/portableiii/K Combined.bin", 11, 0x4bb2);
self->cga.composite = 0; self->cga.composite = 0;
self->cga.revision = 0; self->cga.revision = 0;

View File

@@ -80,6 +80,8 @@ volatile int screenshots = 0;
uint8_t edatlookup[4][4]; uint8_t edatlookup[4][4];
uint8_t fontdat[2048][8]; /* IBM CGA font */ uint8_t fontdat[2048][8]; /* IBM CGA font */
uint8_t fontdatm[2048][16]; /* IBM MDA font */ uint8_t fontdatm[2048][16]; /* IBM MDA font */
uint8_t fontdat2[2048][8]; /* IBM CGA 2nd instance font */
uint8_t fontdatm2[2048][16]; /* IBM MDA 2nd instance font */
uint8_t fontdatw[512][32]; /* Wyse700 font */ uint8_t fontdatw[512][32]; /* Wyse700 font */
uint8_t fontdat8x12[256][16]; /* MDSI Genius font */ uint8_t fontdat8x12[256][16]; /* MDSI Genius font */
uint8_t fontdat12x18[256][36]; /* IM1024 font */ uint8_t fontdat12x18[256][36]; /* IM1024 font */
@@ -1088,6 +1090,19 @@ loadfont_common(FILE *f, int format)
for (d = 0; d < 8; d++) for (d = 0; d < 8; d++)
fontdat[c][d] = fgetc(f) & 0xff; fontdat[c][d] = fgetc(f) & 0xff;
break; break;
case 11: /* PC200 */
for (d = 0; d < 4; d++) {
/* There are 4 fonts in the ROM */
for (c = 0; c < 256; c++) /* 8x14 MDA in 8x16 cell */
(void) !fread(&fontdatm2[256 * d + c][0], 1, 16, f);
for (c = 0; c < 256; c++) { /* 8x8 CGA in 8x16 cell */
(void) !fread(&fontdat2[256 * d + c][0], 1, 8, f);
fseek(f, 8, SEEK_CUR);
}
}
break;
} }
(void) fclose(f); (void) fclose(f);