[net.micro.pc] exec function, help wanted

jaap@tnocsda.UUCP (Jaap van den Eersten) (09/07/84)

I cannot get the EXEC function working. In the example program I am trying
to execute the Personal Editor, editting the file 'test'. The EXEC function
results in executing PE, the filename is rubbish (should be test).
Exit from PE results in a hang up of the PC. Does anyone know a solution
to this problem? The DOS manual tells not much about the EXEC function.

Thanks in advance for any help
Jaap van den Eersten

EXAMPLE PROGRAM :

CMD	DB	5,' test',0DH           ; command line : edit file test
FILE	DB	'C:PE.EXE',0            ; ASCIIZ string with filename

; save locations

SAVE_SS DW	0			; save location for SS register
SAVE_SP DW	0			; save location for SP register

; parameter block

PARBLK	DW	0			; WORD segment address of environment string
	DW	OFFSET CMD		; displacement of command line
	DW	DSEG			; segment containing command line
	DW	4 DUP(0)		; no default fcb's



	PUSH	DS			; prepare return to DOS
	XOR	AX,AX
	PUSH	AX
	MOV	AX,DSEG 		; init DATA segment register
	MOV	DS,AX
	LEA	DX,FILE 		; (DS:DX) points to ASCIIZ string

	MOV	AL,0			; free memory
	MOV	AH,4AH
	MOV	BX,4
	INT	21H

	LEA	BX,PARBLK		; point (ES:BX) to parameter block
	MOV	AX,DS
	MOV	ES,AX
	MOV	AX,SS			; save SS register
	MOV	SAVE_SS,AX
	MOV	AX,SP			; save SP register
	MOV	SAVE_SP,AX

	MOV	AL,0			; call the execute function
	MOV	AH,4BH
	INT	21H

	MOV	AH,4DH			; call the wait function
	INT	21H

	MOV	AX,SAVE_SS		; restore SS register
	MOV	SS,AX
	MOV	AX,SAVE_SP		; restore SP register
	MOV	SP,AX

	RET

rf@wu1.UUCP (10/12/84)

Jaap van den Eersten writes:

>> I cannot get the EXEC function working. In the example program I am trying
>> to execute the Personal Editor, editting the file 'test'. The EXEC function
>> results in executing PE, the filename is rubbish (should be test).
>> Exit from PE results in a hang up of the PC. Does anyone know a solution
>> to this problem? The DOS manual tells not much about the EXEC function.

>> Thanks in advance for any help
>> Jaap van den Eersten

A friend (Charles Zamloot) opines that one must initialize file
control block 1 (and possibly 2 as well) before PE will open the
file properly.  PE apparently uses the DOS 1.1 file i/o
operations and therefore assumes that the file blocks are
initialized.  The program must either initialize the FCB's or
invoke COMMAND.COM with a parameter line of "/c pe test".


				Randolph Fritz
UUCPnet:			{ihnp4,decvax}!philabs!wu1!rf

"There is a universal affinity between an intoxicated traveler
and a telephone pole . . . " -- Telephony, 4 Sept. 1909