From 07c2d06ae59f19ecdba54b726d6ceb23e3a425a6 Mon Sep 17 00:00:00 2001 From: ripsaw8080 Date: Thu, 11 Oct 2018 15:05:28 +0000 Subject: [PATCH] Add Unit Number and Bytes Per Sector fields for DPB entries. Fixes Air Power installer and Windows 3 Virtual Memory dialog. Imported-from: https://svn.code.sf.net/p/dosbox/code-0/dosbox/trunk@4168 --- src/dos/dos.cpp | 2 +- src/dos/dos_files.cpp | 2 +- src/dos/dos_misc.cpp | 2 +- src/dos/dos_programs.cpp | 8 ++++---- src/dos/dos_tables.cpp | 8 +++++--- 5 files changed, 12 insertions(+), 10 deletions(-) diff --git a/src/dos/dos.cpp b/src/dos/dos.cpp index d5cb2b8b..5981df01 100644 --- a/src/dos/dos.cpp +++ b/src/dos/dos.cpp @@ -497,7 +497,7 @@ static Bitu DOS_21Handler(void) { if (drive < DOS_DRIVES && Drives[drive] && !Drives[drive]->isRemovable()) { reg_al = 0x00; SegSet16(ds,dos.tables.dpb); - reg_bx = drive*5;//Faking the first entry (drive number) and media id + reg_bx = drive*9; LOG(LOG_DOSMISC,LOG_ERROR)("Get drive parameter block."); } else { reg_al=0xff; diff --git a/src/dos/dos_files.cpp b/src/dos/dos_files.cpp index 49d7eeea..0be27974 100644 --- a/src/dos/dos_files.cpp +++ b/src/dos/dos_files.cpp @@ -1288,7 +1288,7 @@ bool DOS_GetAllocationInfo(Bit8u drive,Bit16u * _bytes_sector,Bit8u * _sectors_c Bit16u _free_clusters; Drives[drive]->AllocationInfo(_bytes_sector,_sectors_cluster,_total_clusters,&_free_clusters); SegSet16(ds,RealSeg(dos.tables.mediaid)); - reg_bx=RealOff(dos.tables.mediaid+drive*5); + reg_bx=RealOff(dos.tables.mediaid+drive*9); return true; } diff --git a/src/dos/dos_misc.cpp b/src/dos/dos_misc.cpp index ed180b3a..163883c4 100644 --- a/src/dos/dos_misc.cpp +++ b/src/dos/dos_misc.cpp @@ -90,7 +90,7 @@ static bool DOS_MultiplexFunctions(void) { mem_writew(sftptr+sftofs+0x02,(Bit16u)(Files[reg_bx]->flags&3)); // file open mode mem_writeb(sftptr+sftofs+0x04,(Bit8u)(Files[reg_bx]->attr)); // file attribute mem_writew(sftptr+sftofs+0x05,0x40|drive); // device info word - mem_writed(sftptr+sftofs+0x07,RealMake(dos.tables.dpb,drive*5)); // dpb of the drive + mem_writed(sftptr+sftofs+0x07,RealMake(dos.tables.dpb,drive*9)); // dpb of the drive mem_writew(sftptr+sftofs+0x0d,Files[reg_bx]->time); // packed file time mem_writew(sftptr+sftofs+0x0f,Files[reg_bx]->date); // packed file date Bit32u curpos=0; diff --git a/src/dos/dos_programs.cpp b/src/dos/dos_programs.cpp index f2231815..cdea5d7b 100644 --- a/src/dos/dos_programs.cpp +++ b/src/dos/dos_programs.cpp @@ -126,7 +126,7 @@ public: switch (DriveManager::UnmountDrive(i_drive)) { case 0: Drives[i_drive] = 0; - mem_writeb(Real2Phys(dos.tables.mediaid)+i_drive*5,0); + mem_writeb(Real2Phys(dos.tables.mediaid)+i_drive*9,0); if(i_drive == DOS_GetDefaultDrive()) DOS_SetDrive(ZDRIVE_NUM); WriteOut(MSG_Get("PROGRAM_MOUNT_UMOUNT_SUCCESS"),umount[0]); @@ -395,7 +395,7 @@ public: if (!newdrive) E_Exit("DOS:Can't create drive"); Drives[drive-'A']=newdrive; /* Set the correct media byte in the table */ - mem_writeb(Real2Phys(dos.tables.mediaid)+(drive-'A')*5,newdrive->GetMediaByte()); + mem_writeb(Real2Phys(dos.tables.mediaid)+(drive-'A')*9,newdrive->GetMediaByte()); WriteOut(MSG_Get("PROGRAM_MOUNT_STATUS_2"),drive,newdrive->GetInfo()); /* check if volume label is given and don't allow it to updated in the future */ if (cmd->FindString("-label",label,true)) newdrive->dirCache.SetLabel(label.c_str(),iscdrom,false); @@ -1313,7 +1313,7 @@ public: DriveManager::InitializeDrive(drive - 'A'); // Set the correct media byte in the table - mem_writeb(Real2Phys(dos.tables.mediaid) + (drive - 'A') * 5, mediaid); + mem_writeb(Real2Phys(dos.tables.mediaid) + (drive - 'A') * 9, mediaid); /* Command uses dta so set it to our internal dta */ RealPt save_dta = dos.dta(); @@ -1393,7 +1393,7 @@ public: DriveManager::InitializeDrive(drive - 'A'); // Set the correct media byte in the table - mem_writeb(Real2Phys(dos.tables.mediaid) + (drive - 'A') * 5, mediaid); + mem_writeb(Real2Phys(dos.tables.mediaid) + (drive - 'A') * 9, mediaid); // Print status message (success) WriteOut(MSG_Get("MSCDEX_SUCCESS")); diff --git a/src/dos/dos_tables.cpp b/src/dos/dos_tables.cpp index 5579da44..b7687d6d 100644 --- a/src/dos/dos_tables.cpp +++ b/src/dos/dos_tables.cpp @@ -148,11 +148,13 @@ void DOS_SetupTables(void) { dos_infoblock.SetFCBTable(RealMake(seg,0)); /* Create a fake DPB */ - dos.tables.dpb=DOS_GetMemory(10); + dos.tables.dpb=DOS_GetMemory(16); dos.tables.mediaid=RealMake(dos.tables.dpb,0x17); //Media ID offset in DPB for (i=0;i