fix the reset logic
This commit is contained in:
parent
3b2b82cd69
commit
6dc3f05734
|
@ -224,6 +224,10 @@ db ff d3 ff c3 00 00 // Switch echo between A2 and A1.
|
||||||
sim.powerOff();
|
sim.powerOff();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function reset() {
|
||||||
|
sim.reset();
|
||||||
|
}
|
||||||
|
|
||||||
function loadData() {
|
function loadData() {
|
||||||
var data = document.getElementById("data").value;
|
var data = document.getElementById("data").value;
|
||||||
sim.loadDataAsHexString(0, data);
|
sim.loadDataAsHexString(0, data);
|
||||||
|
|
|
@ -123,8 +123,10 @@ class Sim8800 {
|
||||||
var data = hexString.split(' ');
|
var data = hexString.split(' ');
|
||||||
for (let i = 0; i < data.length && address < this.mem.length; i++) {
|
for (let i = 0; i < data.length && address < this.mem.length; i++) {
|
||||||
var byte = parseInt('0x' + data[i]);
|
var byte = parseInt('0x' + data[i]);
|
||||||
|
if (!isNaN(byte)) {
|
||||||
this.mem[address++] = byte;
|
this.mem[address++] = byte;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
this.dumpMem();
|
this.dumpMem();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -267,27 +269,21 @@ class Sim8800 {
|
||||||
* Powers on the machine.
|
* Powers on the machine.
|
||||||
*/
|
*/
|
||||||
powerOn() {
|
powerOn() {
|
||||||
this.stop();
|
this.isPoweredOn = true;
|
||||||
this.reset();
|
|
||||||
this.initMem();
|
this.initMem();
|
||||||
|
this.reset();
|
||||||
if (this.setStatusLedsCallback) {
|
if (this.setStatusLedsCallback) {
|
||||||
this.setStatusLedsCallback(true);
|
this.setStatusLedsCallback(true);
|
||||||
}
|
}
|
||||||
if (this.setWaitLedCallback) {
|
if (this.setWaitLedCallback) {
|
||||||
this.setWaitLedCallback(false);
|
this.setWaitLedCallback(false);
|
||||||
}
|
}
|
||||||
this.dumpCpu();
|
|
||||||
this.dumpMem();
|
|
||||||
this.isPoweredOn = true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Powers off the machine.
|
* Powers off the machine.
|
||||||
*/
|
*/
|
||||||
powerOff() {
|
powerOff() {
|
||||||
this.stop();
|
|
||||||
this.reset();
|
|
||||||
this.initMem();
|
|
||||||
if (this.setStatusLedsCallback) {
|
if (this.setStatusLedsCallback) {
|
||||||
this.setStatusLedsCallback(false);
|
this.setStatusLedsCallback(false);
|
||||||
}
|
}
|
||||||
|
@ -316,6 +312,24 @@ class Sim8800 {
|
||||||
if (!this.isPoweredOn)
|
if (!this.isPoweredOn)
|
||||||
return;
|
return;
|
||||||
CPU8080.reset();
|
CPU8080.reset();
|
||||||
|
this.stop();
|
||||||
|
if (this.setAddressLedsCallback) {
|
||||||
|
this.setAddressLedsCallback(new Array(16).fill(1));
|
||||||
|
}
|
||||||
|
if (this.setDataLedsCallback) {
|
||||||
|
this.setDataLedsCallback(new Array(8).fill(1));
|
||||||
|
}
|
||||||
|
this.dumpCpu();
|
||||||
|
this.dumpMem();
|
||||||
|
var self = this;
|
||||||
|
window.setTimeout(function() {
|
||||||
|
if (self.setAddressLedsCallback) {
|
||||||
|
self.setAddressLedsCallback(new Array(16).fill(0));
|
||||||
|
}
|
||||||
|
if (self.setDataLedsCallback) {
|
||||||
|
self.setDataLedsCallback(new Array(8).fill(0));
|
||||||
|
}
|
||||||
|
}, 400);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
Loading…
Reference in New Issue
Block a user