From 84bb06ea6002b93b6efe513d0b02381640892f6b Mon Sep 17 00:00:00 2001 From: ripsaw8080 Date: Sat, 10 Jan 2015 13:47:31 +0000 Subject: [PATCH] Arrange stack to restore registers when a child PSP is terminated. Fixes crashes in some demos (Blashphemy by Fatal Justice, Dreamwar by Elfsong, Mystic by Xenogenesis, et al). Imported-from: https://svn.code.sf.net/p/dosbox/code-0/dosbox/trunk@3892 --- src/dos/dos_execute.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/dos/dos_execute.cpp b/src/dos/dos_execute.cpp index 5538d721..78572309 100644 --- a/src/dos/dos_execute.cpp +++ b/src/dos/dos_execute.cpp @@ -225,6 +225,10 @@ bool DOS_ChildPSP(Bit16u segment, Bit16u size) { psp.SetFCB2(RealMake(parent_psp_seg,0x6c)); psp.SetEnvironment(psp_parent.GetEnvironment()); psp.SetSize(size); + // push registers in case child PSP is terminated + SaveRegisters(); + psp.SetStack(RealMakeSeg(ss,reg_sp)); + reg_sp+=18; return true; }