diff --git a/distribution/ReleaseNotes.txt b/distribution/ReleaseNotes.txt index cf16a867d..f56c74266 100644 --- a/distribution/ReleaseNotes.txt +++ b/distribution/ReleaseNotes.txt @@ -6,6 +6,7 @@ HEAD, planned as v0.20 - Added EEPROM with separate ports for reading and writing. - The external assembly IDE is able to preload also RAMs with executable code. The register representing the program counter must be marked as such. +- Allows the pre-loading of program memory if a RAM is used as such. v0.19, released on 14. June 2018 - Added a tabbed pane to the attributes dialog to make it more beginner friendly. diff --git a/src/main/java/de/neemann/digital/core/element/Keys.java b/src/main/java/de/neemann/digital/core/element/Keys.java index afbf1e573..0ff967265 100644 --- a/src/main/java/de/neemann/digital/core/element/Keys.java +++ b/src/main/java/de/neemann/digital/core/element/Keys.java @@ -658,4 +658,16 @@ public final class Keys { public static final Key CUSTOM_SHAPE = new Key<>("customShape", CustomShapeDescription.EMPTY).setSecondary(); + /** + * True if a program is loaded to the simulator at startup + */ + public static final Key PRELOAD_PROGRAM + = new Key("preloadProgram", false).setSecondary(); + + /** + * The file to preload as a program at startup + */ + public static final Key PROGRAM_TO_PRELOAD + = new Key.KeyFile("preloadProgramFile", new File("")).setSecondary(); + } diff --git a/src/main/java/de/neemann/digital/gui/Main.java b/src/main/java/de/neemann/digital/gui/Main.java index c3280a54f..967dd2ecc 100644 --- a/src/main/java/de/neemann/digital/gui/Main.java +++ b/src/main/java/de/neemann/digital/gui/Main.java @@ -1277,6 +1277,10 @@ public final class Main extends JFrame implements ClosingWindowListener.ConfirmS if (modelModifier != null) modelModifier.preInit(model); + else { + if (settings.get(Keys.PRELOAD_PROGRAM)) + new RomLoader(settings.get(Keys.PROGRAM_TO_PRELOAD)).preInit(model); + } model.init(); diff --git a/src/main/java/de/neemann/digital/gui/components/CircuitComponent.java b/src/main/java/de/neemann/digital/gui/components/CircuitComponent.java index 9f9594305..2ae7dd335 100644 --- a/src/main/java/de/neemann/digital/gui/components/CircuitComponent.java +++ b/src/main/java/de/neemann/digital/gui/components/CircuitComponent.java @@ -75,6 +75,8 @@ public class CircuitComponent extends JComponent implements Circuit.ChangedListe ATTR_LIST.add(Keys.SHOW_DATA_TABLE); ATTR_LIST.add(Keys.SHOW_DATA_GRAPH); ATTR_LIST.add(Keys.SHOW_DATA_GRAPH_MICRO); + ATTR_LIST.add(Keys.PRELOAD_PROGRAM); + ATTR_LIST.add(Keys.PROGRAM_TO_PRELOAD); } private static final String DEL_ACTION = "myDelAction"; diff --git a/src/main/resources/lang/lang_de.xml b/src/main/resources/lang/lang_de.xml index f98e64ae7..b63417362 100644 --- a/src/main/resources/lang/lang_de.xml +++ b/src/main/resources/lang/lang_de.xml @@ -1180,6 +1180,17 @@ Sind evtl. die Namen der Variablen nicht eindeutig? Verwendet die einfache Form zur Darstellung. Hat nur einen Effekt, wenn die Schaltung eine Benutzerdefinierte Form oder eine DIL Form verwendet. + Datei beim Start in den Programmspeicher laden. + Wird ein Prozessor simuliert, der einen RAM-Baustein als Programmspeicher + verwendet, ist es schwierig, diesen Prozessor zu starten, da der RAM Inhalt beim Start der Simulation immer mit + Nullen initialisiert wird. Diese Einstellung erlaubt das Laden von Daten in den Programmspeicher. + Der Programmspeicher in der Simulation muss als solcher markiert sein. + + Programdatei + Datei welche beim Start der Simulation in den Programspeicher geladen werden + soll. + + Ausrichtung Lage der Koordinate relativ zum Text. links unten diff --git a/src/main/resources/lang/lang_en.xml b/src/main/resources/lang/lang_en.xml index ac78b03a4..ffde16965 100644 --- a/src/main/resources/lang/lang_en.xml +++ b/src/main/resources/lang/lang_en.xml @@ -1170,6 +1170,17 @@ Use Default Shape Use the default shape instead of using the DIL or custom shape configured in the circuit. + Preload program memory at startup. + When simulating a processor that uses a RAM device as the program memory, + it is difficult to start this processor because the RAM contents are always initialized with zeros at the start + of the simulation. This setting allows loading data into the program memory at startup. + The program memory in the simulation must be marked as such. + + Program file + File which should be loaded into the program memory at the start of the + simulation. + + Orientation Position of the coordinate relative to the text. left bottom