DOS FAT driver: When -o int 13 is in effect, automatically adjust disk geometry according to media byte so that DS_BLISS.EXE still works even if you initially image mounted a 1.44MB floppy image

This commit is contained in:
Jonathan Campbell 2024-07-18 07:42:05 -07:00
parent 13276da31b
commit 9fdafdbfe2
2 changed files with 17 additions and 1 deletions

View File

@ -1,4 +1,8 @@
NEXT
- DOS FAT driver: If INT 13h reports disk change, adapt floppy
disk geometry to new disk image according to media byte. This
allows DS_BLISS to present it's 720K fake floppy even if the
user initially mounted a 1.44MB floppy to drive A: (joncampbell123).
- INT 10 mode list: Add "pitch" parameter. If nonzero, the value
(in pixels) is how to program the pixels per scanline when
setting the mode.

View File

@ -3678,7 +3678,7 @@ void fatDrive::checkDiskChange(void) {
* existence by intercepting INT 13h for floppy I/O and then expecting MS-DOS to call INT 13h
* to read it. Furthermore, at some parts of the demo, the INT 13h hook changes the root
* directory and FAT table to make the next "disk" appear, even if the volume label does not. */
if (loadedDisk->detectDiskChange() && !BPB.is_fat32()) {
if (loadedDisk->detectDiskChange() && !BPB.is_fat32() && partSectOff == 0) {
LOG(LOG_MISC,LOG_DEBUG)("FAT: disk change");
FAT_BootSector bootbuffer = {};
@ -3712,6 +3712,18 @@ void fatDrive::checkDiskChange(void) {
return;
}
/* sometimes as part of INT 13h interception the new image will differ from the format we mounted against (DS_BLISS.EXE) */
/* TODO: Add any other format here */
if (BPB.v.BPB_Media == 0xF9) {
LOG(LOG_MISC,LOG_DEBUG)("NEW FAT: changing floppy geometry to 720k format according to media byte");
loadedDisk->Set_Geometry(2/*heads*/,80/*cylinders*/,9/*sectors*/,512/*sector size*/);
}
else if (BPB.v.BPB_Media == 0xF0) {
/* TODO: By the time DOS supported the 1.44MB format the BPB also provided the geometry too */
LOG(LOG_MISC,LOG_DEBUG)("NEW FAT: changing floppy geometry to 1.44M format according to media byte");
loadedDisk->Set_Geometry(2/*heads*/,80/*cylinders*/,18/*sectors*/,512/*sector size*/);
}
uint32_t RootDirSectors;
uint32_t DataSectors;