Skip to content

Commit

Permalink
DOS FAT driver: When -o int 13 is in effect, automatically adjust dis…
Browse files Browse the repository at this point in the history
…k geometry according to media byte so that DS_BLISS.EXE still works even if you initially image mounted a 1.44MB floppy image
  • Loading branch information
joncampbell123 committed Jul 18, 2024
1 parent 13276da commit 9fdafdb
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 1 deletion.
4 changes: 4 additions & 0 deletions CHANGELOG
Original file line number Diff line number Diff line change
@@ -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.
Expand Down
14 changes: 13 additions & 1 deletion src/dos/drive_fat.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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 = {};
Expand Down Expand Up @@ -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;

Expand Down

0 comments on commit 9fdafdb

Please sign in to comment.