diff --git a/include/dos_inc.h b/include/dos_inc.h index e4a93da9..152afd0a 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.71 2007-11-07 22:08:03 c2woody Exp $ */ +/* $Id: dos_inc.h,v 1.72 2007-11-18 10:30:11 c2woody Exp $ */ #ifndef DOSBOX_DOS_INC_H #define DOSBOX_DOS_INC_H @@ -150,7 +150,7 @@ void DOS_SetupDevices(void); bool DOS_NewPSP(Bit16u pspseg,Bit16u size); bool DOS_ChildPSP(Bit16u pspseg,Bit16u size); bool DOS_Execute(char * name,PhysPt block,Bit8u flags); -bool DOS_Terminate(bool tsr); +bool DOS_Terminate(bool tsr,Bit8u exitcode); /* Memory Handling Routines */ void DOS_SetupMemory(void); diff --git a/src/dos/dos.cpp b/src/dos/dos.cpp index 872d6a86..807c2b94 100644 --- a/src/dos/dos.cpp +++ b/src/dos/dos.cpp @@ -16,7 +16,7 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ -/* $Id: dos.cpp,v 1.105 2007-11-04 11:11:34 c2woody Exp $ */ +/* $Id: dos.cpp,v 1.106 2007-11-18 10:30:12 c2woody Exp $ */ #include #include @@ -384,7 +384,7 @@ static Bitu DOS_21Handler(void) { //TODO First get normal files executing // Important: This service does not set the carry flag! DOS_ResizeMemory(dos.psp(),®_dx); - DOS_Terminate(true); + DOS_Terminate(true,reg_al); dos.return_code=reg_al; //Officially a field in the SDA dos.return_mode=RETURN_TSR; break; @@ -689,7 +689,7 @@ static Bitu DOS_21Handler(void) { reg_ax=0x4c00; /* Terminate Program */ case 0x4c: /* EXIT Terminate with return code */ { - if (DOS_Terminate(false)) { + if (DOS_Terminate(false,reg_al)) { /* This can't ever return false normally */ } else { reg_ax=dos.errorcode; @@ -1011,7 +1011,6 @@ static Bitu DOS_21Handler(void) { break; }; return CBRET_NONE; -/* That's it now let's get it working */ }; @@ -1024,7 +1023,7 @@ static Bitu DOS_20Handler(void) { static Bitu DOS_27Handler(void) { // Terminate & stay resident Bit16u para = (reg_dx/16)+((reg_dx % 16)>0); - if (DOS_ResizeMemory(dos.psp(),¶)) DOS_Terminate(true); + if (DOS_ResizeMemory(dos.psp(),¶)) DOS_Terminate(true,0); return CBRET_NONE; } diff --git a/src/dos/dos_execute.cpp b/src/dos/dos_execute.cpp index b181a4c0..ee646230 100644 --- a/src/dos/dos_execute.cpp +++ b/src/dos/dos_execute.cpp @@ -16,7 +16,7 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ -/* $Id: dos_execute.cpp,v 1.62 2007-10-19 19:39:27 c2woody Exp $ */ +/* $Id: dos_execute.cpp,v 1.63 2007-11-18 10:30:12 c2woody Exp $ */ #include #include @@ -104,9 +104,9 @@ void DOS_UpdatePSPName(void) { GFX_SetTitle(-1,-1,false); } -bool DOS_Terminate(bool tsr) { +bool DOS_Terminate(bool tsr,Bit8u exitcode) { - dos.return_code=reg_al; + dos.return_code=exitcode; dos.return_mode=RETURN_EXIT; Bit16u mempsp = dos.psp(); @@ -330,9 +330,18 @@ bool DOS_Execute(char * name,PhysPt block_pt,Bit8u flags) { else maxsize=0xffff; } if (maxfree>4)+0x20; + } + if (maxfree