Generate CGA-to-EGA tables in video.c; Remove redundant table generation in vid_ega.c

This commit is contained in:
GreaseMonkey
2023-11-21 10:26:13 +13:00
parent f890257237
commit 1f5d00fe55
3 changed files with 14 additions and 28 deletions

View File

@@ -34,6 +34,7 @@ extern int cgablink;
extern int scrollcache;
extern uint8_t edatlookup[4][4];
extern uint8_t egaremap2bpp[256];
void svga_recalc_remap_func(svga_t *svga);

View File

@@ -61,8 +61,6 @@ static uint32_t pallook64[256];
static int ega_type = 0;
static int old_overscan_color = 0;
uint8_t egaremap2bpp[256];
/* 3C2 controls default mode on EGA. On VGA, it determines monitor type (mono or colour):
7=CGA mode (200 lines), 9=EGA mode (350 lines), 8=EGA mode (200 lines). */
int egaswitchread;
@@ -1282,32 +1280,6 @@ ega_init(ega_t *ega, int monitor_type, int is_mono)
}
}
for (c = 0; c < 4; c++) {
for (d = 0; d < 4; d++) {
edatlookup[c][d] = 0;
if (c & 1)
edatlookup[c][d] |= 1;
if (d & 1)
edatlookup[c][d] |= 2;
if (c & 2)
edatlookup[c][d] |= 0x10;
if (d & 2)
edatlookup[c][d] |= 0x20;
}
}
for (c = 0; c < 256; c++) {
egaremap2bpp[c] = 0;
if (c & 0x01)
egaremap2bpp[c] |= 0x01;
if (c & 0x04)
egaremap2bpp[c] |= 0x02;
if (c & 0x10)
egaremap2bpp[c] |= 0x04;
if (c & 0x40)
egaremap2bpp[c] |= 0x08;
}
if (is_mono) {
for (c = 0; c < 256; c++) {
if (((c >> 3) & 3) == 0)

View File

@@ -78,6 +78,7 @@
volatile int screenshots = 0;
uint8_t edatlookup[4][4];
uint8_t egaremap2bpp[256];
uint8_t fontdat[2048][8]; /* IBM CGA font */
uint8_t fontdatm[2048][16]; /* IBM MDA font */
uint8_t fontdat2[2048][8]; /* IBM CGA 2nd instance font */
@@ -915,6 +916,18 @@ video_init(void)
}
}
for (uint16_t c = 0; c < 256; c++) {
egaremap2bpp[c] = 0;
if (c & 0x01)
egaremap2bpp[c] |= 0x01;
if (c & 0x04)
egaremap2bpp[c] |= 0x02;
if (c & 0x10)
egaremap2bpp[c] |= 0x04;
if (c & 0x40)
egaremap2bpp[c] |= 0x08;
}
video_6to8 = malloc(4 * 256);
for (uint16_t c = 0; c < 256; c++)
video_6to8[c] = calc_6to8(c);