1
0
Fork 0

Support some installer disk detection methods: block device count, and specific MBR/boot sector contents. Fixes (original) SimCity, Amberstar, and later MicroProse installers.

Imported-from: https://svn.code.sf.net/p/dosbox/code-0/dosbox/trunk@4120
This commit is contained in:
ripsaw8080 2018-06-21 17:46:52 +00:00
parent 823242560c
commit 66b813ef9c
4 changed files with 32 additions and 7 deletions

View file

@ -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);

View file

@ -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 (count<DOS_DRIVES && Drives[count] && !Drives[count]->isRemovable()) 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 {

View file

@ -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));
}

View file

@ -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;