mirror of
https://github.com/badvision/jace.git
synced 2024-12-29 17:30:03 +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
|
||||
* Optional Debugging rom (][DB) can be enabled for a more powerful monitor
|
||||
* 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!
|
||||
|
||||
![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.RAMListener;
|
||||
import jace.core.Video;
|
||||
import java.util.Arrays;
|
||||
import java.util.HashSet;
|
||||
import java.util.Set;
|
||||
import javafx.scene.image.PixelWriter;
|
||||
@ -69,6 +70,9 @@ public class VideoNTSC extends VideoDHGR {
|
||||
@Override
|
||||
protected void showBW(WritableImage screen, int x, int y, int dhgrWord) {
|
||||
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;
|
||||
scanline[pos] = dhgrWord;
|
||||
}
|
||||
@ -76,6 +80,9 @@ public class VideoNTSC extends VideoDHGR {
|
||||
@Override
|
||||
protected void showDhgr(WritableImage screen, int x, int y, int dhgrWord) {
|
||||
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;
|
||||
scanline[pos] = dhgrWord;
|
||||
}
|
||||
@ -83,6 +90,9 @@ public class VideoNTSC extends VideoDHGR {
|
||||
@Override
|
||||
protected void displayLores(WritableImage screen, int xOffset, int y, int rowAddress) {
|
||||
int pos = xOffset >> 1;
|
||||
if (rowStart < 0) {
|
||||
rowStart = pos;
|
||||
}
|
||||
colorActive[xOffset * 2] = colorActive[xOffset * 2 + 1] = true;
|
||||
int data = ((RAM128k) computer.getMemory()).getMainMemory().readByte(rowAddress + xOffset) & 0x0FF;
|
||||
if ((xOffset & 1) == 0) {
|
||||
@ -108,6 +118,9 @@ public class VideoNTSC extends VideoDHGR {
|
||||
@Override
|
||||
protected void displayDoubleLores(WritableImage screen, int xOffset, int y, int rowAddress) {
|
||||
int pos = xOffset >> 1;
|
||||
if (rowStart < 0) {
|
||||
rowStart = pos;
|
||||
}
|
||||
colorActive[xOffset * 2] = colorActive[xOffset * 2 + 1] = true;
|
||||
int c1 = ((RAM128k) computer.getMemory()).getAuxVideoMemory().readByte(rowAddress + xOffset) & 0x0FF;
|
||||
if ((y & 7) < 4) {
|
||||
@ -154,15 +167,15 @@ public class VideoNTSC extends VideoDHGR {
|
||||
}
|
||||
|
||||
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;
|
||||
if (rowStart > 0) {
|
||||
getCurrentWriter().markDirty(y);
|
||||
if (rowStart != 0) {
|
||||
// getCurrentWriter().markDirty(y);
|
||||
p = rowStart * 28;
|
||||
if (rowStart < 0) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
PixelWriter writer = screen.getPixelWriter();
|
||||
// Reset scanline position
|
||||
int byteCounter = 0;
|
||||
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]
|
||||
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.")
|
||||
public static int MIN_SCREEN_REFRESH = 15;
|
||||
|
||||
Runnable redrawScreen = () -> {
|
||||
visible.getPixelWriter().setPixels(0, 0, 560, 192, video.getPixelReader(), 0, 0);
|
||||
};
|
||||
public void redraw() {
|
||||
screenDirty = false;
|
||||
javafx.application.Platform.runLater(() -> {
|
||||
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();
|
||||
// }
|
||||
javafx.application.Platform.runLater(redrawScreen);
|
||||
}
|
||||
|
||||
public void vblankStart() {
|
||||
@ -160,15 +157,15 @@ public abstract class Video extends Device {
|
||||
setFloatingBus(computer.getMemory().readRaw(scannerAddress + x));
|
||||
if (hPeriod > 0) {
|
||||
hPeriod--;
|
||||
if (hPeriod == 0) {
|
||||
if (hPeriod <= 1) {
|
||||
x = -1;
|
||||
setScannerLocation(currentWriter.getYOffset(y));
|
||||
}
|
||||
} else {
|
||||
if (!isVblank && x < (APPLE_CYCLES_PER_LINE-1)) {
|
||||
if (!isVblank && x < (APPLE_CYCLES_PER_LINE)) {
|
||||
draw();
|
||||
}
|
||||
if (x >= APPLE_CYCLES_PER_LINE - 1) {
|
||||
if (x >= APPLE_CYCLES_PER_LINE) {
|
||||
int yy = y + hblankOffsetY;
|
||||
if (yy < 0) {
|
||||
yy += APPLE_SCREEN_LINES;
|
||||
|
Loading…
Reference in New Issue
Block a user