1
0
Fork 0

use calling application's code segment rather than psp value for some old-style (dos 1.0) terminate functions (ripsaw, fixes fortune teller)

Imported-from: https://svn.code.sf.net/p/dosbox/code-0/dosbox/trunk@3476
This commit is contained in:
Sebastian Strohhäcker 2009-10-04 14:28:07 +00:00
parent 42d8d2e962
commit 1c410c147e
3 changed files with 20 additions and 29 deletions

View file

@ -16,7 +16,7 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
/* $Id: dos.cpp,v 1.119 2009-07-31 16:41:37 qbix79 Exp $ */
/* $Id: dos.cpp,v 1.120 2009-10-04 14:28:07 c2woody Exp $ */
#include <stdlib.h>
#include <string.h>
@ -70,6 +70,9 @@ static Bitu DOS_21Handler(void) {
char name1[DOSNAMEBUF+2+DOS_NAMELENGTH_ASCII];
char name2[DOSNAMEBUF+2+DOS_NAMELENGTH_ASCII];
switch (reg_ah) {
case 0x00: /* Terminate Program */
DOS_Terminate(mem_readw(SegPhys(ss)+reg_sp+2),false,0);
break;
case 0x01: /* Read character from STDIN, with echo */
{
Bit8u c;Bit16u n=1;
@ -390,11 +393,9 @@ static Bitu DOS_21Handler(void) {
reg_cx=0x0000;
break;
case 0x31: /* Terminate and stay resident */
//TODO First get normal files executing
// Important: This service does not set the carry flag!
DOS_ResizeMemory(dos.psp(),&reg_dx);
DOS_Terminate(true,reg_al);
dos.return_mode=RETURN_TSR;
DOS_Terminate(dos.psp(),true,reg_al);
break;
case 0x1f: /* Get drive parameter block for default drive */
case 0x32: /* Get drive parameter block for specific drive */
@ -708,18 +709,9 @@ static Bitu DOS_21Handler(void) {
}
break;
//TODO Check for use of execution state AL=5
case 0x00:
reg_ax=0x4c00; /* Terminate Program */
case 0x4c: /* EXIT Terminate with return code */
{
if (DOS_Terminate(false,reg_al)) {
/* This can't ever return false normally */
} else {
reg_ax=dos.errorcode;
CALLBACK_SCF(true);
}
break;
}
DOS_Terminate(dos.psp(),false,reg_al);
break;
case 0x4d: /* Get Return code */
reg_al=dos.return_code;/* Officially read from SDA and clear when read */
reg_ah=dos.return_mode;
@ -1051,7 +1043,7 @@ static Bitu DOS_21Handler(void) {
static Bitu DOS_20Handler(void) {
reg_ax=0x4c00;
reg_ah=0x00;
DOS_21Handler();
return CBRET_NONE;
}
@ -1059,7 +1051,8 @@ 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(),&para)) DOS_Terminate(true,0);
Bit16u psp = mem_readw(SegPhys(ss)+reg_sp+2);
if (DOS_ResizeMemory(psp,&para)) DOS_Terminate(psp,true,0);
return CBRET_NONE;
}