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

@ -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;
}