Color fringed text in mixed mode.

This commit is contained in:
Will Scullin 2017-10-01 11:18:41 -07:00
parent fa4f85d014
commit 6c92f33af3

View File

@ -30,6 +30,22 @@ var highColorTextMode = false;
var scanlines = false; var scanlines = false;
function dim(c) {
return [
c[0] * 0.75 & 0xff,
c[1] * 0.75 & 0xff,
c[2] * 0.75 & 0xff
];
}
// hires colors
var orangeCol = [0xff, 0x65, 0x00];
var greenCol = [0x00, 0xff, 0x00];
var blueCol = [0x09, 0x2a, 0xff];
var violetCol = [0xc9, 0x39, 0xc7];
var whiteCol = [0xff, 0xff, 0xff];
var blackCol = [0x00, 0x00, 0x00];
/**************************************************************************** /****************************************************************************
* *
* Text/Lores Graphics * Text/Lores Graphics
@ -51,8 +67,6 @@ function LoresPage(page, charset, e, context)
var _greenMode = false; var _greenMode = false;
var _blink = false; var _blink = false;
var _black = [0x00,0x00,0x00];
var _white = [0xff,0xff,0xff];
var _green = [0x00,0xff,0x80]; var _green = [0x00,0xff,0x80];
var _colors = [ var _colors = [
@ -192,21 +206,18 @@ function LoresPage(page, charset, e, context)
if ((row < 24) && (col < 40)) { if ((row < 24) && (col < 40)) {
var color; var color;
if (textMode || hiresMode || (mixedMode && row > 19)) { if (textMode || hiresMode || (mixedMode && row > 19)) {
var inverse;
if (e) { if (e) {
var flash = ((val & 0xc0) == 0x40) && if (!_80colMode && !altCharMode) {
_blink && !_80colMode && !altCharMode; inverse = ((val & 0xc0) == 0x40) && _blink;
fore = flash ? _black : (_greenMode ? _green : _white);
back = flash ? (_greenMode ? _green : _white) : _black;
} else {
if (val & 0x80 || ((val & 0x40) && _blink)) {
fore = _greenMode ? _green : _white;
back = _black;
} else {
fore = _black;
back = _greenMode ? _green : _white;
} }
} else {
inverse = !((val & 0x80) || (val & 0x40) && _blink);
} }
fore = inverse ? blackCol : (_greenMode ? _green : whiteCol);
back = inverse ? (_greenMode ? _green : whiteCol) : blackCol;
if (_80colMode) { if (_80colMode) {
if (!enhanced) { if (!enhanced) {
val = (val >= 0x40 && val < 0x60) ? val - 0x40 : val; val = (val >= 0x40 && val < 0x60) ? val - 0x40 : val;
@ -254,11 +265,34 @@ function LoresPage(page, charset, e, context)
off += 546 * 4 + 560 * 4; off += 546 * 4 + 560 * 4;
} }
} else { } else {
var colorMode = mixedMode && !textMode && !_greenMode;
// var val0 = col > 0 ? _buffer[0][base - 1] : 0;
// var val2 = col < 39 ? _buffer[0][base + 1] : 0;
for (jdx = 0; jdx < 8; jdx++) { for (jdx = 0; jdx < 8; jdx++) {
b = charset[val * 8 + jdx]; var odd = !(col & 0x1);
b <<= 1; b = charset[val * 8 + jdx] << 1;
if (colorMode) {
// var b0 = charset[val0 * 8 + jdx];
// var b2 = charset[val2 * 8 + jdx];
if (inverse) { b ^= 0x1ff; }
}
for (idx = 0; idx < 7; idx++) { for (idx = 0; idx < 7; idx++) {
if (colorMode) {
if (b & 0x80) {
if ((b & 0x1c0) != 0x80) {
color = whiteCol;
} else {
color = odd ? violetCol : greenCol;
}
} else {
color = blackCol;
}
odd = !odd;
} else {
color = (b & 0x80) ? fore : back; color = (b & 0x80) ? fore : back;
}
_drawPixel(data, off, color); _drawPixel(data, off, color);
b <<= 1; b <<= 1;
off += 8; off += 8;
@ -272,7 +306,7 @@ function LoresPage(page, charset, e, context)
off = (col * 14 + (bank ? 0 : 1) * 7 + row * 560 * 8 * 2) * 4; off = (col * 14 + (bank ? 0 : 1) * 7 + row * 560 * 8 * 2) * 4;
if (_greenMode) { if (_greenMode) {
fore = _green; fore = _green;
back = _black; back = blackCol;
for (jdx = 0; jdx < 8; jdx++) { for (jdx = 0; jdx < 8; jdx++) {
b = (jdx < 8) ? (val & 0x0f) : (val >> 4); b = (jdx < 8) ? (val & 0x0f) : (val >> 4);
b |= (b << 4); b |= (b << 4);
@ -306,7 +340,7 @@ function LoresPage(page, charset, e, context)
if (_greenMode) { if (_greenMode) {
fore = _green; fore = _green;
back = _black; back = blackCol;
for (jdx = 0; jdx < 8; jdx++) { for (jdx = 0; jdx < 8; jdx++) {
b = (jdx < 4) ? (val & 0x0f) : (val >> 4); b = (jdx < 4) ? (val & 0x0f) : (val >> 4);
b |= (b << 4); b |= (b << 4);
@ -463,14 +497,6 @@ function HiresPage(page, context)
[0xff,0xff,0xff] // 0xf white [0xff,0xff,0xff] // 0xf white
]; ];
// hires colors
var orangeCol = [0xff, 0x65, 0x00];
var greenCol = [0x00, 0xff, 0x00];
var blueCol = [0x09, 0x2a, 0xff];
var violetCol = [0xc9, 0x39, 0xc7];
var whiteCol = [0xff, 0xff, 0xff];
var blackCol = [0x00, 0x00, 0x00];
var _buffer = []; var _buffer = [];
var _refreshing = false; var _refreshing = false;
@ -569,13 +595,6 @@ function HiresPage(page, context)
}, },
_write: function(page, off, val, bank) { _write: function(page, off, val, bank) {
function dim(c) {
return [
c[0] * 0.75 & 0xff,
c[1] * 0.75 & 0xff,
c[2] * 0.75 & 0xff
];
}
var addr = (page << 8) | off, base = addr - 0x2000 * _page, var addr = (page << 8) | off, base = addr - 0x2000 * _page,
idx, jdx; idx, jdx;