Skip to content

Commit

Permalink
refresh and highlight memory view rows on memory writes
Browse files Browse the repository at this point in the history
  • Loading branch information
izuzak committed Jun 16, 2012
1 parent 72a5aa3 commit 0b7765d
Showing 1 changed file with 24 additions and 3 deletions.
27 changes: 24 additions & 3 deletions main.html
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,10 @@
.currentCpuLine {
background-color : orange;
}

.memoryChangeLine {
background-color : lightblue;
}
</style>
</head>
<body>
Expand Down Expand Up @@ -410,9 +414,9 @@ <h3> Credits and license </h3>
decoded = (decoded === "MOVE r0 r0") ? "" : decoded;

lines.push("<div style='display:inline-block; padding-left: 4px; width:70px; border-right: 1px solid #dfdfdf;' class='memoryTableNumbering'>"+addr+"</div>");
lines.push("<div style='display:inline-block; padding-left: 4px; width:70px; border-right: 1px solid #dfdfdf;' class='memoryTableValue'>"+valHex+"</div>");
lines.push("<div style='display:inline-block; padding-left: 4px; width:85px; border-right: 1px solid #dfdfdf;' class='memoryTableValue'>"+valDec+"</div>");
lines.push("<div style='display:inline-block; padding-left: 4px; width:150px;' >"+decoded+"</div>");
lines.push("<div style='display:inline-block; padding-left: 4px; width:70px; border-right: 1px solid #dfdfdf;' class='memoryTableValueHex'>"+valHex+"</div>");
lines.push("<div style='display:inline-block; padding-left: 4px; width:85px; border-right: 1px solid #dfdfdf;' class='memoryTableValueDec'>"+valDec+"</div>");
lines.push("<div style='display:inline-block; padding-left: 4px; width:150px;' class='memoryTableValueIns'>"+decoded+"</div>");
lines.push("<div style='display:inline-block; padding-left: 4px; width:30px; text-align: center; border-left: 1px solid #dfdfdf;'>");
lines.push(" <input type='checkbox' addr='" + addr + "' class='breakpointCheckbox'" + checked + ">");
lines.push("</div>");
Expand Down Expand Up @@ -661,6 +665,23 @@ <h3> Credits and license </h3>
changeState("stopped");
onStopInternal();
};

simulator.MEM.onMemoryWrite = function(addr) {
addr &= ~(0x03);
var val = simulator.MEM.read(addr);
addr = formatHexNumber(convertBinaryToInt(convertIntToBinary(addr, 32), 0).toString(16));
var line = $("input[addr=" + addr + "]").parent().parent();
var decoded = simulator.CPU._decode(val);
decoded = decoded ? instructionToString(decoded) : "";
decoded = (decoded === "MOVE r0 r0") ? "" : decoded;
line.children(".memoryTableValueHex").html(formatHexNumber(convertBinaryToInt(convertIntToBinary(val, 32), 0).toString(16)));
line.children(".memoryTableValueDec").html(val.toString());
line.children(".memoryTableValueIns").html(decoded);
line.addClass("memoryChangeLine");
setTimeout(function() {
line.removeClass("memoryChangeLine");
}, 500);
};

$("#frisc-load").click(function() {
if (_state === "stopped") {
Expand Down

0 comments on commit 0b7765d

Please sign in to comment.