From 24b3c2a1b897115d90ecba7b45ed402919139c3b Mon Sep 17 00:00:00 2001 From: Peter Veenstra Date: Mon, 8 Jan 2007 20:10:34 +0000 Subject: [PATCH] Add beta2 patch: Move dos tables to c800 to make easier umb management. Imported-from: https://svn.code.sf.net/p/dosbox/code-0/dosbox/trunk@2730 --- include/dos_inc.h | 4 ++-- src/dos/dos_memory.cpp | 30 +++++------------------------- src/dos/dos_tables.cpp | 6 +++--- src/dosbox.cpp | 6 +++--- src/ints/xms.cpp | 6 +++--- 5 files changed, 16 insertions(+), 36 deletions(-) diff --git a/include/dos_inc.h b/include/dos_inc.h index fcd5a37a..8226a295 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.63 2007-01-08 19:45:37 qbix79 Exp $ */ +/* $Id: dos_inc.h,v 1.64 2007-01-08 20:10:34 qbix79 Exp $ */ #ifndef DOSBOX_DOS_INC_H #define DOSBOX_DOS_INC_H @@ -158,7 +158,7 @@ void DOS_FreeProcessMemory(Bit16u pspseg); Bit16u DOS_GetMemory(Bit16u pages); bool DOS_SetMemAllocStrategy(Bit16u strat); Bit16u DOS_GetMemAllocStrategy(void); -void DOS_BuildUMBChain(const char* use_umbs,bool ems_active); +void DOS_BuildUMBChain(bool umb_active,bool ems_active); bool DOS_LinkUMBsToMemChain(Bit16u linkstate); /* FCB stuff */ diff --git a/src/dos/dos_memory.cpp b/src/dos/dos_memory.cpp index 1572d7d2..0fa042f7 100644 --- a/src/dos/dos_memory.cpp +++ b/src/dos/dos_memory.cpp @@ -303,10 +303,11 @@ bool DOS_FreeMemory(Bit16u segment) { } -void DOS_BuildUMBChain(const char* use_umbs,bool ems_active) { - if ((strcmp(use_umbs,"false")!=0) && (machine!=MCH_TANDY)) { - Bit16u first_umb_seg=0xc800; - Bit16u first_umb_size=0x1000; +void DOS_BuildUMBChain(bool umb_active,bool ems_active) { + if (umb_active && (machine!=MCH_TANDY)) { + Bit16u first_umb_seg = 0xd000; + Bit16u first_umb_size = 0x2000; + if(ems_active || (machine == MCH_PCJR)) first_umb_size = 0x1000; dos_infoblock.SetStartOfUMBChain(UMB_START_SEG); dos_infoblock.SetUMBChainState(0); // UMBs not linked yet @@ -333,27 +334,6 @@ void DOS_BuildUMBChain(const char* use_umbs,bool ems_active) { mcb.SetSize(first_umb_seg-cover_mcb-1); mcb.SetFileName("SC "); - if (!ems_active && (strcmp(use_umbs,"max")==0) && (machine!=MCH_PCJR)) { - Bit16u ems_umb_seg=0xe000; - Bit16u ems_umb_size=0x1000; - - /* Continue UMB-chain */ - umb_mcb.SetSize(first_umb_size-2); - umb_mcb.SetType(0x4d); - - DOS_MCB umb2_mcb(ems_umb_seg); - umb2_mcb.SetPSPSeg(0); // currently free - umb2_mcb.SetSize(ems_umb_size-1); - umb2_mcb.SetType(0x5a); - - /* A system MCB has to take out the space between the previous and this UMB */ - cover_mcb=(Bit16u)(first_umb_seg+umb_mcb.GetSize()+1); - mcb.SetPt(cover_mcb); - mcb.SetType(0x4d); - mcb.SetPSPSeg(0x0008); - mcb.SetSize(ems_umb_seg-cover_mcb-1); - mcb.SetFileName("SC "); - } } else { dos_infoblock.SetStartOfUMBChain(0xffff); dos_infoblock.SetUMBChainState(0); diff --git a/src/dos/dos_tables.cpp b/src/dos/dos_tables.cpp index 73038bd4..f886421e 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.24 2007-01-08 19:45:39 qbix79 Exp $ */ +/* $Id: dos_tables.cpp,v 1.25 2007-01-08 20:10:34 qbix79 Exp $ */ #include "dosbox.h" #include "mem.h" @@ -43,7 +43,7 @@ static Bitu call_casemap; static Bit16u dos_memseg; Bit16u DOS_GetMemory(Bit16u pages) { - if (pages+dos_memseg>=0xe000) { + if (pages+dos_memseg>=0xd000) { E_Exit("DOS:Not enough memory for internal tables"); } Bit16u page=dos_memseg; @@ -73,7 +73,7 @@ static Bit8u country_info[0x22] = { }; void DOS_SetupTables(void) { - dos_memseg=0xd800; + dos_memseg=0xc800; Bit16u seg,seg2;Bitu i; dos.tables.mediaid=RealMake(DOS_GetMemory(4),0); dos.tables.tempdta=RealMake(DOS_GetMemory(4),0); diff --git a/src/dosbox.cpp b/src/dosbox.cpp index 982b3c8e..62b1cadc 100644 --- a/src/dosbox.cpp +++ b/src/dosbox.cpp @@ -16,7 +16,7 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ -/* $Id: dosbox.cpp,v 1.105 2007-01-08 19:45:38 qbix79 Exp $ */ +/* $Id: dosbox.cpp,v 1.106 2007-01-08 20:10:34 qbix79 Exp $ */ #include #include @@ -437,13 +437,13 @@ void DOSBOX_Init(void) { secprop->Add_bool("xms",true); secprop->AddInitFunction(&EMS_Init,true);//done secprop->Add_bool("ems",true); - secprop->Add_string("umb","true"); + secprop->Add_bool("umb","true"); secprop->AddInitFunction(&DOS_KeyboardLayout_Init,true); secprop->Add_string("keyboardlayout", "none"); MSG_Add("DOS_CONFIGFILE_HELP", "xms -- Enable XMS support.\n" "ems -- Enable EMS support.\n" - "umb -- Enable UMB support (false,true,max).\n" + "umb -- Enable UMB support.\n" "keyboardlayout -- Language code of the keyboard layout (or none).\n" ); // Mscdex diff --git a/src/ints/xms.cpp b/src/ints/xms.cpp index ca81a67d..71927a01 100644 --- a/src/ints/xms.cpp +++ b/src/ints/xms.cpp @@ -16,7 +16,7 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ -/* $Id: xms.cpp,v 1.44 2007-01-08 19:45:41 qbix79 Exp $ */ +/* $Id: xms.cpp,v 1.45 2007-01-08 20:10:34 qbix79 Exp $ */ #include #include @@ -436,8 +436,8 @@ public: xms_handles[0].free = false; /* Set up UMB chain */ - umb_available=strcmp(section->Get_string("umb"),"false")!=0; - DOS_BuildUMBChain(section->Get_string("umb"),section->Get_bool("ems")); + umb_available=section->Get_bool("umb"); + DOS_BuildUMBChain(section->Get_bool("umb"),section->Get_bool("ems")); } ~XMS(){