Changed the default DiskDump label, and cleaned up some jshint warnings

This commit is contained in:
Jeff Parsons 2015-04-22 12:21:06 -07:00 • committed by jeffpar
commit 061cb7ea08
4 changed files with 25 additions and 15 deletions

View file

@ -179,7 +179,7 @@ DiskDump.sNotice = DiskDump.sAPIURL + " " + DiskDump.sCopyright;
DiskDump.sUsage = "Usage: " + DiskDump.sAPIURL + "?" + DumpAPI.QUERY.PATH + "={url}&" + DumpAPI.QUERY.FORMAT + "=json|data|hex|bytes|img"; DiskDump.sUsage = "Usage: " + DiskDump.sAPIURL + "?" + DumpAPI.QUERY.PATH + "={url}&" + DumpAPI.QUERY.FORMAT + "=json|data|hex|bytes|img";
/* /*
* MY_VOL_LABEL is our default label, used whenever a more suitable label (eg, based on the disk image's folder name) * MY_VOL_LABEL is our default label, used whenever a more suitable label (eg, the disk image's folder name)
* is not available or not supplied, and MY_OEM_STRING is inserted into any DiskDump-generated diskette images. * is not available or not supplied, and MY_OEM_STRING is inserted into any DiskDump-generated diskette images.
*/ */
DiskDump.MY_VOL_LABEL = "PCJSDISK"; DiskDump.MY_VOL_LABEL = "PCJSDISK";
@ -192,7 +192,8 @@ DiskDump.MY_OEM_STRING = "PCJS.ORG";
DiskDump.aDefaultBPBs = [ DiskDump.aDefaultBPBs = [
[ // define BPB for 160Kb diskette [ // define BPB for 160Kb diskette
0xEB, 0xFE, 0x90, // 0x00: JMP instruction, following by 8-byte OEM signature 0xEB, 0xFE, 0x90, // 0x00: JMP instruction, following by 8-byte OEM signature
0x49, 0x42, 0x4D, 0x20, 0x20, 0x31, 0x2E, 0x30, // "IBM 1.0" (this is a fake OEM signature) 0x50, 0x43, 0x4A, 0x53, 0x2E, 0x4F, 0x52, 0x47, // MY_OEM_STRING
// 0x49, 0x42, 0x4D, 0x20, 0x20, 0x31, 0x2E, 0x30, // "IBM 1.0" (this is a fake OEM signature)
0x00, 0x02, // 0x0B: bytes per sector (0x200 or 512) 0x00, 0x02, // 0x0B: bytes per sector (0x200 or 512)
0x01, // 0x0D: sectors per cluster (1) 0x01, // 0x0D: sectors per cluster (1)
0x01, 0x00, // 0x0E: reserved sectors; ie, # sectors preceding the first FAT--usually just the boot sector (1) 0x01, 0x00, // 0x0E: reserved sectors; ie, # sectors preceding the first FAT--usually just the boot sector (1)
@ -207,7 +208,8 @@ DiskDump.aDefaultBPBs = [
], ],
[ // define BPB for 360Kb diskette [ // define BPB for 360Kb diskette
0xEB, 0xFE, 0x90, // 0x00: JMP instruction, following by 8-byte OEM signature 0xEB, 0xFE, 0x90, // 0x00: JMP instruction, following by 8-byte OEM signature
0x49, 0x42, 0x4D, 0x20, 0x20, 0x32, 0x2E, 0x30, // "IBM 2.0" (this is a real OEM signature) 0x50, 0x43, 0x4A, 0x53, 0x2E, 0x4F, 0x52, 0x47, // MY_OEM_STRING
// 0x49, 0x42, 0x4D, 0x20, 0x20, 0x32, 0x2E, 0x30, // "IBM 2.0" (this is a real OEM signature)
0x00, 0x02, // 0x0B: bytes per sector (0x200 or 512) 0x00, 0x02, // 0x0B: bytes per sector (0x200 or 512)
0x02, // 0x0D: sectors per cluster (2) 0x02, // 0x0D: sectors per cluster (2)
0x01, 0x00, // 0x0E: reserved sectors; ie, # sectors preceding the first FAT--usually just the boot sector (1) 0x01, 0x00, // 0x0E: reserved sectors; ie, # sectors preceding the first FAT--usually just the boot sector (1)
@ -222,7 +224,8 @@ DiskDump.aDefaultBPBs = [
], ],
[ // define BPB for 1.2Mb diskette [ // define BPB for 1.2Mb diskette
0xEB, 0xFE, 0x90, // 0x00: JMP instruction, following by 8-byte OEM signature 0xEB, 0xFE, 0x90, // 0x00: JMP instruction, following by 8-byte OEM signature
0x49, 0x42, 0x4D, 0x20, 0x31, 0x30, 0x2E, 0x31, // "IBM 10.0" (which I believe was used on IBM OS/2 1.0 diskettes) 0x50, 0x43, 0x4A, 0x53, 0x2E, 0x4F, 0x52, 0x47, // MY_OEM_STRING
// 0x49, 0x42, 0x4D, 0x20, 0x31, 0x30, 0x2E, 0x31, // "10.0" (which I believe was used on IBM OS/2 1.0 diskettes)
0x00, 0x02, // 0x0B: bytes per sector (0x200 or 512) 0x00, 0x02, // 0x0B: bytes per sector (0x200 or 512)
0x01, // 0x0D: sectors per cluster (1) 0x01, // 0x0D: sectors per cluster (1)
0x01, 0x00, // 0x0E: reserved sectors; ie, # sectors preceding the first FAT--usually just the boot sector (1) 0x01, 0x00, // 0x0E: reserved sectors; ie, # sectors preceding the first FAT--usually just the boot sector (1)
@ -237,7 +240,8 @@ DiskDump.aDefaultBPBs = [
], ],
[ // define BPB for 1.44Mb diskette [ // define BPB for 1.44Mb diskette
0xEB, 0xFE, 0x90, // 0x00: JMP instruction, following by 8-byte OEM signature 0xEB, 0xFE, 0x90, // 0x00: JMP instruction, following by 8-byte OEM signature
0x4d, 0x53, 0x44, 0x4F, 0x53, 0x35, 0x2E, 0x30, // "MSDOS5.0" (an actual OEM signature, arbitrarily chosen for use here) 0x50, 0x43, 0x4A, 0x53, 0x2E, 0x4F, 0x52, 0x47, // MY_OEM_STRING
// 0x4d, 0x53, 0x44, 0x4F, 0x53, 0x35, 0x2E, 0x30, // "MSDOS5.0" (an actual OEM signature, arbitrarily chosen for use here)
0x00, 0x02, // 0x0B: bytes per sector (0x200 or 512) 0x00, 0x02, // 0x0B: bytes per sector (0x200 or 512)
0x01, // 0x0D: sectors per cluster (1) 0x01, // 0x0D: sectors per cluster (1)
0x01, 0x00, // 0x0E: reserved sectors; ie, # sectors preceding the first FAT--usually just the boot sector (1) 0x01, 0x00, // 0x0E: reserved sectors; ie, # sectors preceding the first FAT--usually just the boot sector (1)
@ -252,7 +256,8 @@ DiskDump.aDefaultBPBs = [
], ],
[ // define BPB for 10Mb hard disk [ // define BPB for 10Mb hard disk
0xEB, 0xFE, 0x90, // 0x00: JMP instruction, following by 8-byte OEM signature 0xEB, 0xFE, 0x90, // 0x00: JMP instruction, following by 8-byte OEM signature
0x49, 0x42, 0x4D, 0x20, 0x20, 0x32, 0x2E, 0x30, // "IBM 2.0" (this is a real OEM signature) 0x50, 0x43, 0x4A, 0x53, 0x2E, 0x4F, 0x52, 0x47, // MY_OEM_STRING
// 0x49, 0x42, 0x4D, 0x20, 0x20, 0x32, 0x2E, 0x30, // "IBM 2.0" (this is a real OEM signature)
0x00, 0x02, // 0x0B: bytes per sector (0x200 or 512) 0x00, 0x02, // 0x0B: bytes per sector (0x200 or 512)
0x08, // 0x0D: sectors per cluster (8) 0x08, // 0x0D: sectors per cluster (8)
0x01, 0x00, // 0x0E: reserved sectors; ie, # sectors preceding the first FAT--usually just the boot sector (1) 0x01, 0x00, // 0x0E: reserved sectors; ie, # sectors preceding the first FAT--usually just the boot sector (1)

View file

@ -206,21 +206,22 @@ X86.fnBOUND = function BOUND(dst, src)
*/ */
X86.fnBSF = function BSF(dst, src) X86.fnBSF = function BSF(dst, src)
{ {
var n = 0;
if (!src) { if (!src) {
this.setZF(); this.setZF();
} else { } else {
this.clearZF(); this.clearZF();
var i = 0, bit = 0x1; var bit = 0x1;
while (bit & this.dataMask) { while (bit & this.dataMask) {
if (src & bit) { if (src & bit) {
dst = i; dst = n;
break; break;
} }
bit <<= 1; bit <<= 1;
i++; n++; // TODO: Determine if n should be incremented before the bailout for an accurate cycle count
} }
} }
this.nStepCycles -= this.cycleCounts.nOpCyclesBitScan + i * 3; this.nStepCycles -= this.cycleCounts.nOpCyclesBitScan + n * 3;
return dst; return dst;
}; };
@ -241,21 +242,23 @@ X86.fnBSF = function BSF(dst, src)
*/ */
X86.fnBSR = function BSR(dst, src) X86.fnBSR = function BSR(dst, src)
{ {
var n = 0;
if (!src) { if (!src) {
this.setZF(); this.setZF();
} else { } else {
this.clearZF(); this.clearZF();
var i = (this.dataSize == 2? 15 : 31), j = i, bit = 1 << i; var i = (this.dataSize == 2? 15 : 31), bit = 1 << i;
while (bit) { while (bit) {
if (src & bit) { if (src & bit) {
dst = i; dst = i;
break; break;
} }
bit >>>= 1; bit >>>= 1;
i--; n++; i--; // TODO: Determine if n should be incremented before the bailout for an accurate cycle count
} }
} }
this.nStepCycles -= this.cycleCounts.nOpCyclesBitScan + (j - i) * 3; this.nStepCycles -= this.cycleCounts.nOpCyclesBitScan + n * 3;
return dst; return dst;
}; };

View file

@ -309,8 +309,6 @@ X86.opMOVcr = function MOVcr()
this.regCR3 = this.regEBX; this.regCR3 = this.regEBX;
this.regEBX = temp; this.regEBX = temp;
break; break;
default:
break; // there IS no other case, but JavaScript inspections don't know that
} }
}; };

View file

@ -152,6 +152,10 @@ X86Seg.prototype.loadProt = function loadProt(sel, fSuppress)
var addrDTLimit; var addrDTLimit;
var cpu = this.cpu; var cpu = this.cpu;
/*
* Some instructions (eg, CALLF) load a 32-bit value for the selector, while others (eg, LDS) do not;
* however, in ALL cases, only the low 16 bits are significant.
*/
sel &= 0xffff; sel &= 0xffff;
if (!(sel & X86.SEL.LDT)) { if (!(sel & X86.SEL.LDT)) {