diff --git a/include/dos_inc.h b/include/dos_inc.h index f4a7f685..d566e819 100644 --- a/include/dos_inc.h +++ b/include/dos_inc.h @@ -16,7 +16,7 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ -/* $Id: dos_inc.h,v 1.46 2004-06-24 21:21:48 harekiet Exp $ */ +/* $Id: dos_inc.h,v 1.47 2004-07-08 20:08:52 qbix79 Exp $ */ #ifndef DOS_H_ #define DOS_H_ @@ -340,6 +340,10 @@ public: void SetFirstMCB(Bit16u _first_mcb); void SetfirstFileTable(RealPt _first_table); void SetBuffers(Bit16u x,Bit16u y); + void SetCurDirStruct(Bit32u _curdirstruct); + void SetFCBTable(Bit32u _fcbtable); + void SetDeviceChainStart(Bit32u _devchain); + void SetDiskInfoBuffer(Bit32u _dinfobuf); RealPt GetPointer (void); #ifdef _MSC_VER @@ -349,7 +353,7 @@ public: Bit16u regCXfrom5e; // -0x18 CX from last int21/ah=5e Bit16u countLRUcache; // -0x16 LRU counter for FCB caching Bit16u countLRUopens; // -0x14 LRU counter for FCB openings - Bit8u stuff1[6]; // -0x12 some stuff, hopefully never used.... + Bit8u stuff[6]; // -0x12 some stuff, hopefully never used.... Bit16u sharingCount; // -0x0c sharing retry count Bit16u sharingDelay; // -0x0a sharing retry delay RealPt diskBufPtr; // -0x08 pointer to disk buffer @@ -360,13 +364,16 @@ public: RealPt activeClock; // 0x08 active clock device header RealPt activeCon; // 0x0c active console device header Bit16u maxSectorLength; // 0x10 maximum bytes per sector of any block device; - RealPt discInfoBuffer; // 0x12 pointer to disc info buffer + RealPt diskInfoBuffer; // 0x12 pointer to disk info buffer RealPt curDirStructure; // 0x16 pointer to current array of directory structure RealPt fcbTable; // 0x1a pointer to system FCB table Bit16u protFCBs; // 0x1e protected fcbs Bit8u blockDevices; // 0x20 installed block devices Bit8u lastdrive; // 0x21 lastdrive - Bit8u stuff2[0x12]; // 0x22 NUL driver + Bit32u nulNextDriver; // 0x22 NUL driver next pointer + Bit16u nulAttributes; // 0x26 NUL driver aattributes + Bit32u nulStrategy; // 0x28 NUL driver strategy routine + Bit8u nulString[8]; // 0x2c NUL driver name string Bit8u joindedDrives; // 0x34 joined drives Bit16u specialCodeSeg; // 0x35 special code segment RealPt setverPtr; // 0x37 pointer to setver diff --git a/src/dos/dos_classes.cpp b/src/dos/dos_classes.cpp index a2bb9481..d81a55a8 100644 --- a/src/dos/dos_classes.cpp +++ b/src/dos/dos_classes.cpp @@ -16,7 +16,7 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ -/* $Id: dos_classes.cpp,v 1.38 2004-05-15 07:57:04 harekiet Exp $ */ +/* $Id: dos_classes.cpp,v 1.39 2004-07-08 20:08:52 qbix79 Exp $ */ #include #include @@ -65,8 +65,6 @@ void DOS_InfoBlock::SetLocation(Bit16u segment) /* Clear the initual Block */ for(Bitu i=0;i #include @@ -282,7 +282,7 @@ bool DOS_Execute(char * name,PhysPt block_pt,Bit8u flags) { if (!DOS_AllocateMemory(&pspseg,&memsize)) E_Exit("DOS:Exec error in memory"); loadseg=pspseg+16; if ((!iscom) & (head.minmemory == 0) & (head.maxmemory == 0)) - loadseg = (0x9fed0 - imagesize)/16; //c2woody + loadseg = (0x9e000 - imagesize)/16; //c2woody } else loadseg=block.overlay.loadseg; /* Load the executable */ diff --git a/src/dos/dos_memory.cpp b/src/dos/dos_memory.cpp index 87461754..993af873 100644 --- a/src/dos/dos_memory.cpp +++ b/src/dos/dos_memory.cpp @@ -21,7 +21,7 @@ #include "dos_inc.h" -#define MEM_START 0x60 //First Segment that DOS can use +#define MEM_START 0x68 //First Segment that DOS can use //#define MEM_START 4000 //First Segment that DOS can use static Bit16u memAllocStrategy = 0x00; diff --git a/src/dos/dos_misc.cpp b/src/dos/dos_misc.cpp index eebf2348..428907bb 100644 --- a/src/dos/dos_misc.cpp +++ b/src/dos/dos_misc.cpp @@ -16,7 +16,7 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ -/* $Id: dos_misc.cpp,v 1.10 2004-03-14 19:41:04 qbix79 Exp $ */ +/* $Id: dos_misc.cpp,v 1.11 2004-07-08 20:08:52 qbix79 Exp $ */ #include "dosbox.h" #include "callback.h" @@ -58,6 +58,41 @@ static Bitu INT2A_Handler(void) { static bool DOS_MultiplexFunctions(void) { switch (reg_ax) { + case 0x1607: + if (reg_bx == 0x15) { + switch (reg_cx) { + case 0x0000: // query instance + reg_cx = 0x0001; + reg_dx = 0x50; // dos driver segment + SegSet16(es,0x50); // patch table seg + reg_bx = 0x60; // patch table ofs + return true; + case 0x0001: // set patches + reg_ax = 0xb97c; + reg_bx = (reg_dx & 0x16); + reg_dx = 0xa2ab; + return true; + case 0x0003: // get size of data struc + if (reg_dx==0x0001) { + // CDS size requested + reg_ax = 0xb97c; + reg_dx = 0xa2ab; + reg_cx = 0x000e; // size + } + return true; + case 0x0004: // instanced data + reg_dx = 0; // none + return true; + case 0x0005: // get device driver size + reg_ax = 0; + reg_dx = 0; + return true; + default: + return false; + } + } + else if (reg_bx == 0x18) return true; // idle callout + else return false; case 0x1680: /* RELEASE CURRENT VIRTUAL MACHINE TIME-SLICE */ //TODO Maybe do some idling but could screw up other systems :) reg_al=0; diff --git a/src/dos/dos_tables.cpp b/src/dos/dos_tables.cpp index d3f55ff8..5411d1b6 100644 --- a/src/dos/dos_tables.cpp +++ b/src/dos/dos_tables.cpp @@ -16,7 +16,7 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ -/* $Id: dos_tables.cpp,v 1.12 2004-06-11 12:09:50 qbix79 Exp $ */ +/* $Id: dos_tables.cpp,v 1.13 2004-07-08 20:08:52 qbix79 Exp $ */ #include "dosbox.h" #include "mem.h" @@ -52,39 +52,67 @@ Bit16u DOS_GetMemory(Bit16u pages) { void DOS_SetupTables(void) { dos_memseg=0xd000; - Bit16u seg;Bitu i; + Bit16u seg,seg2;Bitu i; dos.tables.mediaid=RealMake(DOS_GetMemory(2),0); dos.tables.tempdta=RealMake(DOS_GetMemory(4),0); for (i=0;i20 detection routine */ /* Possibly obselete when SFT is properly handled */ - // CON string - real_writew(0x54,0x00+0x00, (Bit16u) 0x4f43); - real_writew(0x54,0x00+0x02, (Bit16u) 0x204e); - // CON string - real_writew(0x54,0x10+0x00, (Bit16u) 0x4f43); - real_writew(0x54,0x10+0x02, (Bit16u) 0x204e); - //CON string - real_writew(0x54,0x20+0x00, (Bit16u) 0x4f43); - real_writew(0x54,0x20+0x02, (Bit16u) 0x204e); + real_writed(0x5d,0x0a,0x204e4f43); + real_writed(0x5d,0x1a,0x204e4f43); + real_writed(0x5d,0x2a,0x204e4f43); + + /* create a CON device driver */ + seg=0x60; + real_writed(seg,0x00,0xffffffff); // next ptr + real_writew(seg,0x04,0x8013); // attributes + real_writed(seg,0x06,0xffffffff); // strategy routine + real_writed(seg,0x0a,0x204e4f43); // driver name + real_writed(seg,0x0e,0x20202020); // driver name + dos_infoblock.SetDeviceChainStart(RealMake(seg,0)); + + /* Create a fake SFT, so programs think there are 100 file handles */ + seg=0x62; + seg2=0x63; + real_writed(seg,0,seg2<<16); //Next File Table + real_writew(seg,4,100); //File Table supports 100 files + real_writed(seg2,0,0xffffffff); //Last File Table + real_writew(seg2,4,100); //File Table supports 100 files + dos_infoblock.SetfirstFileTable(RealMake(seg,0)); + + /* Create a fake CDS */ + seg=0x64; + real_writed(seg,0x00,0x005c3a43); + dos_infoblock.SetCurDirStruct(RealMake(seg,0)); + + - /* Allocate some fake memory else pharlab doesn't like the indos pointer */ - /* Pharlab seems to real picky. So don't change this unless needed (the amount of allocated memory that is) */ /* Allocate DCBS DOUBLE BYTE CHARACTER SET LEAD-BYTE TABLE */ dos.tables.dcbs=RealMake(DOS_GetMemory(12),0); mem_writew(Real2Phys(dos.tables.dcbs),0); //empty table - sdaseg=DOS_GetMemory(3); - DOS_SDA(sdaseg,0).Init(); + + /* Create a fake FCB SFT */ + seg=DOS_GetMemory(4); + real_writed(seg,0,0xffffffff); //Last File Table + real_writew(seg,4,100); //File Table supports 100 files + dos_infoblock.SetFCBTable(RealMake(seg,0)); + + /* Create a fake disk info buffer */ + seg=DOS_GetMemory(6); + seg2=DOS_GetMemory(6); + real_writed(seg,0x00,seg2<<16); + real_writed(seg2,0x00,0xffffffff); + real_writed(seg2,0x0d,0xffffffff); + dos_infoblock.SetDiskInfoBuffer(RealMake(seg,0)); + + /* Set buffers to a nice value */ + dos_infoblock.SetBuffers(50,50); }