merge changes

This commit is contained in:
Wengier 2020-06-16 09:35:20 -04:00 committed by GitHub
parent b8578218b0
commit f5707a2987
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -4519,17 +4519,25 @@ private:
bool DetectMFMsectorPartition(Bit8u buf[], Bit32u fcsize, Bitu sizes[]) {
// This is used for plain MFM sector format as created by IMGMAKE
Bit8u starthead = 0;
Bit8u startsect = 0;
Bit16u startcyl = 0;
Bit16u endcyl = 0;
Bit8u ptype = 0; // Partition Type
Bit8u heads = 0;
Bit8u sectors = 0;
Bitu pe1_size = host_readd(&buf[0x1ca]);
(void)ptype;//unused
if ((Bit16u)host_readd(&buf[0x1fa]) != 0) { // DOS 2.0-3.21 partition table
pe1_size = host_readd(&buf[0x1fa]);
// It tries to find the first partition. Addressing is in CHS format.
/* Offset | Length | Description
* +0 | 1 byte | 80 hex = active, 00 = inactive
* +1 | 3 bytes | CHS of first sector in partition
* +4 | 1 byte | partition type
* +5 | 3 bytes | CHS of last sector in partition
* +8 | 4 bytes | LBA of first sector in partition
* +C | 4 bytes | Number of sectors in partition. 0 may mean, use LBA
*/
Bit8u starthead = 0; // start head of partition
Bit8u startsect = 0; // start sector of partition
Bit16u startcyl = 0; // start cylinder of partition
Bit8u ptype = 0; // Partition Type
Bit16u endcyl = 0; // end cylinder of partition
Bit8u heads = 0; // heads in partition
Bit8u sectors = 0; // sectors per track in partition
Bit32u pe1_size = host_readd(&buf[0x1ca]);
if ((Bit32u)host_readd(&buf[0x1fa]) != 0) { // DOS 2.0-3.21 partition table
pe1_size = host_readd(&buf[0x1fa]);
starthead = buf[0x1ef];
startsect = (buf[0x1f0] & 0x3fu) - 1u;
startcyl = (unsigned char)buf[0x1f1] | (unsigned int)((buf[0x1f0] & 0xc0) << 2u);
@ -4537,14 +4545,14 @@ private:
ptype = buf[0x1f2];
heads = buf[0x1f3] + 1u;
sectors = buf[0x1f4] & 0x3fu;
} else if (pe1_size != 0) { // DOS 3.3+ partition table
starthead = buf[0x1bf];
startsect = (buf[0x1c0] & 0x3fu) - 1u;
startcyl = (unsigned char)buf[0x1c1] | (unsigned int)((buf[0x1c0] & 0xc0) << 2u);
endcyl = (unsigned char)buf[0x1c5] | (unsigned int)((buf[0x1c4] & 0xc0) << 2u);
ptype = buf[0x1c2];
heads = buf[0x1c3] + 1u;
sectors = buf[0x1c4] & 0x3fu;
} else if (pe1_size != 0) { // DOS 3.3+ partition table, starting at 0x1BE
starthead = buf[0x1bf];
startsect = (buf[0x1c0] & 0x3fu) - 1u;
startcyl = (unsigned char)buf[0x1c1] | (unsigned int)((buf[0x1c0] & 0xc0) << 2u);
endcyl = (unsigned char)buf[0x1c5] | (unsigned int)((buf[0x1c4] & 0xc0) << 2u);
ptype = buf[0x1c2];
heads = buf[0x1c3] + 1u;
sectors = buf[0x1c4] & 0x3fu;
}
if (pe1_size != 0) {
Bit32u part_start = startsect + sectors * starthead +