Skip to content

Commit

Permalink
Merge branch 'joncampbell123:master' into vs2022
Browse files Browse the repository at this point in the history
  • Loading branch information
aybe authored Jul 9, 2024
2 parents 9894670 + 71e2f4e commit b379957
Show file tree
Hide file tree
Showing 8 changed files with 461 additions and 104 deletions.
6 changes: 6 additions & 0 deletions CHANGELOG
Original file line number Diff line number Diff line change
@@ -1,4 +1,10 @@
NEXT
- Add "-o int13" option to IMGMOUNT to direct the FAT driver to do
all disk I/O through INT 13h instead of directly. This is intended
for certain demoscene productions that apparently like to make
files appear out of thin air by intercepting INT 13h floppy disk
I/O and then asking MS-DOS to run something from it. Hack for
"DS_BLISS" demo. (joncampbell123).
- add option "[dos] automount drive directories" for Windows builds,
this will mount existing drive directories from C to Y drive (aybe).
- fix off-center and off-screen window after entering the
Expand Down
32 changes: 31 additions & 1 deletion include/bios_disk.h
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,8 @@ class imageDisk {
ID_VHD,
ID_D88,
ID_NFD,
ID_EMPTY_DRIVE
ID_EMPTY_DRIVE,
ID_INT13
};

virtual uint8_t Read_Sector(uint32_t head,uint32_t cylinder,uint32_t sector,void * data,unsigned int req_sector_size=0);
Expand Down Expand Up @@ -85,6 +86,10 @@ class imageDisk {
bool hardDrive = false;
uint64_t diskSizeK = 0;
FILE* diskimg = NULL;
bool diskChangeFlag = false;

/* this is intended only for when the disk can change out from under us while mounted */
virtual bool detectDiskChange(void) { const bool r = diskChangeFlag; diskChangeFlag = false; return r; }

protected:
imageDisk(IMAGE_TYPE class_id);
Expand Down Expand Up @@ -569,4 +574,29 @@ extern unsigned char INT13_ElTorito_NoEmuDriveNumber;
extern signed char INT13_ElTorito_IDEInterface;
extern char INT13_ElTorito_NoEmuCDROMDrive;

class imageDiskINT13Drive : public imageDisk {
public:
uint8_t Read_Sector(uint32_t head,uint32_t cylinder,uint32_t sector,void * data,unsigned int req_sector_size=0) override;
uint8_t Write_Sector(uint32_t head,uint32_t cylinder,uint32_t sector,const void * data,unsigned int req_sector_size=0) override;
uint8_t Read_AbsoluteSector(uint32_t sectnum, void * data) override;
uint8_t Write_AbsoluteSector(uint32_t sectnum, const void * data) override;

void UpdateFloppyType(void) override;
void Set_Reserved_Cylinders(Bitu resCyl) override;
uint32_t Get_Reserved_Cylinders() override;
void Set_Geometry(uint32_t setHeads, uint32_t setCyl, uint32_t setSect, uint32_t setSectSize) override;
void Get_Geometry(uint32_t * getHeads, uint32_t *getCyl, uint32_t *getSect, uint32_t *getSectSize) override;
uint8_t GetBiosType(void) override;
uint32_t getSectSize(void) override;
bool detectDiskChange(void) override;

imageDiskINT13Drive(imageDisk *sdisk);
virtual ~imageDiskINT13Drive();

uint8_t bios_disk = 0;
bool enable_int13 = false;
imageDisk* subdisk = NULL;
bool busy = false;
};

#endif
5 changes: 5 additions & 0 deletions src/cpu/callback.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -691,6 +691,11 @@ Bitu CALLBACK_SetupExtra(Bitu callback, Bitu type, PhysPt physAddress, bool use_
phys_writeb(physAddress+0x01,(uint8_t)0xCF); //An IRET Instruction
phys_writew(physAddress+0x02,(uint16_t)0x0ECD); // int 0e
phys_writeb(physAddress+0x04,(uint8_t)0xCF); //An IRET Instruction
// for the image disk support to call
phys_writew(physAddress+0x05,(uint16_t)0x13CD); // int 13
phys_writeb(physAddress+0x07,0xFE);
phys_writeb(physAddress+0x08,0x38);
phys_writew(physAddress+0x09,(uint16_t)call_idle);
return (use_cb?9:5);
case CB_VESA_WAIT:
if (use_cb) E_Exit("VESA wait must not implement a callback handler!");
Expand Down
20 changes: 20 additions & 0 deletions src/dos/dos_programs.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6110,6 +6110,19 @@ class IMGMOUNT : public Program {
return false;
}

for (auto i=options.begin();i!=options.end();i++) {
if ((*i) == "int13") {
char buf[32];

if (drive >= 'C')
sprintf(buf,"=%u",drive+0x80-'C');
else
sprintf(buf,"=%u",drive-'A');

(*i) += buf;
}
}

bool imgsizedetect = isHardDrive && sizes[0] == 0;
int mediaid = -1;

Expand Down Expand Up @@ -6331,6 +6344,13 @@ class IMGMOUNT : public Program {
}
}
}

/* now that the image is attached to INT 13h the INT 13 image can use it now */
if (image->class_id == imageDisk::ID_INT13) {
imageDiskINT13Drive *x = (imageDiskINT13Drive*)image;
x->enable_int13 = true;
LOG_MSG("INT 13 image enabling calling");
}
}
return true;
}
Expand Down
Loading

0 comments on commit b379957

Please sign in to comment.