edrdos icon indicating copy to clipboard operation
edrdos copied to clipboard

Test if COMMAND.COM works under MS-DOS

Open boeckmann opened this issue 2 years ago • 4 comments

boeckmann avatar Jan 04 '24 11:01 boeckmann

there are different meanings by "works" here:

  • works by launching as secondary shell and/or batch script runner
  • works by "SHELL=" in config.sys

for first one, it is more-or-less working. for second one, it is not working at all.

roytam1 avatar Jan 07 '24 15:01 roytam1

PC DOS 7.1 with "SHELL=COMMAND.COM /P" dies here: image and which seems to be here: https://github.com/SvarDOS/edrdos/blob/e85d9275a60c26c2658785f1cc0d21d6c2773946/command/cstart.asm#L3707-L3717

which is called from https://github.com/SvarDOS/edrdos/blob/main/command/com.c#L474

patching out this call it will run, but in msdos.exe it can't exit anymore after patching this out.

roytam1 avatar Jan 09 '24 14:01 roytam1

a patch seems fix deadloop problem when running from MS-DOS/PC DOS config.sys "shell=" statement:

diff --git a/command/cstart.asm b/command/cstart.asm
index 6a3375f..9194f94 100644
--- a/command/cstart.asm
+++ b/command/cstart.asm
@@ -3711,13 +3711,17 @@ try_next:
 	mov	cx,bx			; move into CX
 	mov	bx,0
 	mov	ax,es:16h[bx]		; get parent PSP seg in ax
 	cmp	ax,cx			; are they the same ?
 	je	got_org_psp		; yes - found COMMAND.COM PSP
+	cmp	ax,0
+	je	null_org_psp
 	mov	bx,ax			; else make this current seg and
 	jmp	try_next		; try again
 
+null_org_psp:
+	mov	ax,cx
 got_org_psp:
 	mov	es,ax			; ES = COMMAND.COM PSP seg
 	mov	bx,0
 	mov	ax,es:2ch[bx]		; get env seg in ax
 	cmp	ax,0			; seg = 0000 ?

and replacing stock command.com in PC DOS/MS-DOS seems not possible.

roytam1 avatar Jan 09 '24 16:01 roytam1

I applied your changes. It can be run with the following line in config.sys:

SHELL=A:\COMMAND.COM /P

MS-DOS kernel complains about bad command interpreter if I leave this line out. Perhaps some type of integrity check.

boeckmann avatar Jan 17 '24 21:01 boeckmann