Merge branch 'master' of github.com:badvision/lawless-legends

This commit is contained in:
Martin Haye 2020-06-05 13:18:22 -07:00
commit 1ec5712553
3 changed files with 26 additions and 18 deletions

View File

@ -31,7 +31,6 @@ import jace.core.RAM;
import jace.core.RAMEvent;
import jace.core.RAMListener;
import jace.core.Utility;
import jace.state.Stateful;
import jace.core.Video;
import jace.hardware.CardDiskII;
import jace.hardware.CardExt80Col;
@ -40,6 +39,7 @@ import jace.hardware.Joystick;
import jace.hardware.NoSlotClock;
import jace.hardware.ZipWarpAccelerator;
import jace.hardware.massStorage.CardMassStorage;
import jace.state.Stateful;
import java.io.IOException;
import java.lang.reflect.InvocationTargetException;
import java.util.ArrayList;
@ -163,6 +163,8 @@ public class Apple2e extends Computer {
@Override
public void warmStart() {
boolean restart = pause();
// This isn't really authentic behavior but sometimes games like memory to have a consistent state when booting.
((RAM128k)getMemory()).zeroAllRam();
for (SoftSwitches s : SoftSwitches.values()) {
if (! (s.getSwitch() instanceof VideoSoftSwitch)) {
s.getSwitch().reset();
@ -202,11 +204,11 @@ public class Apple2e extends Computer {
@Override
public final void reconfigure() {
boolean restart = pause();
if (Utility.isHeadlessMode()) {
joy1enabled = false;
joy2enabled = false;
}
RAM128k currentMemory = (RAM128k) getMemory();
@ -244,7 +246,7 @@ public class Apple2e extends Computer {
} else {
motherboard.removeChildDevice(accelerator);
}
if (joy1enabled) {
if (joystick1 == null) {
joystick1 = new Joystick(0, this);
@ -453,8 +455,8 @@ public class Apple2e extends Computer {
private void enableHints() {
if (hints.isEmpty()) {
hints.add(getMemory().observe(RAMEvent.TYPE.EXECUTE, 0x0FB63, (e)->{
animationTimer.schedule(drawHints, 1, TimeUnit.SECONDS);
animationSchedule =
animationTimer.schedule(drawHints, 1, TimeUnit.SECONDS);
animationSchedule =
animationTimer.scheduleAtFixedRate(doAnimation, 1250, 100, TimeUnit.MILLISECONDS);
}));
// Latch to the PRODOS SYNTAX CHECK parser
@ -471,7 +473,7 @@ public class Apple2e extends Computer {
if (c == 0x0d) break;
in += c;
}
System.err.println("Intercepted command: "+in);
}
});
@ -489,4 +491,4 @@ public class Apple2e extends Computer {
public String getShortName() {
return "computer";
}
}
}

View File

@ -129,12 +129,7 @@ abstract public class RAM128k extends RAM {
activeRead = new PagedMemory(0x10000, PagedMemory.Type.RAM, computer);
activeWrite = new PagedMemory(0x10000, PagedMemory.Type.RAM, computer);
blank = new PagedMemory(0x100, PagedMemory.Type.RAM, computer);
// Format memory with FF FF 00 00 pattern
for (int i = 0; i < 0x0100; i++) {
blank.get(0)[i] = (byte) 0x0FF;
}
initMemoryPattern(mainMemory);
zeroAllRam();
}
public final void initMemoryPattern(PagedMemory mem) {
@ -147,6 +142,14 @@ abstract public class RAM128k extends RAM {
}
}
public final void zeroAllRam() {
// Format memory with FF FF 00 00 pattern
for (int i = 0; i < 0x0100; i++) {
blank.get(0)[i] = (byte) 0x0FF;
}
initMemoryPattern(mainMemory);
}
private final Semaphore configurationSemaphone = new Semaphore(1, true);
/**

View File

@ -28,19 +28,22 @@ public class LawlessComputer extends Apple2e {
LawlessImageTool gameDiskHandler = new LawlessImageTool();
@ConfigurableField(name = "Boot Animation")
public boolean showBootAnimation = true;
public LawlessComputer() {
super();
this.cheatEngine.setValue(LawlessHacks.class);
this.activeCheatEngine = new LawlessHacks(this);
this.activeCheatEngine.attach();
blankTextPage1();
}
private void blankTextPage1() {
// Fill text page 1 with spaces
for (int i = 0x0400; i < 0x07FF; i++) {
getMemory().write(i, (byte) (0x080 | ' '), false, false);
}
}
}
@Override
public void coldStart() {
pause();