Added --xdf option to DiskDump to enable (experimental) XDF support
Without --xdf, DiskDump simply dumps an XDF disk image as a vanilla 80-track, 23-sectors-per-track disk image. In addition, I regenerated all the PC-DOS 7.00 disk images without --xdf, to see if that works any better (it seems to work for VirtualBox)
This commit is contained in:
parent
c5bcf12a7d
commit
715e603ea2
6 changed files with 27 additions and 20 deletions
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
|
|
@ -12,16 +12,16 @@
|
|||
<disk id="disk01" size="1474560" chs="80:2:18" img="private/PCDOS700-DISK1.img" href="/disks/pc/dos/ibm/7.00/PCDOS700-DISK1.json" md5="2a3736d2acbb7730965b7cb6d3f16d00" md5json="97fc896b5679dabbadfa13ed6a1dc681">
|
||||
<name>PC-DOS 7.00 (SETUP Disk 1)</name>
|
||||
</disk>
|
||||
<disk id="disk02" size="1884160" chs="80:2:23" img="private/PCDOS700-DISK2.xdf" href="/disks/pc/dos/ibm/7.00/PCDOS700-DISK2.json" md5="b21b98aca8fafbdd1a7b9db77e7dc60d" md5json="95b075274808e24f6e67fc05d999ff01">
|
||||
<disk id="disk02" size="1884160" chs="80:2:23" img="private/PCDOS700-DISK2.xdf" href="/disks/pc/dos/ibm/7.00/PCDOS700-DISK2.json" md5="b21b98aca8fafbdd1a7b9db77e7dc60d" md5json="92b3d5032235a3a7271aa80d58cf073c">
|
||||
<name>PC-DOS 7.00 (SETUP Disk 2)</name>
|
||||
</disk>
|
||||
<disk id="disk03" size="1884160" chs="80:2:23" img="private/PCDOS700-DISK3.xdf" href="/disks/pc/dos/ibm/7.00/PCDOS700-DISK3.json" md5="e45111515901b951dc5ff33434b47a0a" md5json="7bae36688f85046d2564b0240b931117">
|
||||
<disk id="disk03" size="1884160" chs="80:2:23" img="private/PCDOS700-DISK3.xdf" href="/disks/pc/dos/ibm/7.00/PCDOS700-DISK3.json" md5="e45111515901b951dc5ff33434b47a0a" md5json="c0736bcae64adc9d901be1abe3f45b20">
|
||||
<name>PC-DOS 7.00 (SETUP Disk 3)</name>
|
||||
</disk>
|
||||
<disk id="disk04" size="1884160" chs="80:2:23" img="private/PCDOS700-DISK4.xdf" href="/disks/pc/dos/ibm/7.00/PCDOS700-DISK4.json" md5="1ea1b92938a40cbb5089c30c86165c7a" md5json="ecf1eb5628c30f0c766c44395ce38c0d">
|
||||
<disk id="disk04" size="1884160" chs="80:2:23" img="private/PCDOS700-DISK4.xdf" href="/disks/pc/dos/ibm/7.00/PCDOS700-DISK4.json" md5="1ea1b92938a40cbb5089c30c86165c7a" md5json="4daa0fa7ddea76cd25f781de790f6e92">
|
||||
<name>PC-DOS 7.00 (SETUP Disk 4)</name>
|
||||
</disk>
|
||||
<disk id="disk05" size="1884160" chs="80:2:23" img="private/PCDOS700-DISK5.xdf" href="/disks/pc/dos/ibm/7.00/PCDOS700-DISK5.json" md5="e613544f161d0857fc3adf6a13eb9371" md5json="aaf6eca0bf684565e935f3121e8ff705">
|
||||
<disk id="disk05" size="1884160" chs="80:2:23" img="private/PCDOS700-DISK5.xdf" href="/disks/pc/dos/ibm/7.00/PCDOS700-DISK5.json" md5="e613544f161d0857fc3adf6a13eb9371" md5json="db19c311f807b70f43efcc9d59a313dd">
|
||||
<name>PC-DOS 7.00 (SETUP Disk 5)</name>
|
||||
</disk>
|
||||
</manifest>
|
||||
|
|
|
|||
|
|
@ -79,14 +79,15 @@ var fNormalize = true;
|
|||
*
|
||||
* @constructor
|
||||
* @param {string|Array} sDiskPath
|
||||
* @param {Array|null|undefined} asExclude contains filename exclusions, if any
|
||||
* @param {string|undefined} sFormat is the output format, one of "json"|"data"|"hex"|"bytes"|"img"
|
||||
* @param {boolean|string|undefined} fComments enables comments and other readability enhancements in the JSON output
|
||||
* @param {string|undefined} mbHD specifies a hard disk size, in megabytes, when building a new image
|
||||
* @param {Array|null} [asExclude] contains filename exclusions, if any
|
||||
* @param {string} [sFormat] is the output format, one of "json"|"data"|"hex"|"bytes"|"img"
|
||||
* @param {boolean|string} [fComments] enables comments and other readability enhancements in the JSON output
|
||||
* @param {string} [mbHD] specifies a hard disk size, in megabytes, when building a new image
|
||||
* @param {string|null} [sServerRoot]
|
||||
* @param {string} [sManifestFile]
|
||||
* @param {Object} [argv] optional (experimental) arguments, if any
|
||||
*/
|
||||
function DiskDump(sDiskPath, asExclude, sFormat, fComments, mbHD, sServerRoot, sManifestFile)
|
||||
function DiskDump(sDiskPath, asExclude, sFormat, fComments, mbHD, sServerRoot, sManifestFile, argv)
|
||||
{
|
||||
/*
|
||||
* I used to set this.sServerRoot to "sServerRoot || process.cwd()", but in reality, the
|
||||
|
|
@ -103,6 +104,7 @@ function DiskDump(sDiskPath, asExclude, sFormat, fComments, mbHD, sServerRoot, s
|
|||
this.nJSONIndent = 0;
|
||||
this.fJSONComments = fComments;
|
||||
this.sJSONWhitespace = (this.fJSONComments? " " : "");
|
||||
this.fXDFSupport = (argv && argv['xdf']);
|
||||
|
||||
/*
|
||||
* The dump operation itself doesn't care about sManifestFile, but we DO need some indication
|
||||
|
|
@ -296,6 +298,8 @@ DiskDump.aDefaultBPBs = [
|
|||
* --mbhd={number}: requests a hard disk image with the given number of megabytes (eg, 10 for a 10mb image)
|
||||
* --exclude={filename}: specifies a filename that should be excluded from the image; repeat as often as needed
|
||||
* --overwrite: allows the --output option to overwrite an existing file; default is to NOT overwrite
|
||||
* --manifest[={filename}]: update the specified manifest.xml file with details about the disk image
|
||||
* --xdf: enable support for XDF-formatted disk images (experimental)
|
||||
*
|
||||
* Examples
|
||||
* ---
|
||||
|
|
@ -371,7 +375,7 @@ DiskDump.CLI = function()
|
|||
var sManifestTitle = argv['title'];
|
||||
|
||||
if (sDiskPath) {
|
||||
var disk = new DiskDump(sDiskPath, asExclude, argv['format'], argv['comments'], argv['mbhd'], sServerRoot, sManifestFile);
|
||||
var disk = new DiskDump(sDiskPath, asExclude, argv['format'], argv['comments'], argv['mbhd'], sServerRoot, sManifestFile, argv);
|
||||
if (sDir) {
|
||||
disk.buildImage(true, function(err) {
|
||||
DiskDump.outputDisk(err, disk, sDiskPath, sOutputFile, fOverwrite, sManifestTitle);
|
||||
|
|
@ -2105,7 +2109,7 @@ DiskDump.prototype.convertToJSON = function()
|
|||
* but at some point, we'll need to perform more general calculations to properly deal with ANY disk
|
||||
* image whose logical format doesn't agree with its physical structure.
|
||||
*/
|
||||
var fXDF = false;
|
||||
var fXDFOutput = false;
|
||||
var oDisketteFormat = DiskDump.DisketteFormats[cbDiskData];
|
||||
if (oDisketteFormat) {
|
||||
nHeads = oDisketteFormat[0];
|
||||
|
|
@ -2144,18 +2148,21 @@ DiskDump.prototype.convertToJSON = function()
|
|||
* currently (try to) support.
|
||||
*
|
||||
* Moreover, the first two tracks (ie, the first cylinder) contain only 19 sectors each,
|
||||
* rather than 23, but the XDF format still pads those tracks with 4 unused sectors.
|
||||
* rather than 23, but XDF disk images still pads those tracks with 4 unused sectors.
|
||||
*
|
||||
* So, data for the first track contains 1 boot sector ending at 512 (0x200), 11 FAT sectors
|
||||
* ending at 6144 (0x1800), and 7 "micro-disk" sectors ending at 9728 (0x2600). Then there's
|
||||
* 4 sectors (presumably of "garbage") that end at 11776 (0x2E00).
|
||||
* 4 (useless?) sectors that end at 11776 (0x2E00).
|
||||
*
|
||||
* Data for the second track contains 7 root directory sectors ending at 15360 (0x3C00), followed
|
||||
* by disk data.
|
||||
*
|
||||
* For more details, check out this helpful article: http://www.os2museum.com/wp/the-xdf-diskette-format/
|
||||
*/
|
||||
if (nSectorsTotalBPB == 3680) fXDF = true;
|
||||
if (nSectorsTotalBPB == 3680 && this.fXDFSupport) {
|
||||
DiskDump.logWarning("XDF diskette detected, experimental XDF output enabled");
|
||||
fXDFOutput = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -2294,14 +2301,14 @@ DiskDump.prototype.convertToJSON = function()
|
|||
* 4 1 5 12
|
||||
* 3 1 14 18
|
||||
*/
|
||||
if (fXDF) nSectorsThisTrack = (iCylinder? 4 : 19);
|
||||
if (fXDFOutput) nSectorsThisTrack = (iCylinder? 4 : 19);
|
||||
|
||||
for (var iSector=1, offSector=0; iSector <= nSectorsThisTrack && offSector < cbTrack; iSector++, offSector += cbSectorThisTrack) {
|
||||
|
||||
var sector = {};
|
||||
var nSector = iSector;
|
||||
|
||||
if (fXDF && iCylinder) {
|
||||
if (fXDFOutput && iCylinder) {
|
||||
if (!iHead) {
|
||||
cbSectorThisTrack = (iSector == 1? 1024 : (iSector == 2? 512 : (iSector == 3? 2048 : 8192)));
|
||||
} else {
|
||||
|
|
|
|||
Loading…
Reference in a new issue