From 00080a4d9d03bbccef09e4fa4549e8517dfa7f51 Mon Sep 17 00:00:00 2001 From: Ulf Wohlers Date: Thu, 6 Feb 2003 22:21:58 +0000 Subject: [PATCH] MakeEnv: added hack to allow creation from envblock in unused mem (0xCD) Dos_Execute: extrabytes now added to the imagesize Imported-from: https://svn.code.sf.net/p/dosbox/code-0/dosbox/trunk@661 --- src/dos/dos_execute.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/dos/dos_execute.cpp b/src/dos/dos_execute.cpp index dd6ab205..d435d574 100644 --- a/src/dos/dos_execute.cpp +++ b/src/dos/dos_execute.cpp @@ -137,6 +137,9 @@ static bool MakeEnv(char * name,Bit16u * segment) { } if (parentenv) { + // hack to allow creation from envblock in unused mem (0xCD) + if (readw(envread)==0xCDCD) writew(envread,0x0000); + for (envsize=0; ;envsize++) { if (envsize>=MAXENV - ENV_KEEPFREE) { DOS_SetError(DOSERR_ENVIRONMENT_INVALID); @@ -230,7 +233,7 @@ bool DOS_Execute(char * name,PhysPt block_pt,Bit8u flags) { else { headersize=head.headersize*16; imagesize=(head.pages)*512-headersize; - if (head.extrabytes) imagesize-=(512-head.extrabytes); + if (head.extrabytes) imagesize += head.extrabytes % 512; } if (flags!=OVERLAY) { /* Create an environment block */