1
0
Fork 0

New segments and memory

Imported-from: https://svn.code.sf.net/p/dosbox/code-0/dosbox/trunk@185
This commit is contained in:
Sjoerd van der Berg 2002-08-19 13:03:23 +00:00
parent c2f556ca66
commit 908a8a93cf
3 changed files with 13 additions and 13 deletions

View file

@ -141,15 +141,15 @@ void SHELL_Init() {
Bit16u psp_seg=DOS_GetMemory(16);
Bit16u env_seg=DOS_GetMemory(1+(4096/16));
Bit16u stack_seg=DOS_GetMemory(2048/16);
SetSegment_16(ss,stack_seg);
SegSet16(ss,stack_seg);
reg_sp=2046;
/* Setup a fake MCB for the environment */
MCB * env_mcb=(MCB *)real_host(env_seg,0);
MCB * env_mcb=(MCB *)HostMake(env_seg,0);
env_mcb->psp_segment=psp_seg;
env_mcb->size=4096/16;
real_writed(env_seg+1,0,0);
PSP * psp=(PSP *)real_host(psp_seg,0);
PSP * psp=(PSP *)HostMake(psp_seg,0);
Bit32u i;
for (i=0;i<20;i++) psp->files[i]=0xff;
psp->files[STDIN]=DOS_FindDevice("CON");
@ -171,7 +171,7 @@ void SHELL_Init() {
PROGRAM_Info info;
strcpy(info.full_name,"Z:\\COMMAND.COM");
info.psp_seg=psp_seg;
MEM_BlockRead(real_phys(dos.psp,0),&info.psp_copy,sizeof(PSP));
MEM_BlockRead(PhysMake(dos.psp,0),&info.psp_copy,sizeof(PSP));
char line[256];
strcpy(line,"/INIT Z:\\AUTOEXEC.BAT");
info.cmd_line=line;

View file

@ -114,7 +114,7 @@ void DOS_Shell::CMD_EXIT(char * args) {
void DOS_Shell::CMD_CHDIR(char * args) {
if (!*args) {
Bit8u drive=DOS_GetDefaultDrive()+'A';
Bit8u dir[DOS_PATHLENGTH];
char dir[DOS_PATHLENGTH];
DOS_GetCurrentDir(0,dir);
WriteOut("%c:\\%s\n",drive,dir);
}
@ -186,7 +186,7 @@ void DOS_Shell::CMD_DIR(char * args) {
if (strlen(args)==0) args="*.*";
/* Make a full path in the args */
if (!DOS_Canonicalize(args,(Bit8u*)path)) {
if (!DOS_Canonicalize(args,path)) {
WriteOut(MSG_Get("SHELL_CMD_DIR_PATH_ERROR"));
return;
}

View file

@ -24,7 +24,7 @@
void DOS_Shell::ShowPrompt(void) {
Bit8u drive=DOS_GetDefaultDrive()+'A';
Bit8u dir[DOS_PATHLENGTH];
char dir[DOS_PATHLENGTH];
DOS_GetCurrentDir(0,dir);
WriteOut("%c:\\%s>",drive,dir);
}
@ -149,9 +149,9 @@ void DOS_Shell::Execute(char * name,char * args) {
/* 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)));
DOS_ParamBlock block(SegPhys(ss)+reg_sp);
//Add a filename
RealPt file_name=RealMake(Segs[ss].value,reg_sp+0x20);
RealPt file_name=RealMakeSeg(ss,reg_sp+0x20);
MEM_BlockWrite(Real2Phys(file_name),fullname,strlen(fullname)+1);
/* Fill the command line */
CommandTail cmd;
@ -159,21 +159,21 @@ void DOS_Shell::Execute(char * name,char * args) {
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);
MEM_BlockWrite(PhysMake(prog_info->psp_seg,128),&cmd,128);
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));
SegSet16(cs,RealSeg(newcsip));
reg_ip=RealOff(newcsip);
/* Start up a dos execute interrupt */
reg_ax=0x4b00;
//Filename pointer
SetSegment_16(ds,Segs[ss].value);
SegSet16(ds,SegValue(ss));
reg_dx=RealOff(file_name);
//Paramblock
SetSegment_16(es,Segs[ss].value);
SegSet16(es,SegValue(ss));
reg_bx=reg_sp;
flags.intf=false;
CALLBACK_RunRealInt(0x21);