Fixed broken Double-Lores graphics mode (not sure if colors are correct yet though), Also fixed ESC key

This commit is contained in:
Brendan Robert 2015-02-03 23:26:12 -06:00
parent 2a4015c8a5
commit ebed2a7c52
4 changed files with 50 additions and 21 deletions

View File

@ -402,7 +402,7 @@ public class VideoDHGR extends Video {
writer.setColor(x++, y, color);
}
private void displayDoubleLores(WritableImage screen, int xOffset, int y, int rowAddress) {
protected void displayDoubleLores(WritableImage screen, int xOffset, int y, int rowAddress) {
int c1 = ((RAM128k) computer.getMemory()).getAuxVideoMemory().readByte(rowAddress + xOffset) & 0x0FF;
int c2 = ((RAM128k) computer.getMemory()).getMainMemory().readByte(rowAddress + xOffset) & 0x0FF;
if ((y & 7) < 4) {

View File

@ -121,6 +121,36 @@ public class VideoNTSC extends VideoDHGR {
scanline[pos++] = pat;
}
@Override
protected void displayDoubleLores(WritableImage screen, int xOffset, int y, int rowAddress) {
if (lastKnownY != y) {
lastKnownY = y;
pos = rowStart = divBy28[xOffset];
colorActive = true;
}
int c1 = ((RAM128k) computer.getMemory()).getAuxVideoMemory().readByte(rowAddress + xOffset) & 0x0FF;
if ((y & 7) < 4) {
c1 &= 15;
} else {
c1 >>= 4;
}
int c2 = ((RAM128k) computer.getMemory()).getMainMemory().readByte(rowAddress + xOffset) & 0x0FF;
if ((y & 7) < 4) {
c2 &= 15;
} else {
c2 >>= 4;
}
if ((xOffset & 0x01) == 0) {
int pat = c1 | c1 << 4 | c2 << 8 | (c2 & 3) << 12;
scanline[pos] = pat;
} else {
int pat = scanline[pos];
pat |= (c1 & 12) << 12 | c1 << 16 | c2 << 20 | c2 << 24;
scanline[pos] = pat;
pos++;
}
}
private void doDisplay(WritableImage screen, int xOffset, int y, int dhgrWord) {
if (pos >= 20) {
pos -= 20;

View File

@ -177,6 +177,9 @@ public class Keyboard implements Reconfigurable {
case KP_DOWN:
c = 10;
break;
case ESCAPE:
c = 27;
break;
case TAB:
c = 9;
break;
@ -187,10 +190,6 @@ public class Keyboard implements Reconfigurable {
c = 127;
break;
default:
// if (e.isControlDown()) {
// c = (char) (c - 'A' + 1);
// }
}
if (c < 128) {

View File

@ -37,21 +37,21 @@ public class Palette {
static public Color[] color;
static {
color = new Color[16];
color[ 0] = new Color( 0, 0, 0, 1);
color[ 1] = new Color(208, 0, 48, 1);
color[ 2] = new Color( 0, 0,128, 1);
color[ 3] = new Color(255, 0,255, 1);
color[ 4] = new Color( 0,128, 0, 1);
color[ 5] = new Color(128,128,128, 1);
color[ 6] = new Color( 0, 0,255, 1);
color[ 7] = new Color( 96,160,255, 1);
color[ 8] = new Color(128, 80, 0, 1);
color[ 9] = new Color(255,128, 0, 1);
color[10] = new Color(192,192,192, 1);
color[11] = new Color(255,144,128, 1);
color[12] = new Color( 0,255, 0, 1);
color[13] = new Color(255,255, 0, 1);
color[14] = new Color( 64,255,144, 1);
color[15] = new Color(255,255,255, 1);
color[ 0] = Color.rgb(0, 0, 0);
color[ 1] = Color.rgb(208, 0, 48);
color[ 2] = Color.rgb( 0, 0,128);
color[ 3] = Color.rgb(255, 0,255);
color[ 4] = Color.rgb( 0,128, 0);
color[ 5] = Color.rgb(128,128,128);
color[ 6] = Color.rgb( 0, 0,255);
color[ 7] = Color.rgb( 96,160,255);
color[ 8] = Color.rgb(128, 80, 0);
color[ 9] = Color.rgb(255,128, 0);
color[10] = Color.rgb(192,192,192);
color[11] = Color.rgb(255,144,128);
color[12] = Color.rgb( 0,255, 0);
color[13] = Color.rgb(255,255, 0);
color[14] = Color.rgb( 64,255,144);
color[15] = Color.rgb(255,255,255);
}
}