add PCJr-compatible dos memory layout
Imported-from: https://svn.code.sf.net/p/dosbox/code-0/dosbox/trunk@2400
This commit is contained in:
parent
ed1cadea92
commit
de579c6a89
4 changed files with 54 additions and 10 deletions
|
@ -16,7 +16,7 @@
|
|||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
|
||||
/* $Id: dos_execute.cpp,v 1.51 2005-10-17 20:17:08 c2woody Exp $ */
|
||||
/* $Id: dos_execute.cpp,v 1.52 2005-12-03 10:43:22 c2woody Exp $ */
|
||||
|
||||
#include <string.h>
|
||||
#include <ctype.h>
|
||||
|
@ -274,6 +274,7 @@ bool DOS_Execute(char * name,PhysPt block_pt,Bit8u flags) {
|
|||
if (imagesize+headersize<512) imagesize = 512-headersize;
|
||||
}
|
||||
}
|
||||
Bit8u * loadbuf=(Bit8u *)new Bit8u[0x10000];
|
||||
if (flags!=OVERLAY) {
|
||||
/* Create an environment block */
|
||||
envseg=block.exec.envseg;
|
||||
|
@ -285,6 +286,14 @@ bool DOS_Execute(char * name,PhysPt block_pt,Bit8u flags) {
|
|||
Bit16u minsize,maxsize;Bit16u maxfree=0xffff;DOS_AllocateMemory(&pspseg,&maxfree);
|
||||
if (iscom) {
|
||||
minsize=0x1000;maxsize=0xffff;
|
||||
if (machine==MCH_PCJR) {
|
||||
/* try to load file into memory below 96k */
|
||||
pos=0;DOS_SeekFile(fhandle,&pos,DOS_SEEK_SET);
|
||||
Bit16u dataread=0x1800;
|
||||
DOS_ReadFile(fhandle,loadbuf,&dataread);
|
||||
if (dataread<0x1800) maxsize=dataread;
|
||||
if (minsize>maxsize) minsize=maxsize;
|
||||
}
|
||||
} else { /* Exe size calculated from header */
|
||||
minsize=long2para(imagesize+(head.minmemory<<4)+256);
|
||||
if (head.maxmemory!=0) maxsize=long2para(imagesize+(head.maxmemory<<4)+256);
|
||||
|
@ -298,6 +307,11 @@ bool DOS_Execute(char * name,PhysPt block_pt,Bit8u flags) {
|
|||
if (maxfree<maxsize) memsize=maxfree;
|
||||
else memsize=maxsize;
|
||||
if (!DOS_AllocateMemory(&pspseg,&memsize)) E_Exit("DOS:Exec error in memory");
|
||||
if (iscom && (machine==MCH_PCJR) && (pspseg<0x2000)) {
|
||||
maxsize=0xffff;
|
||||
/* resize to full extent of memory block */
|
||||
DOS_ResizeMemory(pspseg,&maxsize);
|
||||
}
|
||||
loadseg=pspseg+16;
|
||||
if (!iscom) {
|
||||
/* Check if requested to load program into upper part of allocated memory */
|
||||
|
@ -306,7 +320,6 @@ bool DOS_Execute(char * name,PhysPt block_pt,Bit8u flags) {
|
|||
}
|
||||
} else loadseg=block.overlay.loadseg;
|
||||
/* Load the executable */
|
||||
Bit8u * loadbuf=(Bit8u *)new Bit8u[0x10000];
|
||||
loadaddress=PhysMake(loadseg,0);
|
||||
|
||||
if (iscom) { /* COM Load 64k - 256 bytes max */
|
||||
|
|
|
@ -252,7 +252,7 @@ bool DOS_FreeMemory(Bit16u segment) {
|
|||
|
||||
|
||||
void DOS_BuildUMBChain(const char* use_umbs,bool ems_active) {
|
||||
if (strcmp(use_umbs,"false")!=0) {
|
||||
if ((strcmp(use_umbs,"false")!=0) && (machine!=MCH_TANDY)) {
|
||||
Bit16u first_umb_seg=0xca00;
|
||||
Bit16u first_umb_size=0x600;
|
||||
|
||||
|
@ -365,7 +365,7 @@ static CALLBACK_HandlerObject callbackhandler;
|
|||
void DOS_SetupMemory(void) {
|
||||
// Create a dummy device MCB with PSPSeg=0x0008
|
||||
DOS_MCB mcb_devicedummy((Bit16u)DOS_MEM_START);
|
||||
mcb_devicedummy.SetPSPSeg(0x0008); // Devices
|
||||
mcb_devicedummy.SetPSPSeg(MCB_DOS); // Devices
|
||||
mcb_devicedummy.SetSize(1);
|
||||
mcb_devicedummy.SetType(0x4d); // More blocks will follow
|
||||
// mcb_devicedummy.SetFileName("SD ");
|
||||
|
@ -388,10 +388,31 @@ void DOS_SetupMemory(void) {
|
|||
|
||||
DOS_MCB mcb((Bit16u)DOS_MEM_START+2);
|
||||
mcb.SetPSPSeg(MCB_FREE); //Free
|
||||
if (machine==MCH_TANDY) {
|
||||
mcb.SetSize(0x97FE - DOS_MEM_START - 2);
|
||||
} else mcb.SetSize(0x9FFE - DOS_MEM_START - 2);
|
||||
mcb.SetType(0x5a); //Last Block
|
||||
if (machine==MCH_TANDY) {
|
||||
/* memory up to 608k available, the rest (to 640k) is used by
|
||||
the tandy graphics system's variable mapping of 0xb800 */
|
||||
mcb.SetSize(0x97FE - DOS_MEM_START - 2);
|
||||
} else if (machine==MCH_PCJR) {
|
||||
/* memory from 128k to 640k is available */
|
||||
mcb_devicedummy.SetPt((Bit16u)0x2000);
|
||||
mcb_devicedummy.SetPSPSeg(MCB_FREE);
|
||||
mcb_devicedummy.SetSize(0x9FFE - 0x2000);
|
||||
mcb_devicedummy.SetType(0x5a);
|
||||
|
||||
/* exclude PCJr graphics region */
|
||||
mcb_devicedummy.SetPt((Bit16u)0x17ff);
|
||||
mcb_devicedummy.SetPSPSeg(MCB_DOS);
|
||||
mcb_devicedummy.SetSize(0x800);
|
||||
mcb_devicedummy.SetType(0x4d);
|
||||
|
||||
/* memory below 96k */
|
||||
mcb.SetSize(0x1800 - DOS_MEM_START - 4);
|
||||
mcb.SetType(0x4d);
|
||||
} else {
|
||||
/* complete memory up to 640k available */
|
||||
mcb.SetSize(0x9FFE - DOS_MEM_START - 2);
|
||||
}
|
||||
|
||||
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: memory.cpp,v 1.39 2005-07-31 13:59:02 qbix79 Exp $ */
|
||||
/* $Id: memory.cpp,v 1.40 2005-12-03 10:43:22 c2woody Exp $ */
|
||||
|
||||
#include "dosbox.h"
|
||||
#include "mem.h"
|
||||
|
@ -507,10 +507,16 @@ public:
|
|||
for (i=0xc0;i<0xc8;i++) {
|
||||
memory.phandlers[i] = &rom_page_handler;
|
||||
}
|
||||
/* Setup rom at 0xf0000-0x0x100000 */
|
||||
/* Setup rom at 0xf0000-0x100000 */
|
||||
for (i=0xf0;i<0x100;i++) {
|
||||
memory.phandlers[i] = &rom_page_handler;
|
||||
}
|
||||
if (machine==MCH_PCJR) {
|
||||
/* Setup cartridge rom at 0xe0000-0xf0000 */
|
||||
for (i=0xe0;i<0xf0;i++) {
|
||||
memory.phandlers[i] = &rom_page_handler;
|
||||
}
|
||||
}
|
||||
/* Reset some links */
|
||||
memory.links.used = 0;
|
||||
// A20 Line - PS/2 system control port A
|
||||
|
|
|
@ -16,7 +16,7 @@
|
|||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
|
||||
/* $Id: ems.cpp,v 1.43 2005-09-03 11:38:18 c2woody Exp $ */
|
||||
/* $Id: ems.cpp,v 1.44 2005-12-03 10:43:22 c2woody Exp $ */
|
||||
|
||||
#include <string.h>
|
||||
#include <stdlib.h>
|
||||
|
@ -1048,6 +1048,10 @@ public:
|
|||
|
||||
Section_prop * section=static_cast<Section_prop *>(configuration);
|
||||
if (!section->Get_bool("ems")) return;
|
||||
if (machine==MCH_PCJR) {
|
||||
LOG_MSG("EMS disabled for PCJr machine");
|
||||
return;
|
||||
}
|
||||
BIOS_ZeroExtendedSize(true);
|
||||
int67.Install(&INT67_Handler,CB_IRET,"Int 67 ems");
|
||||
Bit16u call_int67=int67.Get_callback();
|
||||
|
|
Loading…
Add table
Reference in a new issue