raise dos memory start segment (WC armada, novalogic setup);
update some dos tables Imported-from: https://svn.code.sf.net/p/dosbox/code-0/dosbox/trunk@2260
This commit is contained in:
parent
58a0aaed55
commit
154ad64370
4 changed files with 74 additions and 60 deletions
|
@ -16,7 +16,7 @@
|
|||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
|
||||
/* $Id: dos_inc.h,v 1.53 2005-03-24 10:18:45 qbix79 Exp $ */
|
||||
/* $Id: dos_inc.h,v 1.54 2005-08-01 09:30:44 c2woody Exp $ */
|
||||
|
||||
#ifndef DOSBOX_DOS_INC_H
|
||||
#define DOSBOX_DOS_INC_H
|
||||
|
@ -76,6 +76,15 @@ enum { RETURN_EXIT=0,RETURN_CTRLC=1,RETURN_ABORT=2,RETURN_TSR=3};
|
|||
#define DOS_DRIVES 26
|
||||
#define DOS_DEVICES 10
|
||||
|
||||
#define DOS_INFOBLOCK_SEG 0x50
|
||||
#define DOS_SDA_SEG 0x5a
|
||||
#define DOS_SDA_OFS 0
|
||||
#define DOS_CONSTRING_SEG 0x5d
|
||||
#define DOS_CONDRV_SEG 0x60
|
||||
#define DOS_SFT_SEG 0x62
|
||||
#define DOS_CDS_SEG 0x64
|
||||
#define DOS_MEM_START 0x102 //First Segment that DOS can use
|
||||
|
||||
/* internal Dos Tables */
|
||||
|
||||
extern DOS_File * Files[DOS_FILES];
|
||||
|
@ -350,7 +359,7 @@ public:
|
|||
void SetCurDirStruct(Bit32u _curdirstruct);
|
||||
void SetFCBTable(Bit32u _fcbtable);
|
||||
void SetDeviceChainStart(Bit32u _devchain);
|
||||
void SetDiskInfoBuffer(Bit32u _dinfobuf);
|
||||
void SetDiskBufferHeadPt(Bit32u _dbheadpt);
|
||||
RealPt GetPointer (void);
|
||||
|
||||
#ifdef _MSC_VER
|
||||
|
@ -391,7 +400,17 @@ public:
|
|||
Bit8u bootDrive; // 0x43 boot drive
|
||||
Bit8u useDwordMov; // 0x44 use dword moves
|
||||
Bit16u extendedSize; // 0x45 size of extended memory
|
||||
// some more stuff, hopefully never used.
|
||||
Bit32u diskBufferHeadPt; // 0x47 pointer to least-recently used buffer header
|
||||
Bit16u dirtyDiskBuffers; // 0x4b number of dirty disk buffers
|
||||
Bit32u lookaheadBufPt; // 0x4d pointer to lookahead buffer
|
||||
Bit16u lookaheadBufNumber; // 0x51 number of lookahead buffers
|
||||
Bit8u bufferLocation; // 0x53 workspace buffer location
|
||||
Bit32u workspaceBuffer; // 0x54 pointer to workspace buffer
|
||||
Bit8u unknown2[11]; // 0x58
|
||||
Bit8u chainingUMB; // 0x63 bit0: UMB chain linked to MCB chain
|
||||
Bit16u minMemForExec; // 0x64 minimum paragraphs needed for current program
|
||||
Bit16u startOfUMBChain; // 0x66 segment of first UMB-MCB
|
||||
Bit16u memAllocScanStart; // 0x68 start paragraph for memory allocation
|
||||
} GCC_ATTRIBUTE(packed);
|
||||
#ifdef _MSC_VER
|
||||
#pragma pack ()
|
||||
|
@ -510,11 +529,6 @@ private:
|
|||
#endif
|
||||
};
|
||||
|
||||
extern Bit16u sdaseg;
|
||||
#define DOS_SDA_SEG sdaseg
|
||||
#define DOS_SDA_OFS 0
|
||||
|
||||
|
||||
class DOS_SDA : public MemStruct {
|
||||
public:
|
||||
DOS_SDA(Bit16u _seg,Bit16u _offs) { SetPt(_seg,_offs); }
|
||||
|
|
|
@ -16,7 +16,7 @@
|
|||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
|
||||
/* $Id: dos_classes.cpp,v 1.43 2005-02-10 10:20:51 qbix79 Exp $ */
|
||||
/* $Id: dos_classes.cpp,v 1.44 2005-08-01 09:30:45 c2woody Exp $ */
|
||||
|
||||
#include <string.h>
|
||||
#include <stdlib.h>
|
||||
|
@ -58,11 +58,10 @@ void DOS_ParamBlock::SaveData(void) {
|
|||
}
|
||||
|
||||
|
||||
void DOS_InfoBlock::SetLocation(Bit16u segment)
|
||||
{
|
||||
void DOS_InfoBlock::SetLocation(Bit16u segment) {
|
||||
seg = segment;
|
||||
pt=PhysMake(seg,0);
|
||||
/* Clear the initual Block */
|
||||
/* Clear the initial Block */
|
||||
for(Bitu i=0;i<sizeof(sDIB);i++) mem_writeb(pt+i,0xff);
|
||||
|
||||
sSave(sDIB,regCXfrom5e,(Bit16u)0);
|
||||
|
@ -74,6 +73,7 @@ void DOS_InfoBlock::SetLocation(Bit16u segment)
|
|||
sSave(sDIB,joindedDrives,(Bit8u)0);
|
||||
sSave(sDIB,lastdrive,(Bit8u)0x01);//increase this if you add drives to cds-chain
|
||||
|
||||
sSave(sDIB,diskInfoBuffer,RealMake(segment,0x5f));
|
||||
sSave(sDIB,setverPtr,(Bit32u)0);
|
||||
|
||||
sSave(sDIB,a20FixOfs,(Bit16u)0);
|
||||
|
@ -87,6 +87,17 @@ void DOS_InfoBlock::SetLocation(Bit16u segment)
|
|||
sSave(sDIB,sharingCount,(Bit16u)0);
|
||||
sSave(sDIB,sharingDelay,(Bit16u)0);
|
||||
|
||||
sSave(sDIB,dirtyDiskBuffers,(Bit16u)0);
|
||||
sSave(sDIB,lookaheadBufPt,(Bit32u)0);
|
||||
sSave(sDIB,lookaheadBufNumber,(Bit16u)0);
|
||||
sSave(sDIB,bufferLocation,(Bit8u)0); // buffer in base memory, no workspace
|
||||
sSave(sDIB,workspaceBuffer,(Bit32u)0);
|
||||
|
||||
sSave(sDIB,minMemForExec,(Bit16u)0);
|
||||
sSave(sDIB,memAllocScanStart,(Bit16u)DOS_MEM_START);
|
||||
sSave(sDIB,startOfUMBChain,(Bit16u)0xffff);
|
||||
sSave(sDIB,chainingUMB,(Bit8u)0);
|
||||
|
||||
sSave(sDIB,nulNextDriver,(Bit32u)0xffffffff);
|
||||
sSave(sDIB,nulAttributes,(Bit16u)0x8004);
|
||||
sSave(sDIB,nulStrategy,(Bit32u)0x00000000);
|
||||
|
@ -100,43 +111,36 @@ void DOS_InfoBlock::SetLocation(Bit16u segment)
|
|||
sSave(sDIB,nulString[7],(Bit8u)0x20);
|
||||
}
|
||||
|
||||
void DOS_InfoBlock::SetFirstMCB(Bit16u _firstmcb)
|
||||
{
|
||||
void DOS_InfoBlock::SetFirstMCB(Bit16u _firstmcb) {
|
||||
sSave(sDIB,firstMCB,_firstmcb); //c2woody
|
||||
}
|
||||
|
||||
void DOS_InfoBlock::SetfirstFileTable(RealPt _first_table){
|
||||
void DOS_InfoBlock::SetfirstFileTable(RealPt _first_table) {
|
||||
sSave(sDIB,firstFileTable,_first_table);
|
||||
}
|
||||
|
||||
void DOS_InfoBlock::SetBuffers(Bit16u x,Bit16u y) {
|
||||
sSave(sDIB,buffers_x,x);
|
||||
sSave(sDIB,buffers_y,y);
|
||||
|
||||
}
|
||||
|
||||
void DOS_InfoBlock::SetCurDirStruct(Bit32u _curdirstruct)
|
||||
{
|
||||
void DOS_InfoBlock::SetCurDirStruct(Bit32u _curdirstruct) {
|
||||
sSave(sDIB,curDirStructure,_curdirstruct);
|
||||
}
|
||||
|
||||
void DOS_InfoBlock::SetFCBTable(Bit32u _fcbtable)
|
||||
{
|
||||
void DOS_InfoBlock::SetFCBTable(Bit32u _fcbtable) {
|
||||
sSave(sDIB,fcbTable,_fcbtable);
|
||||
}
|
||||
|
||||
void DOS_InfoBlock::SetDeviceChainStart(Bit32u _devchain)
|
||||
{
|
||||
void DOS_InfoBlock::SetDeviceChainStart(Bit32u _devchain) {
|
||||
sSave(sDIB,nulNextDriver,_devchain);
|
||||
}
|
||||
|
||||
void DOS_InfoBlock::SetDiskInfoBuffer(Bit32u _dinfobuf)
|
||||
{
|
||||
sSave(sDIB,diskInfoBuffer,_dinfobuf);
|
||||
void DOS_InfoBlock::SetDiskBufferHeadPt(Bit32u _dbheadpt) {
|
||||
sSave(sDIB,diskBufferHeadPt,_dbheadpt);
|
||||
}
|
||||
|
||||
RealPt DOS_InfoBlock::GetPointer(void)
|
||||
{
|
||||
RealPt DOS_InfoBlock::GetPointer(void) {
|
||||
return RealMake(seg,offsetof(sDIB,firstDPB));
|
||||
}
|
||||
|
||||
|
|
|
@ -20,10 +20,6 @@
|
|||
#include "mem.h"
|
||||
#include "dos_inc.h"
|
||||
|
||||
|
||||
#define MEM_START 0x68 //First Segment that DOS can use
|
||||
//#define MEM_START 4000 //First Segment that DOS can use
|
||||
|
||||
static Bit16u memAllocStrategy = 0x00;
|
||||
|
||||
static void DOS_CompressMemory(void) {
|
||||
|
@ -134,7 +130,7 @@ bool DOS_AllocateMemory(Bit16u * segment,Bit16u * blocks) {
|
|||
|
||||
|
||||
bool DOS_ResizeMemory(Bit16u segment,Bit16u * blocks) {
|
||||
if (segment < MEM_START+1) {
|
||||
if (segment < DOS_MEM_START+1) {
|
||||
LOG(LOG_DOSMISC,LOG_ERROR)("Program resizes %X, take care",segment);
|
||||
}
|
||||
|
||||
|
@ -197,7 +193,7 @@ bool DOS_ResizeMemory(Bit16u segment,Bit16u * blocks) {
|
|||
|
||||
bool DOS_FreeMemory(Bit16u segment) {
|
||||
//TODO Check if allowed to free this segment
|
||||
if (segment < MEM_START+1) {
|
||||
if (segment < DOS_MEM_START+1) {
|
||||
LOG(LOG_DOSMISC,LOG_ERROR)("Program tried to free %X ---ERROR",segment);
|
||||
DOS_SetError(DOSERR_MB_ADDRESS_INVALID);
|
||||
return false;
|
||||
|
@ -218,22 +214,22 @@ bool DOS_FreeMemory(Bit16u segment) {
|
|||
|
||||
void DOS_SetupMemory(void) {
|
||||
// Create a dummy device MCB with PSPSeg=0x0008
|
||||
DOS_MCB mcb_devicedummy((Bit16u)MEM_START);
|
||||
DOS_MCB mcb_devicedummy((Bit16u)DOS_MEM_START);
|
||||
mcb_devicedummy.SetPSPSeg(0x0008); // Devices
|
||||
mcb_devicedummy.SetSize(1);
|
||||
mcb_devicedummy.SetType(0x4d); // More blocks will follow
|
||||
|
||||
// BioMenace (segment of int2<0x8000)
|
||||
mem_writeb((MEM_START+1)<<4,0xcf);// iret
|
||||
RealSetVec(0x02,(MEM_START+1)<<16);
|
||||
mem_writeb((DOS_MEM_START+1)<<4,0xcf);// iret
|
||||
RealSetVec(0x02,(DOS_MEM_START+1)<<16);
|
||||
|
||||
DOS_MCB mcb((Bit16u)MEM_START+2);
|
||||
DOS_MCB mcb((Bit16u)DOS_MEM_START+2);
|
||||
mcb.SetPSPSeg(MCB_FREE); //Free
|
||||
if (machine==MCH_TANDY) {
|
||||
mcb.SetSize(0x97FE - MEM_START - 2);
|
||||
} else mcb.SetSize(0x9FFE - MEM_START - 2);
|
||||
mcb.SetSize(0x97FE - DOS_MEM_START - 2);
|
||||
} else mcb.SetSize(0x9FFE - DOS_MEM_START - 2);
|
||||
mcb.SetType(0x5a); //Last Block
|
||||
|
||||
dos.firstMCB=MEM_START;
|
||||
dos_infoblock.SetFirstMCB(MEM_START);
|
||||
dos.firstMCB=DOS_MEM_START;
|
||||
dos_infoblock.SetFirstMCB(DOS_MEM_START);
|
||||
}
|
||||
|
|
|
@ -16,7 +16,7 @@
|
|||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
|
||||
/* $Id: dos_tables.cpp,v 1.18 2005-02-10 10:20:51 qbix79 Exp $ */
|
||||
/* $Id: dos_tables.cpp,v 1.19 2005-08-01 09:30:45 c2woody Exp $ */
|
||||
|
||||
#include "dosbox.h"
|
||||
#include "mem.h"
|
||||
|
@ -41,7 +41,6 @@ RealPt DOS_TableLowCase;
|
|||
static Bitu call_casemap;
|
||||
|
||||
static Bit16u dos_memseg;
|
||||
Bit16u sdaseg;
|
||||
|
||||
Bit16u DOS_GetMemory(Bit16u pages) {
|
||||
if (pages+dos_memseg>=0xe000) {
|
||||
|
@ -81,20 +80,19 @@ void DOS_SetupTables(void) {
|
|||
dos.tables.tempdta_fcbdelete=RealMake(DOS_GetMemory(4),0);
|
||||
for (i=0;i<DOS_DRIVES;i++) mem_writeb(Real2Phys(dos.tables.mediaid)+i,0);
|
||||
/* Create the DOS Info Block */
|
||||
dos_infoblock.SetLocation(0x50); //c2woody
|
||||
dos_infoblock.SetLocation(DOS_INFOBLOCK_SEG); //c2woody
|
||||
|
||||
/* create SDA */
|
||||
sdaseg=0x5a;
|
||||
DOS_SDA(sdaseg,0).Init();
|
||||
DOS_SDA(DOS_SDA_SEG,0).Init();
|
||||
|
||||
/* Some weird files >20 detection routine */
|
||||
/* Possibly obselete when SFT is properly handled */
|
||||
real_writed(0x5d,0x0a,0x204e4f43);
|
||||
real_writed(0x5d,0x1a,0x204e4f43);
|
||||
real_writed(0x5d,0x2a,0x204e4f43);
|
||||
real_writed(DOS_CONSTRING_SEG,0x0a,0x204e4f43);
|
||||
real_writed(DOS_CONSTRING_SEG,0x1a,0x204e4f43);
|
||||
real_writed(DOS_CONSTRING_SEG,0x2a,0x204e4f43);
|
||||
|
||||
/* create a CON device driver */
|
||||
seg=0x60;
|
||||
seg=DOS_CONDRV_SEG;
|
||||
real_writed(seg,0x00,0xffffffff); // next ptr
|
||||
real_writew(seg,0x04,0x8013); // attributes
|
||||
real_writed(seg,0x06,0xffffffff); // strategy routine
|
||||
|
@ -103,16 +101,16 @@ void DOS_SetupTables(void) {
|
|||
dos_infoblock.SetDeviceChainStart(RealMake(seg,0));
|
||||
|
||||
/* Create a fake SFT, so programs think there are 100 file handles */
|
||||
seg=0x62;
|
||||
seg2=0x63;
|
||||
seg=DOS_SFT_SEG;
|
||||
seg2=DOS_SFT_SEG+1;
|
||||
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;
|
||||
/* Create a fake Current Directory Structure */
|
||||
seg=DOS_CDS_SEG;
|
||||
real_writed(seg,0x00,0x005c3a43);
|
||||
dos_infoblock.SetCurDirStruct(RealMake(seg,0));
|
||||
|
||||
|
@ -128,13 +126,15 @@ void DOS_SetupTables(void) {
|
|||
real_writew(seg,4,100); //File Table supports 100 files
|
||||
dos_infoblock.SetFCBTable(RealMake(seg,0));
|
||||
|
||||
/* Create a fake disk info buffer */
|
||||
/* Create a fake disk buffer head */
|
||||
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));
|
||||
for (Bitu ct=0; ct<0x20; ct++) real_writeb(seg,ct,0);
|
||||
real_writew(seg,0x00,0xffff); // forward ptr
|
||||
real_writew(seg,0x02,0xffff); // backward ptr
|
||||
real_writeb(seg,0x04,0xff); // not in use
|
||||
real_writeb(seg,0x0a,0x01); // number of FATs
|
||||
real_writed(seg,0x0d,0xffffffff); // pointer to DPB
|
||||
dos_infoblock.SetDiskBufferHeadPt(RealMake(seg,0));
|
||||
|
||||
/* Set buffers to a nice value */
|
||||
dos_infoblock.SetBuffers(50,50);
|
||||
|
|
Loading…
Add table
Reference in a new issue