mirror of
https://github.com/badvision/jace.git
synced 2024-11-28 10:52:33 +00:00
Finally fixed the flicker bug introduced in the 2.0 code changes! Passes against various graphics demos without issues (thanks again, French Touch!)
This commit is contained in:
parent
497a5335f6
commit
c098d6345b
@ -14,7 +14,7 @@ Jace is a java-based Apple //e emulator with many compelling features:
|
|||||||
* MetaCheat also provides a live heat-map showing all RAM activity, color coded to indicate read, write or CPU execution -- Perfect for reverse engineers
|
* MetaCheat also provides a live heat-map showing all RAM activity, color coded to indicate read, write or CPU execution -- Perfect for reverse engineers
|
||||||
* Optional Debugging rom (][DB) can be enabled for a more powerful monitor
|
* Optional Debugging rom (][DB) can be enabled for a more powerful monitor
|
||||||
* Super serial emulated as a tcp/ip port
|
* Super serial emulated as a tcp/ip port
|
||||||
* Mockingboard support, partial Phasor support
|
* Mockingboard and Phasor support
|
||||||
* Highly flexible configuration allows any combination of cards and many extra options. You can even alter configuration while the emulation is running!
|
* Highly flexible configuration allows any combination of cards and many extra options. You can even alter configuration while the emulation is running!
|
||||||
|
|
||||||
![Airheart](https://sites.google.com/site/brendanrobert/_/rsrc/1327073239228/projects/jace/airheart.png?height=250&width=400)
|
![Airheart](https://sites.google.com/site/brendanrobert/_/rsrc/1327073239228/projects/jace/airheart.png?height=250&width=400)
|
||||||
|
@ -23,6 +23,7 @@ import jace.core.Computer;
|
|||||||
import jace.core.RAMEvent;
|
import jace.core.RAMEvent;
|
||||||
import jace.core.RAMListener;
|
import jace.core.RAMListener;
|
||||||
import jace.core.Video;
|
import jace.core.Video;
|
||||||
|
import java.util.Arrays;
|
||||||
import java.util.HashSet;
|
import java.util.HashSet;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
import javafx.scene.image.PixelWriter;
|
import javafx.scene.image.PixelWriter;
|
||||||
@ -69,6 +70,9 @@ public class VideoNTSC extends VideoDHGR {
|
|||||||
@Override
|
@Override
|
||||||
protected void showBW(WritableImage screen, int x, int y, int dhgrWord) {
|
protected void showBW(WritableImage screen, int x, int y, int dhgrWord) {
|
||||||
int pos = divBy28[x];
|
int pos = divBy28[x];
|
||||||
|
if (rowStart < 0) {
|
||||||
|
rowStart = pos;
|
||||||
|
}
|
||||||
colorActive[pos * 4] = colorActive[pos * 4 + 1] = colorActive[pos * 4 + 2] = colorActive[pos * 4 + 3] = false;
|
colorActive[pos * 4] = colorActive[pos * 4 + 1] = colorActive[pos * 4 + 2] = colorActive[pos * 4 + 3] = false;
|
||||||
scanline[pos] = dhgrWord;
|
scanline[pos] = dhgrWord;
|
||||||
}
|
}
|
||||||
@ -76,6 +80,9 @@ public class VideoNTSC extends VideoDHGR {
|
|||||||
@Override
|
@Override
|
||||||
protected void showDhgr(WritableImage screen, int x, int y, int dhgrWord) {
|
protected void showDhgr(WritableImage screen, int x, int y, int dhgrWord) {
|
||||||
int pos = divBy28[x];
|
int pos = divBy28[x];
|
||||||
|
if (rowStart < 0) {
|
||||||
|
rowStart = pos;
|
||||||
|
}
|
||||||
colorActive[pos * 4] = colorActive[pos * 4 + 1] = colorActive[pos * 4 + 2] = colorActive[pos * 4 + 3] = true;
|
colorActive[pos * 4] = colorActive[pos * 4 + 1] = colorActive[pos * 4 + 2] = colorActive[pos * 4 + 3] = true;
|
||||||
scanline[pos] = dhgrWord;
|
scanline[pos] = dhgrWord;
|
||||||
}
|
}
|
||||||
@ -83,6 +90,9 @@ public class VideoNTSC extends VideoDHGR {
|
|||||||
@Override
|
@Override
|
||||||
protected void displayLores(WritableImage screen, int xOffset, int y, int rowAddress) {
|
protected void displayLores(WritableImage screen, int xOffset, int y, int rowAddress) {
|
||||||
int pos = xOffset >> 1;
|
int pos = xOffset >> 1;
|
||||||
|
if (rowStart < 0) {
|
||||||
|
rowStart = pos;
|
||||||
|
}
|
||||||
colorActive[xOffset * 2] = colorActive[xOffset * 2 + 1] = true;
|
colorActive[xOffset * 2] = colorActive[xOffset * 2 + 1] = true;
|
||||||
int data = ((RAM128k) computer.getMemory()).getMainMemory().readByte(rowAddress + xOffset) & 0x0FF;
|
int data = ((RAM128k) computer.getMemory()).getMainMemory().readByte(rowAddress + xOffset) & 0x0FF;
|
||||||
if ((xOffset & 1) == 0) {
|
if ((xOffset & 1) == 0) {
|
||||||
@ -108,6 +118,9 @@ public class VideoNTSC extends VideoDHGR {
|
|||||||
@Override
|
@Override
|
||||||
protected void displayDoubleLores(WritableImage screen, int xOffset, int y, int rowAddress) {
|
protected void displayDoubleLores(WritableImage screen, int xOffset, int y, int rowAddress) {
|
||||||
int pos = xOffset >> 1;
|
int pos = xOffset >> 1;
|
||||||
|
if (rowStart < 0) {
|
||||||
|
rowStart = pos;
|
||||||
|
}
|
||||||
colorActive[xOffset * 2] = colorActive[xOffset * 2 + 1] = true;
|
colorActive[xOffset * 2] = colorActive[xOffset * 2 + 1] = true;
|
||||||
int c1 = ((RAM128k) computer.getMemory()).getAuxVideoMemory().readByte(rowAddress + xOffset) & 0x0FF;
|
int c1 = ((RAM128k) computer.getMemory()).getAuxVideoMemory().readByte(rowAddress + xOffset) & 0x0FF;
|
||||||
if ((y & 7) < 4) {
|
if ((y & 7) < 4) {
|
||||||
@ -154,15 +167,15 @@ public class VideoNTSC extends VideoDHGR {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void renderScanline(WritableImage screen, int y) {
|
private void renderScanline(WritableImage screen, int y) {
|
||||||
PixelWriter writer = screen.getPixelWriter();
|
|
||||||
// This is equivilant to y*560 but is 5% faster
|
|
||||||
//int yOffset = ((y << 4) + (y << 5) + (y << 9))+xOffset;
|
|
||||||
|
|
||||||
// For some reason this jumps up to 40 in the wayout title screen (?)
|
|
||||||
int p = 0;
|
int p = 0;
|
||||||
if (rowStart > 0) {
|
if (rowStart != 0) {
|
||||||
getCurrentWriter().markDirty(y);
|
// getCurrentWriter().markDirty(y);
|
||||||
|
p = rowStart * 28;
|
||||||
|
if (rowStart < 0) {
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
PixelWriter writer = screen.getPixelWriter();
|
||||||
// Reset scanline position
|
// Reset scanline position
|
||||||
int byteCounter = 0;
|
int byteCounter = 0;
|
||||||
for (int s = rowStart; s < 20; s++) {
|
for (int s = rowStart; s < 20; s++) {
|
||||||
@ -209,6 +222,8 @@ public class VideoNTSC extends VideoDHGR {
|
|||||||
// }
|
// }
|
||||||
// }
|
// }
|
||||||
}
|
}
|
||||||
|
Arrays.fill(scanline, 0);
|
||||||
|
rowStart = -1;
|
||||||
}
|
}
|
||||||
// y Range [0,1]
|
// y Range [0,1]
|
||||||
public static final double MIN_Y = 0;
|
public static final double MIN_Y = 0;
|
||||||
|
@ -130,15 +130,12 @@ public abstract class Video extends Device {
|
|||||||
@ConfigurableField(category = "video", name = "Min. Screen Refesh", defaultValue = "15", description = "Minimum number of miliseconds to wait before trying to redraw.")
|
@ConfigurableField(category = "video", name = "Min. Screen Refesh", defaultValue = "15", description = "Minimum number of miliseconds to wait before trying to redraw.")
|
||||||
public static int MIN_SCREEN_REFRESH = 15;
|
public static int MIN_SCREEN_REFRESH = 15;
|
||||||
|
|
||||||
|
Runnable redrawScreen = () -> {
|
||||||
|
visible.getPixelWriter().setPixels(0, 0, 560, 192, video.getPixelReader(), 0, 0);
|
||||||
|
};
|
||||||
public void redraw() {
|
public void redraw() {
|
||||||
screenDirty = false;
|
screenDirty = false;
|
||||||
javafx.application.Platform.runLater(() -> {
|
javafx.application.Platform.runLater(redrawScreen);
|
||||||
visible.getPixelWriter().setPixels(0, 0, 560, 192, video.getPixelReader(), 0, 0);
|
|
||||||
});
|
|
||||||
// screen.drawImage(video, 0, 0, width, height, null);
|
|
||||||
// if (Emulator.getFrame() != null) {
|
|
||||||
// Emulator.getFrame().repaintIndicators();
|
|
||||||
// }
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void vblankStart() {
|
public void vblankStart() {
|
||||||
@ -160,15 +157,15 @@ public abstract class Video extends Device {
|
|||||||
setFloatingBus(computer.getMemory().readRaw(scannerAddress + x));
|
setFloatingBus(computer.getMemory().readRaw(scannerAddress + x));
|
||||||
if (hPeriod > 0) {
|
if (hPeriod > 0) {
|
||||||
hPeriod--;
|
hPeriod--;
|
||||||
if (hPeriod == 0) {
|
if (hPeriod <= 1) {
|
||||||
x = -1;
|
x = -1;
|
||||||
setScannerLocation(currentWriter.getYOffset(y));
|
setScannerLocation(currentWriter.getYOffset(y));
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (!isVblank && x < (APPLE_CYCLES_PER_LINE-1)) {
|
if (!isVblank && x < (APPLE_CYCLES_PER_LINE)) {
|
||||||
draw();
|
draw();
|
||||||
}
|
}
|
||||||
if (x >= APPLE_CYCLES_PER_LINE - 1) {
|
if (x >= APPLE_CYCLES_PER_LINE) {
|
||||||
int yy = y + hblankOffsetY;
|
int yy = y + hblankOffsetY;
|
||||||
if (yy < 0) {
|
if (yy < 0) {
|
||||||
yy += APPLE_SCREEN_LINES;
|
yy += APPLE_SCREEN_LINES;
|
||||||
|
Loading…
Reference in New Issue
Block a user