diff --git a/se/sics/mspsim/cli/DebugCommands.java b/se/sics/mspsim/cli/DebugCommands.java index 9bc1a98..b12d21d 100644 --- a/se/sics/mspsim/cli/DebugCommands.java +++ b/se/sics/mspsim/cli/DebugCommands.java @@ -110,17 +110,17 @@ public class DebugCommands implements CommandBundle { if (Character.isDigit(modeStr.charAt(0))) { length = Integer.parseInt(modeStr); } else if ("char".equals(modeStr)) { - mode = 1; + mode = Utils.ASCII_UNMODIFIED; // 4 } else if ("break".equals(modeStr)) { - mode = 2; + mode = 10; } else if ("hex".equals(modeStr)) { - mode = 3; + mode = Utils.HEX; // 2 } } } CPUMonitor monitor = new CPUMonitor() { public void cpuAction(int type, int adr, int data) { - if (mode == 0 || mode == 2) { + if (mode == 0 || mode == 10) { int pc = cpu.readRegister(0); String adrStr = getSymOrAddr(context, adr); String pcStr = getSymOrAddrELF(getELF(), pc); @@ -132,17 +132,17 @@ public class DebugCommands implements CommandBundle { } context.out.println("*** " + op + " from " + pcStr + ": " + adrStr + " = " + data); - if (mode == 2) { + if (mode == 10) { cpu.stop(); } } else { if (length > 1) { for (int i = address; i < address + length; i++) { - context.out.print(Utils.toString(cpu.memory[i], Utils.BYTE, mode == 1 ? Utils.ASCII : Utils.HEX)); + context.out.print(Utils.toString(cpu.memory[i], Utils.BYTE, mode)); } context.out.println(); } else { - context.out.print(Utils.toString(data, Utils.BYTE, mode == 1 ? Utils.ASCII : Utils.HEX)); + context.out.print(Utils.toString(data, Utils.BYTE, mode)); } } } diff --git a/se/sics/mspsim/core/MSP430Core.java b/se/sics/mspsim/core/MSP430Core.java index 8353f63..6836b03 100644 --- a/se/sics/mspsim/core/MSP430Core.java +++ b/se/sics/mspsim/core/MSP430Core.java @@ -55,7 +55,7 @@ public class MSP430Core extends Chip implements MSP430Constants { public static final int RETURN = 0x4130; public static final boolean DEBUG = false; - public static final boolean debugInterrupts = true;//false; + public static final boolean debugInterrupts = false; public static final boolean EXCEPTION_ON_BAD_OPERATION = true; diff --git a/se/sics/mspsim/platform/z1/Z1Node.java b/se/sics/mspsim/platform/z1/Z1Node.java index 57cf4d3..016307d 100644 --- a/se/sics/mspsim/platform/z1/Z1Node.java +++ b/se/sics/mspsim/platform/z1/Z1Node.java @@ -7,12 +7,17 @@ import se.sics.mspsim.core.IOPort; import se.sics.mspsim.core.IOUnit; import se.sics.mspsim.core.PortListener; import se.sics.mspsim.platform.GenericNode; -import se.sics.mspsim.platform.esb.ESBNode; import se.sics.mspsim.util.ArgumentManager; public class Z1Node extends GenericNode implements PortListener { IOPort port1; + IOPort port5; + + public static final int LEDS_CONF_RED = 0x10; + public static final int LEDS_CONF_GREEN = 0x40; + public static final int LEDS_CONF_YELLOW = 0x20; + public Z1Node() { super("Z1", new MSP430f2617Config()); @@ -20,6 +25,11 @@ public class Z1Node extends GenericNode implements PortListener { public void portWrite(IOPort source, int data) { System.out.println("Write to port: " + source + " => " + data); + if (source == port5) { + System.out.println("LEDS GREEN = " + ((data & LEDS_CONF_GREEN) > 0)); + System.out.println("LEDS RED = " + ((data & LEDS_CONF_RED) > 0)); + System.out.println("LEDS YELLOW = " + ((data & LEDS_CONF_YELLOW) > 0)); + } } private void setupNodePorts() { @@ -28,6 +38,11 @@ public class Z1Node extends GenericNode implements PortListener { port1 = (IOPort) unit; port1.setPortListener(this); } + unit = cpu.getIOUnit("P5"); + if (unit instanceof IOPort) { + port5 = (IOPort) unit; + port5.setPortListener(this); + } } public void setupNode() { diff --git a/se/sics/mspsim/util/Utils.java b/se/sics/mspsim/util/Utils.java index b8e151b..4a70dd5 100644 --- a/se/sics/mspsim/util/Utils.java +++ b/se/sics/mspsim/util/Utils.java @@ -51,6 +51,7 @@ public class Utils { public static final int ASCII = 1; public static final int HEX = 2; public static final int DEC = 3; + public static final int ASCII_UNMODIFIED = 4; public static int size(int type) { return 1 + (type / 2); @@ -65,6 +66,8 @@ public class Utils { } else { return "."; } + case ASCII_UNMODIFIED: + return "" + ((char) data); case HEX: return (size == 2 ? Utils.hex16(data):Utils.hex8(data)); }