Message-ID: <116@tnocsda.UUCP>
Date: Fri, 7-Sep-84 12:31:20 EDT
Article-I.D.: tnocsda.116
Posted: Fri Sep 7 12:31:20 1984
Date-Received: Sun, 16-Sep-84 12:01:17 EDT
Lines: 62
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