all UI-simulator connection code done. TODO: debug controls. soft switch board. sounds. better animations.
This commit is contained in:
parent
393195fb7f
commit
01e2f5369c
|
@ -564,6 +564,10 @@
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<footer>
|
<footer>
|
||||||
|
<input id="debug-data-input" type="text" size="60">
|
||||||
|
<input id="debug-load-data" type="button" value="LOAD DATA"><br>
|
||||||
|
<div id="cpu-dump"></div>
|
||||||
|
<div id="mem-dump"></div>
|
||||||
</footer>
|
</footer>
|
||||||
|
|
||||||
<script src="js/l10n.js"></script>
|
<script src="js/l10n.js"></script>
|
||||||
|
|
41
js/panel.js
41
js/panel.js
|
@ -384,6 +384,10 @@ panel.init = function() {
|
||||||
var button = document.getElementById('locale');
|
var button = document.getElementById('locale');
|
||||||
button.addEventListener('click', l10n.nextLocale, false);
|
button.addEventListener('click', l10n.nextLocale, false);
|
||||||
|
|
||||||
|
// Initializes event listener for debug controls.
|
||||||
|
button = document.getElementById('debug-load-data');
|
||||||
|
button.addEventListener('click', panel.debugLoadData, false);
|
||||||
|
|
||||||
// Initializes svg components for all LEDs.
|
// Initializes svg components for all LEDs.
|
||||||
for (let i = 0; i < panel.LED_INFO.length; i++) {
|
for (let i = 0; i < panel.LED_INFO.length; i++) {
|
||||||
let info = panel.LED_INFO[i];
|
let info = panel.LED_INFO[i];
|
||||||
|
@ -434,9 +438,7 @@ panel.init = function() {
|
||||||
panel.setAddressLedsCallback, panel.setDataLedsCallback,
|
panel.setAddressLedsCallback, panel.setDataLedsCallback,
|
||||||
panel.setWaitLedCallback, panel.setStatusLedsCallback,
|
panel.setWaitLedCallback, panel.setStatusLedsCallback,
|
||||||
panel.getInputAddressCallback,
|
panel.getInputAddressCallback,
|
||||||
null, /* dumpCpuCallback */
|
panel.dumpCpuCallback, panel.dumpMemCallback);
|
||||||
null /* dumpMemcallback */
|
|
||||||
);
|
|
||||||
};
|
};
|
||||||
|
|
||||||
panel.setAddressLedsCallback = function(bits) {
|
panel.setAddressLedsCallback = function(bits) {
|
||||||
|
@ -491,16 +493,20 @@ panel.getInputAddressCallback = function() {
|
||||||
return word;
|
return word;
|
||||||
};
|
};
|
||||||
|
|
||||||
// panel.dumpCpuCallback = function(dumpHtml) {
|
panel.dumpCpuCallback = function(dumpHtml) {
|
||||||
// var dumpCpuElem = document.getElementById('cpu');
|
var dumpCpuElem = document.getElementById('cpu-dump');
|
||||||
// dumpCpuElem.innerHTML = dumpHtml;
|
dumpCpuElem.innerHTML = dumpHtml;
|
||||||
// };
|
};
|
||||||
|
|
||||||
// panel.dumpMemCallback = function(dumpHtml) {
|
panel.dumpMemCallback = function(dumpHtml) {
|
||||||
// var dumpMemElem = document.getElementById('mem');
|
var dumpMemElem = document.getElementById('mem-dump');
|
||||||
// dumpMemElem.innerHTML = dumpHtml;
|
dumpMemElem.innerHTML = dumpHtml;
|
||||||
// };
|
};
|
||||||
|
|
||||||
|
panel.debugLoadData = function() {
|
||||||
|
var data = document.getElementById("debug-data-input").value;
|
||||||
|
panel.sim.loadDataAsHexString(0, data);
|
||||||
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Creates a new LED inside the panel svg.
|
* Creates a new LED inside the panel svg.
|
||||||
|
@ -696,7 +702,6 @@ panel.switchDownThenBack = function(id) {
|
||||||
*/
|
*/
|
||||||
panel.onStop = function() {
|
panel.onStop = function() {
|
||||||
panel.switchUpThenBack('STOP-RUN');
|
panel.switchUpThenBack('STOP-RUN');
|
||||||
window.console.log('STOP');
|
|
||||||
panel.sim.stop();
|
panel.sim.stop();
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -705,7 +710,6 @@ panel.onStop = function() {
|
||||||
*/
|
*/
|
||||||
panel.onRun = function() {
|
panel.onRun = function() {
|
||||||
panel.switchDownThenBack('STOP-RUN');
|
panel.switchDownThenBack('STOP-RUN');
|
||||||
window.console.log('RUN');
|
|
||||||
panel.sim.start();
|
panel.sim.start();
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -714,7 +718,6 @@ panel.onRun = function() {
|
||||||
*/
|
*/
|
||||||
panel.onSingle = function() {
|
panel.onSingle = function() {
|
||||||
panel.switchUpThenBack('SINGLE');
|
panel.switchUpThenBack('SINGLE');
|
||||||
window.console.log('SINGLE STEP');
|
|
||||||
panel.sim.step(1);
|
panel.sim.step(1);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -723,7 +726,6 @@ panel.onSingle = function() {
|
||||||
*/
|
*/
|
||||||
panel.onExamine = function() {
|
panel.onExamine = function() {
|
||||||
panel.switchUpThenBack('EXAMINE');
|
panel.switchUpThenBack('EXAMINE');
|
||||||
window.console.log('EXAMINE');
|
|
||||||
panel.sim.examine();
|
panel.sim.examine();
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -732,7 +734,6 @@ panel.onExamine = function() {
|
||||||
*/
|
*/
|
||||||
panel.onExamineNext = function() {
|
panel.onExamineNext = function() {
|
||||||
panel.switchDownThenBack('EXAMINE');
|
panel.switchDownThenBack('EXAMINE');
|
||||||
window.console.log('EXAMINE NEXT');
|
|
||||||
panel.sim.examineNext();
|
panel.sim.examineNext();
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -741,7 +742,6 @@ panel.onExamineNext = function() {
|
||||||
*/
|
*/
|
||||||
panel.onDeposit = function() {
|
panel.onDeposit = function() {
|
||||||
panel.switchUpThenBack('DEPOSIT');
|
panel.switchUpThenBack('DEPOSIT');
|
||||||
window.console.log('DEPOSIT');
|
|
||||||
panel.sim.deposit();
|
panel.sim.deposit();
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -750,7 +750,6 @@ panel.onDeposit = function() {
|
||||||
*/
|
*/
|
||||||
panel.onDepositNext = function() {
|
panel.onDepositNext = function() {
|
||||||
panel.switchDownThenBack('DEPOSIT');
|
panel.switchDownThenBack('DEPOSIT');
|
||||||
window.console.log('DEPOSIT NEXT');
|
|
||||||
panel.sim.depositNext();
|
panel.sim.depositNext();
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -759,7 +758,6 @@ panel.onDepositNext = function() {
|
||||||
*/
|
*/
|
||||||
panel.onReset = function() {
|
panel.onReset = function() {
|
||||||
panel.switchUpThenBack('RESET');
|
panel.switchUpThenBack('RESET');
|
||||||
window.console.log('RESET');
|
|
||||||
panel.sim.reset();
|
panel.sim.reset();
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -767,7 +765,6 @@ panel.onReset = function() {
|
||||||
* When power is turned on.
|
* When power is turned on.
|
||||||
*/
|
*/
|
||||||
panel.onPowerOn = function() {
|
panel.onPowerOn = function() {
|
||||||
window.console.log('POWER ON');
|
|
||||||
panel.sim.powerOn();
|
panel.sim.powerOn();
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -775,7 +772,6 @@ panel.onPowerOn = function() {
|
||||||
* When power is turned off.
|
* When power is turned off.
|
||||||
*/
|
*/
|
||||||
panel.onPowerOff = function() {
|
panel.onPowerOff = function() {
|
||||||
window.console.log('POWER OFF');
|
|
||||||
panel.sim.powerOff();
|
panel.sim.powerOff();
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -788,10 +784,8 @@ panel.onPowerOff = function() {
|
||||||
panel.onToggle = function(id, state) {
|
panel.onToggle = function(id, state) {
|
||||||
if (state == 0) {
|
if (state == 0) {
|
||||||
panel.switchUp(id);
|
panel.switchUp(id);
|
||||||
window.console.log('TOGGLE: ' + id + ' 0->1');
|
|
||||||
} else {
|
} else {
|
||||||
panel.switchDown(id);
|
panel.switchDown(id);
|
||||||
window.console.log('TOGGLE: ' + id + ' 1->0');
|
|
||||||
}
|
}
|
||||||
if (id == 'OFF-ON') {
|
if (id == 'OFF-ON') {
|
||||||
if (state == 0) {
|
if (state == 0) {
|
||||||
|
@ -803,6 +797,5 @@ panel.onToggle = function(id, state) {
|
||||||
var bitIndex = parseInt(id.substr(1));
|
var bitIndex = parseInt(id.substr(1));
|
||||||
panel.addressSwitchStates[bitIndex] =
|
panel.addressSwitchStates[bitIndex] =
|
||||||
panel.addressSwitchStates[bitIndex] ? 0 : 1;
|
panel.addressSwitchStates[bitIndex] ? 0 : 1;
|
||||||
window.console.log(panel.addressSwitchStates);
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
Loading…
Reference in New Issue
Block a user