Scriptable machine improvements (including support for sleep)

This commit is contained in:
Jeff Parsons 2017-02-06 12:03:20 -08:00 committed by Jeff Parsons
commit 112c0e88c6
55 changed files with 15397 additions and 1381 deletions

View file

@ -961,6 +961,7 @@ class ComputerPDP11 extends Component {
*/
reset()
{
this.flags.reset = true;
if (this.bus && this.bus.reset) {
this.printMessage("Resetting " + this.bus.type);
this.bus.reset();
@ -977,6 +978,7 @@ class ComputerPDP11 extends Component {
component.reset();
}
}
this.flags.reset = false;
this.updateDisplays(-1);
}

View file

@ -588,13 +588,11 @@ class CPUStatePDP11 extends CPUPDP11 {
this.regsGen[0] = bUnit || 0;
for (var i = 1; i <= 5; i++) this.regsGen[i] = 0;
this.regsGen[6] = addrStack || 0o2000;
if (!this.dbg) {
if (!this.flags.powered) {
this.flags.autoStart = true;
}
else if (!this.flags.running) {
this.startCPU();
}
if (!this.flags.powered) {
this.flags.autoStart = true;
}
else if (!this.flags.running) {
this.startCPU();
}
}
else {
@ -608,7 +606,7 @@ class CPUStatePDP11 extends CPUPDP11 {
* we should probably force a complete reset, but for now, it's up to the user to hit the reset button
* themselves.
*/
if (!this.stopCPU()) {
if (!this.stopCPU() && !this.cmp.flags.reset) {
this.dbg.updateStatus();
this.cmp.updateDisplays(-1);
}

View file

@ -123,8 +123,8 @@ class DriveController extends Component {
this.irq = null;
this['exports'] = {
'boot': this.bootSelectedDisk,
'load': this.loadSelectedDrive,
'bootDisk': this.bootSelectedDisk,
'loadDisk': this.loadSelectedDrive,
'selectDrive': this.selectDrive,
'wait': this.waitDrives,
};
@ -1133,19 +1133,17 @@ class DriveController extends Component {
*
* @this {DriveController}
* @param {function()|null} fnCallReady
* @return {boolean} true if successful, false if not
* @return {boolean} false if wait required, true otherwise
*/
waitDrives(fnCallReady)
{
for (var iDrive = 0; iDrive < this.aDrives.length; iDrive++) {
var drive = this.aDrives[iDrive];
if (drive && drive.fBusy) {
drive.fnCallReady = fnCallReady;
fnCallReady = null;
break;
if (!drive.fnCallReady) drive.fnCallReady = fnCallReady;
return false;
}
}
if (fnCallReady) fnCallReady();
return true;
}

View file

@ -257,7 +257,7 @@ class RAMPDP11 extends Component {
*/
this.bus.zeroMemory(this.addrRAM, this.sizeRAM, 0);
if (this.abInit) {
this.loadImage(this.abInit, this.addrLoad, this.addrExec, this.addrRAM, true);
this.loadImage(this.abInit, this.addrLoad, this.addrExec, this.addrRAM, !this.dbg);
}
}
}

View file

@ -674,7 +674,7 @@ class SerialPortPDP11 extends Component {
{
var fTransmitted = false;
this.printMessage("transmitByte(" + Str.toHexByte(b) + ")");
if (MAXDEBUG) this.printMessage("transmitByte(" + Str.toHexByte(b) + ")");
if (this.sendData) {
if (this.sendData.call(this.connection, b)) {