Support for overriding machine hard drive(s)

This commit is contained in:
Jeff Parsons 2016-03-10 00:54:34 -08:00
commit e9e7ccf6f2
17 changed files with 370 additions and 310 deletions

View file

@ -88,21 +88,11 @@ function HDC(parmsHDC) {
this.aDriveConfigs = [];
if (parmsHDC['drives']) {
try {
/*
* The most likely source of any exception will be right here, where we're parsing
* the JSON-encoded drive data.
*/
this.aDriveConfigs = eval("(" + parmsHDC['drives'] + ")");
/*
* Nothing more to do with aDriveConfigs now. initController() and autoMount() (if there are
* any disk image "path" properties to process) will take care of the rest.
*/
} catch (e) {
Component.error("HDC drive configuration error: " + e.message + " (" + parmsHDC['drives'] + ")");
}
}
/*
* We used to eval() sDriveConfigs immediately, but now we wait until initBus()
* is called, so that we can check for any machine overrides.
*/
this.sDriveConfigs = parmsHDC['drives'];
/*
* Set fATC (AT Controller flag) according to the 'type' parameter. This in turn determines other
@ -112,7 +102,7 @@ function HDC(parmsHDC) {
this.fATC = (parmsHDC['type'] == "at");
/*
* The remainder of HDC initialization now takes place in our initBus() handler
* The remainder of HDC initialization now takes place in our initBus() handler.
*/
}
@ -586,6 +576,26 @@ HDC.prototype.initBus = function(cmp, bus, cpu, dbg)
this.dbg = dbg;
this.cmp = cmp;
var aDriveConfigs = cmp.getMachineParm('drives');
if (aDriveConfigs) {
this.aDriveConfigs = aDriveConfigs;
}
else if (this.sDriveConfigs) {
try {
/*
* The most likely source of any exception will be right here, where we're parsing
* the JSON-encoded drive data.
*/
this.aDriveConfigs = eval("(" + this.sDriveConfigs + ")");
/*
* Nothing more to do with aDriveConfigs now. initController() and autoMount() (if there are
* any disk image "path" properties to process) will take care of the rest.
*/
} catch (e) {
Component.error("HDC drive configuration error: " + e.message + " (" + this.sDriveConfigs + ")");
}
}
/*
* We need access to the ChipSet component, because we need to communicate with
* the PIC and DMA controller.