diff --git a/include/dos_inc.h b/include/dos_inc.h index 40ecb195..753af672 100644 --- a/include/dos_inc.h +++ b/include/dos_inc.h @@ -386,6 +386,7 @@ public: void SetDiskBufferHeadPt(Bit32u _dbheadpt); void SetStartOfUMBChain(Bit16u _umbstartseg); void SetUMBChainState(Bit8u _umbchaining); + void SetBlockDevices(Bit8u _count); Bit16u GetStartOfUMBChain(void); Bit8u GetUMBChainState(void); RealPt GetPointer(void); diff --git a/src/dos/dos.cpp b/src/dos/dos.cpp index 897b6880..d5cb2b8b 100644 --- a/src/dos/dos.cpp +++ b/src/dos/dos.cpp @@ -840,6 +840,9 @@ static Bitu DOS_21Handler(void) { reg_bx=dos.psp(); break; case 0x52: { /* Get list of lists */ + Bit8u count=2; // floppy drives always counted + while (countisRemovable()) count++; + dos_infoblock.SetBlockDevices(count); RealPt addr=dos_infoblock.GetPointer(); SegSet16(es,RealSeg(addr)); reg_bx=RealOff(addr); @@ -1171,22 +1174,28 @@ static Bitu DOS_27Handler(void) { } static Bitu DOS_25Handler(void) { - if (Drives[reg_al] == 0){ + if (reg_al >= DOS_DRIVES || !Drives[reg_al] || Drives[reg_al]->isRemovable()) { reg_ax = 0x8002; SETFLAGBIT(CF,true); } else { + if (reg_cx == 1 && reg_dx == 0) { + if (reg_al >= 2) { + PhysPt ptr = PhysMake(SegValue(ds),reg_bx); + // write some BPB data into buffer for MicroProse installers + mem_writew(ptr+0x1c,0x3f); // hidden sectors + } + } else { + LOG(LOG_DOSMISC,LOG_NORMAL)("int 25 called but not as disk detection drive %u",reg_al); + } SETFLAGBIT(CF,false); - if ((reg_cx != 1) ||(reg_dx != 1)) - LOG(LOG_DOSMISC,LOG_NORMAL)("int 25 called but not as diskdetection drive %X",reg_al); - - reg_ax = 0; + reg_ax = 0; } SETFLAGBIT(IF,true); return CBRET_NONE; } static Bitu DOS_26Handler(void) { LOG(LOG_DOSMISC,LOG_NORMAL)("int 26 called: hope for the best!"); - if (Drives[reg_al] == 0){ + if (reg_al >= DOS_DRIVES || !Drives[reg_al] || Drives[reg_al]->isRemovable()) { reg_ax = 0x8002; SETFLAGBIT(CF,true); } else { diff --git a/src/dos/dos_classes.cpp b/src/dos/dos_classes.cpp index 3df73f2e..d407b04d 100644 --- a/src/dos/dos_classes.cpp +++ b/src/dos/dos_classes.cpp @@ -157,6 +157,10 @@ void DOS_InfoBlock::SetUMBChainState(Bit8u _umbchaining) { sSave(sDIB,chainingUMB,_umbchaining); } +void DOS_InfoBlock::SetBlockDevices(Bit8u _count) { + sSave(sDIB,blockDevices,_count); +} + RealPt DOS_InfoBlock::GetPointer(void) { return RealMake(seg,offsetof(sDIB,firstDPB)); } diff --git a/src/ints/bios_disk.cpp b/src/ints/bios_disk.cpp index 863b88ad..c3683db4 100644 --- a/src/ints/bios_disk.cpp +++ b/src/ints/bios_disk.cpp @@ -366,8 +366,19 @@ static Bitu INT13_DiskHandler(void) { return CBRET_NONE; } if (!any_images) { - // Inherit the Earth cdrom (uses it as disk test) + if (drivenum >= DOS_DRIVES || !Drives[drivenum] || Drives[drivenum]->isRemovable()) { + reg_ah = 0x01; + CALLBACK_SCF(true); + return CBRET_NONE; + } + // Inherit the Earth cdrom and Amberstar use it as a disk test if (((reg_dl&0x80)==0x80) && (reg_dh==0) && ((reg_cl&0x3f)==1)) { + if (reg_ch==0) { + PhysPt ptr = PhysMake(SegValue(es),reg_bx); + // write some MBR data into buffer for Amberstar installer + mem_writeb(ptr+0x1be,0x80); // first partition is active + mem_writeb(ptr+0x1c2,0x06); // first partition is FAT16B + } reg_ah = 0; CALLBACK_SCF(false); return CBRET_NONE;