Corrected the Hercules Plus 48 RAM Font mode attributes, fixes #3529.
This commit is contained in:
@@ -231,9 +231,10 @@ draw_char_rom(herculesplus_t *dev, int x, uint8_t chr, uint8_t attr)
|
||||
int elg;
|
||||
int blk;
|
||||
int cw = HERCULESPLUS_CW;
|
||||
int blink = dev->ctrl & HERCULESPLUS_CTRL_BLINK;
|
||||
|
||||
blk = 0;
|
||||
if (dev->ctrl & HERCULESPLUS_CTRL_BLINK) {
|
||||
if (blink) {
|
||||
if (attr & 0x80)
|
||||
blk = (dev->blink & 16);
|
||||
attr &= 0x7f;
|
||||
@@ -318,35 +319,22 @@ draw_char_ram4(herculesplus_t *dev, int x, uint8_t chr, uint8_t attr)
|
||||
elg = 0;
|
||||
else
|
||||
elg = ((chr >= 0xc0) && (chr <= 0xdf));
|
||||
|
||||
fnt = dev->vram + 0x4000 + 16 * chr + dev->sc;
|
||||
|
||||
if (blk) {
|
||||
/* Blinking, draw all background */
|
||||
val = 0x000;
|
||||
val = 0x000; /* Blinking, draw all background */
|
||||
} else if (dev->sc == ull) {
|
||||
/* Underscore, draw all foreground */
|
||||
val = 0x1ff;
|
||||
val = 0x1ff; /* Underscore, draw all foreground */
|
||||
} else {
|
||||
val = fnt[0x00000] << 1;
|
||||
val = fnt[0] << 1;
|
||||
|
||||
if (elg)
|
||||
val |= (val >> 1) & 1;
|
||||
}
|
||||
|
||||
for (int i = 0; i < cw; i++) {
|
||||
/* Generate pixel colour */
|
||||
cfg = 0;
|
||||
|
||||
if (val & 0x100)
|
||||
cfg = ifg;
|
||||
else
|
||||
cfg = ibg;
|
||||
|
||||
/* cfg = colour of foreground pixels */
|
||||
if ((attr & 0x77) == 0)
|
||||
cfg = ibg; /* 'blank' attribute */
|
||||
|
||||
buffer32->line[dev->displine][x * cw + i] = dev->cols[attr][!!blink][cfg];
|
||||
buffer32->line[dev->displine][x * cw + i] = (val & 0x100) ? ifg : ibg;
|
||||
val = val << 1;
|
||||
}
|
||||
}
|
||||
@@ -354,98 +342,66 @@ draw_char_ram4(herculesplus_t *dev, int x, uint8_t chr, uint8_t attr)
|
||||
static void
|
||||
draw_char_ram48(herculesplus_t *dev, int x, uint8_t chr, uint8_t attr)
|
||||
{
|
||||
int elg;
|
||||
int blk;
|
||||
int ul;
|
||||
int ol;
|
||||
int bld;
|
||||
unsigned ull;
|
||||
unsigned oll;
|
||||
unsigned ulc = 0;
|
||||
unsigned olc = 0;
|
||||
unsigned val;
|
||||
unsigned ibg;
|
||||
unsigned cfg;
|
||||
const unsigned char *fnt;
|
||||
int cw = HERCULESPLUS_CW;
|
||||
int blink = dev->ctrl & HERCULESPLUS_CTRL_BLINK;
|
||||
int font = (attr & 0x0F);
|
||||
unsigned ull;
|
||||
unsigned val;
|
||||
unsigned ifg;
|
||||
unsigned ibg;
|
||||
unsigned cfg;
|
||||
const uint8_t *fnt;
|
||||
int elg;
|
||||
int blk;
|
||||
int cw = HERCULESPLUS_CW;
|
||||
int blink = dev->ctrl & HERCULESPLUS_CTRL_BLINK;
|
||||
int font = (attr & 0x0F);
|
||||
|
||||
if (font >= 12)
|
||||
font &= 7;
|
||||
|
||||
attr = (attr >> 4) ^ 0x0f;;
|
||||
|
||||
blk = 0;
|
||||
if (blink) {
|
||||
if (attr & 0x40)
|
||||
if (attr & 0x80)
|
||||
blk = (dev->blink & 16);
|
||||
attr &= 0x7f;
|
||||
}
|
||||
|
||||
/* MDA-compatible attributes */
|
||||
if (blink) {
|
||||
ibg = (attr & 0x80) ? 8 : 0;
|
||||
bld = 0;
|
||||
ol = (attr & 0x20) ? 1 : 0;
|
||||
ul = (attr & 0x10) ? 1 : 0;
|
||||
} else {
|
||||
bld = (attr & 0x80) ? 1 : 0;
|
||||
ibg = (attr & 0x40) ? 0x0F : 0;
|
||||
ol = (attr & 0x20) ? 1 : 0;
|
||||
ul = (attr & 0x10) ? 1 : 0;
|
||||
}
|
||||
|
||||
if (ul) {
|
||||
ull = dev->crtc[HERCULESPLUS_CRTC_UNDER] & 0x0F;
|
||||
ulc = (dev->crtc[HERCULESPLUS_CRTC_UNDER] >> 4) & 0x0F;
|
||||
if (ulc == 0)
|
||||
ulc = 7;
|
||||
} else {
|
||||
ull = 0xFFFF;
|
||||
}
|
||||
|
||||
if (ol) {
|
||||
oll = dev->crtc[HERCULESPLUS_CRTC_OVER] & 0x0F;
|
||||
olc = (dev->crtc[HERCULESPLUS_CRTC_OVER] >> 4) & 0x0F;
|
||||
if (olc == 0)
|
||||
olc = 7;
|
||||
} else {
|
||||
oll = 0xFFFF;
|
||||
ibg = 0;
|
||||
ifg = 7;
|
||||
if ((attr & 0x77) == 0x70) { /* Invert */
|
||||
ifg = 0;
|
||||
ibg = 7;
|
||||
}
|
||||
if (attr & 8)
|
||||
ifg |= 8; /* High intensity FG */
|
||||
if (attr & 0x80)
|
||||
ibg |= 8; /* High intensity BG */
|
||||
if ((attr & 0x77) == 0) /* Blank */
|
||||
ifg = ibg;
|
||||
ull = ((attr & 0x07) == 1) ? 13 : 0xffff;
|
||||
|
||||
if (dev->crtc[HERCULESPLUS_CRTC_XMODE] & HERCULESPLUS_XMODE_90COL)
|
||||
elg = 0;
|
||||
else
|
||||
elg = ((chr >= 0xc0) && (chr <= 0xdf));
|
||||
|
||||
fnt = dev->vram + 0x4000 + 16 * chr + 4096 * font + dev->sc;
|
||||
|
||||
if (blk) { /* Blinking, draw all background */
|
||||
val = 0x000;
|
||||
if (blk) {
|
||||
val = 0x000; /* Blinking, draw all background */
|
||||
} else if (dev->sc == ull) {
|
||||
/* Underscore, draw all foreground */
|
||||
val = 0x1ff;
|
||||
val = 0x1ff; /* Underscore, draw all foreground */
|
||||
} else {
|
||||
val = fnt[0x00000] << 1;
|
||||
val = fnt[0] << 1;
|
||||
|
||||
if (elg)
|
||||
val |= (val >> 1) & 1;
|
||||
if (bld)
|
||||
val |= (val >> 1);
|
||||
}
|
||||
|
||||
for (int i = 0; i < cw; i++) {
|
||||
/* Generate pixel colour */
|
||||
cfg = val & 0x100;
|
||||
if (dev->sc == oll)
|
||||
cfg = olc ^ ibg; /* Strikethrough */
|
||||
else if (dev->sc == ull)
|
||||
cfg = ulc ^ ibg; /* Underline */
|
||||
else if (val & 0x100)
|
||||
cfg |= ~ibg;
|
||||
else
|
||||
cfg |= ibg;
|
||||
|
||||
buffer32->line[dev->displine][(x * cw) + i] = dev->cols[attr][!!blink][cfg];
|
||||
val = val << 1;
|
||||
buffer32->line[dev->displine][x * cw + i] = (val & 0x100) ? ifg : ibg;
|
||||
val = val << 1;
|
||||
}
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user