From d0b600b4209390e5252b31761769b39600cdced9 Mon Sep 17 00:00:00 2001 From: Sjoerd van der Berg Date: Tue, 13 Aug 2002 04:52:41 +0000 Subject: [PATCH] Startup new programs correctly Imported-from: https://svn.code.sf.net/p/dosbox/code-0/dosbox/trunk@149 --- src/shell/shell_misc.cpp | 32 +++++++++++++++++++++----------- 1 file changed, 21 insertions(+), 11 deletions(-) diff --git a/src/shell/shell_misc.cpp b/src/shell/shell_misc.cpp index bb939ad9..9a97748d 100644 --- a/src/shell/shell_misc.cpp +++ b/src/shell/shell_misc.cpp @@ -145,29 +145,39 @@ void DOS_Shell::Execute(char * name,char * args) { /* Run the .bat file */ bf=new BatchFile(this,fullname,args); } else { - /* Run the .exe or .com file */ - ParamBlock block; + /* Run the .exe or .com file from the shell */ + /* Allocate some stack space for tables in physical memory */ + reg_sp-=0x200; + //Add Parameter block + DOS_ParamBlock block(Real2Phys(RealMake(Segs[ss].value,reg_sp))); + //Add a filename + RealPt file_name=RealMake(Segs[ss].value,reg_sp+0x20); + MEM_BlockWrite(Real2Phys(file_name),fullname,strlen(fullname)+1); /* Fill the command line */ CommandTail cmd; if (strlen(args)>126) args[126]=0; cmd.count=strlen(args); memcpy(cmd.buffer,args,strlen(args)); cmd.buffer[strlen(args)]=0xd; - MEM_BlockWrite(real_phys(prog_info->psp_seg,128),&cmd,128); - block.exec.cmdtail=RealMake(prog_info->psp_seg,128); - block.exec.envseg=0; - block.exec.fcb1=0; - block.exec.fcb2=0; + + block.InitExec(RealMake(prog_info->psp_seg,128)); /* Save CS:IP to some point where i can return them from */ RealPt newcsip; newcsip=CALLBACK_RealPointer(call_shellstop); SetSegment_16(cs,RealSeg(newcsip)); reg_ip=RealOff(newcsip); - - DOS_Execute(fullname,&block,0); - DOSBOX_RunMachine(); - Bit16u blah=0; + /* Start up a dos execute interrupt */ + reg_ax=0x4b00; + //Filename pointer + SetSegment_16(ds,Segs[ss].value); + reg_dx=RealOff(file_name); + //Paramblock + SetSegment_16(es,Segs[ss].value); + reg_bx=reg_sp; + flags.intf=false; + CALLBACK_RunRealInt(0x21); + reg_sp+=0x200; }