mirror of
https://github.com/hneemann/Digital.git
synced 2025-09-28 23:45:17 -04:00
Removed complete listing support from simulator.
Listing functions are moved to the assembler IDE.
This commit is contained in:
parent
0213a358b0
commit
e9af552d91
@ -432,15 +432,6 @@ 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
|
||||||
*/
|
*/
|
||||||
@ -463,13 +454,41 @@ public class Model implements Iterable<Node> {
|
|||||||
* @return the list, not null, but maybe empty
|
* @return the list, not null, but maybe empty
|
||||||
*/
|
*/
|
||||||
public <NODE extends Node> List<NODE> findNode(Class<NODE> nodeClass) {
|
public <NODE extends Node> List<NODE> findNode(Class<NODE> nodeClass) {
|
||||||
|
return findNode(nodeClass, n -> true);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns all nodes of the given class.
|
||||||
|
* A filter cann be used to narrow down the amount of nodes found.
|
||||||
|
*
|
||||||
|
* @param nodeClass the class
|
||||||
|
* @param filter filter to filter the nodes
|
||||||
|
* @param <NODE> the node type
|
||||||
|
* @return the list, not null, but maybe empty
|
||||||
|
*/
|
||||||
|
public <NODE extends Node> List<NODE> findNode(Class<NODE> nodeClass, NodeFilter<NODE> filter) {
|
||||||
ArrayList<NODE> found = new ArrayList<>();
|
ArrayList<NODE> found = new ArrayList<>();
|
||||||
for (Node n : nodes)
|
for (Node n : nodes)
|
||||||
if (n.getClass() == nodeClass)
|
if (n.getClass() == nodeClass && filter.accept((NODE) n))
|
||||||
found.add((NODE) n);
|
found.add((NODE) n);
|
||||||
return found;
|
return found;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* A filter for nodes
|
||||||
|
*
|
||||||
|
* @param <NODE>
|
||||||
|
*/
|
||||||
|
public interface NodeFilter<NODE extends Node> {
|
||||||
|
/**
|
||||||
|
* Accepts the node
|
||||||
|
*
|
||||||
|
* @param n the node
|
||||||
|
* @return true if accepted
|
||||||
|
*/
|
||||||
|
boolean accept(NODE n);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Iterator<Node> iterator() {
|
public Iterator<Node> iterator() {
|
||||||
return nodes.iterator();
|
return nodes.iterator();
|
||||||
|
@ -101,9 +101,6 @@ 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);
|
||||||
|
@ -986,7 +986,7 @@ public class Main extends JFrame implements ClosingWindowListener.ConfirmSave, E
|
|||||||
private long addr;
|
private long addr;
|
||||||
|
|
||||||
private void getProgRomAddr(Model model) {
|
private void getProgRomAddr(Model model) {
|
||||||
ArrayList<ROM> roms = model.getProgRoms();
|
List<ROM> roms = model.findNode(ROM.class, ROM::isProgramMemory);
|
||||||
if (roms.size() == 1)
|
if (roms.size() == 1)
|
||||||
addr = roms.get(0).getRomAddress();
|
addr = roms.get(0).getRomAddress();
|
||||||
else
|
else
|
||||||
@ -1001,6 +1001,29 @@ public class Main extends JFrame implements ClosingWindowListener.ConfirmSave, E
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void setDebug(boolean debug) throws RemoteException {
|
||||||
|
settings.set(Keys.SHOW_DATA_TABLE, debug);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void start(File romHex) throws RemoteException {
|
||||||
|
setDebug(false);
|
||||||
|
SwingUtilities.invokeLater(() -> {
|
||||||
|
windowPosManager.closeAll();
|
||||||
|
runModelState.enter(true, new RomLoader(romHex));
|
||||||
|
circuitComponent.hasChanged();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void debug(File romHex) throws RemoteException {
|
||||||
|
setDebug(true);
|
||||||
|
SwingUtilities.invokeLater(() -> {
|
||||||
|
runModelState.enter(false, new RomLoader(romHex));
|
||||||
|
circuitComponent.hasChanged();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String doSingleStep() throws RemoteException {
|
public String doSingleStep() throws RemoteException {
|
||||||
if (model != null && !realtimeClockRunning) {
|
if (model != null && !realtimeClockRunning) {
|
||||||
@ -1047,29 +1070,6 @@ public class Main extends JFrame implements ClosingWindowListener.ConfirmSave, E
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void setDebug(boolean debug) throws RemoteException {
|
|
||||||
settings.set(Keys.SHOW_DATA_TABLE, debug);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void debug(File romHex) throws RemoteException {
|
|
||||||
setDebug(true);
|
|
||||||
SwingUtilities.invokeLater(() -> {
|
|
||||||
runModelState.enter(false, new RomLoader(romHex));
|
|
||||||
circuitComponent.hasChanged();
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void start(File romHex) throws RemoteException {
|
|
||||||
setDebug(false);
|
|
||||||
SwingUtilities.invokeLater(() -> {
|
|
||||||
windowPosManager.closeAll();
|
|
||||||
runModelState.enter(true, new RomLoader(romHex));
|
|
||||||
circuitComponent.hasChanged();
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void stop() {
|
public void stop() {
|
||||||
SwingUtilities.invokeLater(() -> {
|
SwingUtilities.invokeLater(() -> {
|
||||||
|
@ -8,7 +8,7 @@ import de.neemann.digital.lang.Lang;
|
|||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.util.ArrayList;
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A Modifier that loads a given rom file to the program memory of the model.
|
* A Modifier that loads a given rom file to the program memory of the model.
|
||||||
@ -28,7 +28,7 @@ public class RomLoader implements ModelModifier {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void preInit(Model model) throws NodeException {
|
public void preInit(Model model) throws NodeException {
|
||||||
ArrayList<ROM> roms = model.getProgRoms();
|
List<ROM> roms = model.findNode(ROM.class, ROM::isProgramMemory);
|
||||||
if (roms.isEmpty())
|
if (roms.isEmpty())
|
||||||
throw new NodeException(Lang.get("msg_noRomFound"));
|
throw new NodeException(Lang.get("msg_noRomFound"));
|
||||||
if (roms.size() > 1)
|
if (roms.size() > 1)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user