mirror of
https://github.com/hneemann/Digital.git
synced 2025-09-28 23:45:17 -04:00
rom address is send back to assembler via TCP/IP interface
This commit is contained in:
parent
0166fba015
commit
ea86dd1b93
@ -1,5 +1,6 @@
|
|||||||
package de.neemann.digital.core;
|
package de.neemann.digital.core;
|
||||||
|
|
||||||
|
import de.neemann.digital.core.memory.ROM;
|
||||||
import de.neemann.digital.core.wiring.Break;
|
import de.neemann.digital.core.wiring.Break;
|
||||||
import de.neemann.digital.core.wiring.Clock;
|
import de.neemann.digital.core.wiring.Clock;
|
||||||
import de.neemann.digital.core.wiring.Reset;
|
import de.neemann.digital.core.wiring.Reset;
|
||||||
@ -43,6 +44,7 @@ public class Model implements Iterable<Node> {
|
|||||||
private final ArrayList<Clock> clocks;
|
private final ArrayList<Clock> clocks;
|
||||||
private final ArrayList<Break> breaks;
|
private final ArrayList<Break> breaks;
|
||||||
private final ArrayList<Reset> resets;
|
private final ArrayList<Reset> resets;
|
||||||
|
private final ArrayList<ROM> progRoms;
|
||||||
|
|
||||||
private final ArrayList<Signal> signals;
|
private final ArrayList<Signal> signals;
|
||||||
private final ArrayList<Signal> inputs;
|
private final ArrayList<Signal> inputs;
|
||||||
@ -62,6 +64,7 @@ public class Model implements Iterable<Node> {
|
|||||||
this.clocks = new ArrayList<>();
|
this.clocks = new ArrayList<>();
|
||||||
this.breaks = new ArrayList<>();
|
this.breaks = new ArrayList<>();
|
||||||
this.resets = new ArrayList<>();
|
this.resets = new ArrayList<>();
|
||||||
|
this.progRoms = new ArrayList<>();
|
||||||
this.signals = new ArrayList<>();
|
this.signals = new ArrayList<>();
|
||||||
this.outputs = new ArrayList<>();
|
this.outputs = new ArrayList<>();
|
||||||
this.inputs = new ArrayList<>();
|
this.inputs = new ArrayList<>();
|
||||||
@ -429,6 +432,15 @@ public class Model implements Iterable<Node> {
|
|||||||
return n;
|
return n;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public void addProgRom(ROM rom) {
|
||||||
|
progRoms.add(rom);
|
||||||
|
}
|
||||||
|
|
||||||
|
public ArrayList<ROM> getProgRoms() {
|
||||||
|
return progRoms;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* fires a model changed event to all listeners
|
* fires a model changed event to all listeners
|
||||||
*/
|
*/
|
||||||
|
@ -115,6 +115,9 @@ public class ROM extends Node implements Element {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void init(Model model) throws NodeException {
|
public void init(Model model) throws NodeException {
|
||||||
|
if (isProgramMemory) {
|
||||||
|
model.addProgRom(this);
|
||||||
|
}
|
||||||
if (autoLoad) {
|
if (autoLoad) {
|
||||||
try {
|
try {
|
||||||
data = new DataField(hexFile);
|
data = new DataField(hexFile);
|
||||||
|
@ -21,30 +21,37 @@ public interface DigitalRemoteInterface {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Starts the model
|
* Starts the model
|
||||||
|
*
|
||||||
* @throws RemoteException RemoteException
|
* @throws RemoteException RemoteException
|
||||||
*/
|
*/
|
||||||
void start() throws RemoteException;
|
void start() throws RemoteException;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Starts the model in debug mode
|
* Starts the model in debug mode
|
||||||
|
*
|
||||||
* @throws RemoteException RemoteException
|
* @throws RemoteException RemoteException
|
||||||
*/
|
*/
|
||||||
void debug() throws RemoteException;
|
void debug() throws RemoteException;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* performs a single step
|
* performs a single step
|
||||||
|
*
|
||||||
|
* @return actual position
|
||||||
* @throws RemoteException RemoteException
|
* @throws RemoteException RemoteException
|
||||||
*/
|
*/
|
||||||
void doSingleStep() throws RemoteException;
|
String doSingleStep() throws RemoteException;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* runs model to the next BRK instruction
|
* runs model to the next BRK instruction
|
||||||
|
*
|
||||||
|
* @return actual position
|
||||||
* @throws RemoteException RemoteException
|
* @throws RemoteException RemoteException
|
||||||
*/
|
*/
|
||||||
void runToBreak() throws RemoteException;
|
String runToBreak() throws RemoteException;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* stops the model
|
* stops the model
|
||||||
|
*
|
||||||
* @throws RemoteException RemoteException
|
* @throws RemoteException RemoteException
|
||||||
*/
|
*/
|
||||||
void stop() throws RemoteException;
|
void stop() throws RemoteException;
|
||||||
|
@ -52,6 +52,7 @@ import java.io.File;
|
|||||||
import java.io.FileOutputStream;
|
import java.io.FileOutputStream;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.io.OutputStream;
|
import java.io.OutputStream;
|
||||||
|
import java.lang.reflect.InvocationTargetException;
|
||||||
import java.net.URL;
|
import java.net.URL;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
@ -1019,39 +1020,57 @@ public class Main extends JFrame implements ClosingWindowListener.ConfirmSave, E
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void doSingleStep() {
|
public String doSingleStep() throws RemoteException {
|
||||||
if (model != null && !realtimeClockRunning) {
|
if (model != null && !realtimeClockRunning) {
|
||||||
SwingUtilities.invokeLater(() -> {
|
try {
|
||||||
ArrayList<Clock> cl = model.getClocks();
|
SwingUtilities.invokeAndWait(() -> {
|
||||||
if (cl.size() == 1) {
|
ArrayList<Clock> cl = model.getClocks();
|
||||||
ObservableValue clkVal = cl.get(0).getClockOutput();
|
if (cl.size() == 1) {
|
||||||
clkVal.setBool(!clkVal.getBool());
|
ObservableValue clkVal = cl.get(0).getClockOutput();
|
||||||
try {
|
clkVal.setBool(!clkVal.getBool());
|
||||||
model.doStep();
|
try {
|
||||||
if (clkVal.getBool()) {
|
|
||||||
clkVal.setBool(!clkVal.getBool());
|
|
||||||
model.doStep();
|
model.doStep();
|
||||||
|
if (clkVal.getBool()) {
|
||||||
|
clkVal.setBool(!clkVal.getBool());
|
||||||
|
model.doStep();
|
||||||
|
}
|
||||||
|
circuitComponent.hasChanged();
|
||||||
|
} catch (NodeException e) {
|
||||||
|
showErrorAndStopModel(Lang.get("err_remoteExecution"), e);
|
||||||
}
|
}
|
||||||
circuitComponent.hasChanged();
|
|
||||||
} catch (NodeException e) {
|
|
||||||
showErrorAndStopModel(Lang.get("err_remoteExecution"), e);
|
|
||||||
}
|
}
|
||||||
}
|
});
|
||||||
});
|
return getProgRomAddr();
|
||||||
|
} catch (InterruptedException | InvocationTargetException e) {
|
||||||
|
throw new RemoteException("error performing a single step "+e.getMessage());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
private String getProgRomAddr() {
|
||||||
|
ArrayList<ROM> roms = model.getProgRoms();
|
||||||
|
if (roms.size()==1)
|
||||||
|
return Long.toHexString(roms.get(0).getRomAddress());
|
||||||
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void runToBreak() {
|
public String runToBreak() throws RemoteException {
|
||||||
SwingUtilities.invokeLater(() -> {
|
try {
|
||||||
if (model != null && model.isFastRunModel() && !realtimeClockRunning)
|
SwingUtilities.invokeAndWait(() -> {
|
||||||
runToBreakAction.actionPerformed(null);
|
if (model != null && model.isFastRunModel() && !realtimeClockRunning)
|
||||||
});
|
runToBreakAction.actionPerformed(null);
|
||||||
|
});
|
||||||
|
return getProgRomAddr();
|
||||||
|
} catch (InterruptedException | InvocationTargetException e) {
|
||||||
|
throw new RemoteException("error performing a run to break "+e.getMessage());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void setDebug(boolean debug) throws RemoteException {
|
private void setDebug(boolean debug) throws RemoteException {
|
||||||
VisualElement rom = getProgramRomFromCircuit();
|
VisualElement rom = getProgramRomFromCircuit();
|
||||||
rom.getElementAttributes().set(Keys.SHOW_LISTING, debug);
|
//rom.getElementAttributes().set(Keys.SHOW_LISTING, debug);
|
||||||
settings.set(Keys.SHOW_DATA_TABLE, debug);
|
settings.set(Keys.SHOW_DATA_TABLE, debug);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -31,34 +31,35 @@ public class DigitalHandler implements HandlerInterface {
|
|||||||
}
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
handle(command.toLowerCase(), args);
|
String ret = handle(command.toLowerCase(), args);
|
||||||
return "ok";
|
if (ret != null)
|
||||||
|
return "ok:"+ret;
|
||||||
|
else
|
||||||
|
return "ok";
|
||||||
} catch (RemoteException e) {
|
} catch (RemoteException e) {
|
||||||
return e.getMessage();
|
return e.getMessage();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void handle(String command, String args) throws RemoteException {
|
private String handle(String command, String args) throws RemoteException {
|
||||||
switch (command) {
|
switch (command) {
|
||||||
case "step":
|
case "step":
|
||||||
digitalRemoteInterface.doSingleStep();
|
return digitalRemoteInterface.doSingleStep();
|
||||||
break;
|
|
||||||
case "start":
|
case "start":
|
||||||
digitalRemoteInterface.start();
|
digitalRemoteInterface.start();
|
||||||
break;
|
return null;
|
||||||
case "debug":
|
case "debug":
|
||||||
digitalRemoteInterface.debug();
|
digitalRemoteInterface.debug();
|
||||||
break;
|
return null;
|
||||||
case "run":
|
case "run":
|
||||||
digitalRemoteInterface.runToBreak();
|
return digitalRemoteInterface.runToBreak();
|
||||||
break;
|
|
||||||
case "stop":
|
case "stop":
|
||||||
digitalRemoteInterface.stop();
|
digitalRemoteInterface.stop();
|
||||||
break;
|
return null;
|
||||||
case "load":
|
case "load":
|
||||||
File file = new File(args);
|
File file = new File(args);
|
||||||
digitalRemoteInterface.loadRom(file);
|
digitalRemoteInterface.loadRom(file);
|
||||||
break;
|
return null;
|
||||||
default:
|
default:
|
||||||
throw new RemoteException(Lang.get("msg_remoteUnknownCommand", command));
|
throw new RemoteException(Lang.get("msg_remoteUnknownCommand", command));
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user