forked from Apple-2-Tools/jace
Changed how traces are handled so that if boot takes a little while we don't see a dump of BRK traces to STDOUT on startup
This commit is contained in:
parent
674d9d6980
commit
11b26305f8
@ -1045,8 +1045,9 @@ public class MOS65C02 extends CPU {
|
||||
int pc = getProgramCounter();
|
||||
|
||||
String traceEntry = null;
|
||||
if (isTraceEnabled() || isLogEnabled() || warnAboutExtendedOpcodes) {
|
||||
if (isSingleTraceEnabled() || isTraceEnabled() || isLogEnabled() || warnAboutExtendedOpcodes) {
|
||||
traceEntry = getState().toUpperCase() + " " + Integer.toString(pc, 16) + " : " + disassemble();
|
||||
captureSingleTrace(traceEntry);
|
||||
if (isTraceEnabled()) {
|
||||
Logger.getLogger(getClass().getName()).info(traceEntry);
|
||||
}
|
||||
|
@ -309,6 +309,7 @@ public class MetaCheat extends Cheats {
|
||||
|
||||
@Override
|
||||
public void tick() {
|
||||
computer.cpu.performSingleTrace();
|
||||
if (fadeCounter-- <= 0) {
|
||||
fadeCounter = FADE_TIMER_VALUE;
|
||||
memoryCells.values().stream()
|
||||
@ -341,9 +342,6 @@ public class MetaCheat extends Cheats {
|
||||
CPU cpu = Emulator.computer.getCpu();
|
||||
int pc = cpu.getProgramCounter();
|
||||
String trace = cpu.getLastTrace();
|
||||
if (!cpu.isLogEnabled()) {
|
||||
cpu.traceLength = 1;
|
||||
}
|
||||
switch (e.getType()) {
|
||||
case EXECUTE:
|
||||
cell.execInstructionsDisassembly.add(trace);
|
||||
|
@ -72,14 +72,6 @@ public abstract class CPU extends Device {
|
||||
traceLog.add(line);
|
||||
}
|
||||
|
||||
public String getLastTrace() {
|
||||
if (traceLog.isEmpty()) {
|
||||
return "???";
|
||||
} else {
|
||||
return traceLog.get(traceLog.size()-1);
|
||||
}
|
||||
}
|
||||
|
||||
public void dumpTrace() {
|
||||
computer.pause();
|
||||
ArrayList<String> newLog = new ArrayList<>();
|
||||
@ -167,4 +159,20 @@ public abstract class CPU extends Device {
|
||||
}
|
||||
|
||||
abstract public void JSR(int pointer);
|
||||
|
||||
boolean singleTraceEnabled = false;
|
||||
public String lastTrace = "START";
|
||||
public void performSingleTrace() {
|
||||
singleTraceEnabled = true;
|
||||
}
|
||||
public boolean isSingleTraceEnabled() {
|
||||
return singleTraceEnabled;
|
||||
}
|
||||
public String getLastTrace() {
|
||||
return lastTrace;
|
||||
}
|
||||
public void captureSingleTrace(String trace) {
|
||||
lastTrace = trace;
|
||||
singleTraceEnabled = false;
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user