Microsoft (R) Macro Assembler Version 5.10                  5/16/24 23:40:14
CP/DOS  DOSExecPrg  mapper                                  Page     1-1


				;
				page 60,132
				;
				title CP/DOS  DOSExecPrg  mapper
				
 0000				buffer	segment word public 'buffer'
							public	DosExecPgmCalled
 0000  00			DosExecPgmCalled	db	0			  ;????????????
							public	DosExecPgmReturnCode
 0001  0000			DosExecPgmReturnCode	dw	0
				
 0003				DosExecParameterBlock	label	word
 0003  0000			EnvironmentSegment	dw	0
 0005  00000000			ArgumentPointer 	dd	0
 0009  00000000			Default_5C_FCB		dd	0
 000D  00000000			Default_6C_FCB		dd	0
				
 0011				buffer	ends
				
 0000				dosxxx	segment byte public 'dos'
					assume	cs:dosxxx,ds:nothing,es:nothing,ss:nothing
				;
				; ************************************************************************* *
				; *
				; *	 MODULE: DosExecPgm
				; *
				; *	 FUNCTION:  Allows a program to execute another program
				; *
				; *	 CALLING SEQUENCE:
				; *
				; *		push	Asyncindic	; execute asynchronously
				; *		push	TraceIndic	; trace process
				; *		push	Argpointer	; address of arguments string
				; *		push	Envpointer	; address of environment string
				; *		push	Processid	; address to put process id
				; *		push	PgmPointer	; address of program filename
				; *		call	dosexecpgm
				; *
				; *	 RETURN SEQUENCE:    AX = error code
				; *
				; *
				; *
				; *	 MODULES CALLED:   INT 21H   function 4BH and 4DH
				; *
				; *
				; *
				; *************************************************************************
				
					public	dosexecpgm
					.sall
					.list
				
 = 0002				inv_parm equ 0002
 = 0004				not_suf_mem equ 0004
				
				str	struc
Microsoft (R) Macro Assembler Version 5.10                  5/16/24 23:40:14
CP/DOS  DOSExecPrg  mapper                                  Page     1-2


 0000  0000			old_bp	dw	?
 0002  00000000			return	dd	?
 0006  00000000			Pgmpointer dd	?	; address of program file name
 000A  00000000			Processid  dd	?	; this is used when only sync exec
 000E  00000000			EnvPointer dd	?	; address of environment string
 0012  00000000			ArgPointer dd	?	; address of argument string
 0016  0000			Traceindic dw	?	; ignored,  what is a trace process?
 0018  0000			Asyncindic dw	?	; ignored,  PC-DOS always waits!
 001A				str	ends
				
 0000				dosexecpgm proc   far				; push registers
					Enter	dosexecpgm
				
 000C  B8 ---- R			mov	ax,seg buffer			; setup buffer segment
 000F  8E D8				mov	ds,ax				;   and copy info into
					assume	ds:buffer			;      data buffer
				
 0011  8B 46 10				mov	ax,word ptr [bp+2].EnvPointer	; seg portion only for pc-dos
 0014  A3 0003 R			mov	EnvironmentSegment,ax		; copy environment string
				
 0017  C4 7E 12				les	di,[bp].ArgPointer
 001A  89 3E 0005 R			mov	word ptr ArgumentPointer+0,di	; copy argument string
 001E  8C 06 0007 R			mov	word ptr ArgumentPointer+2,es
				
 0022  33 C0				xor	ax,ax
 0024  A3 0009 R			mov	word ptr Default_5C_FCB+0,ax	; setup defaults
 0027  A3 000B R			mov	word ptr Default_5C_FCB+2,ax
				
 002A  A3 000D R			mov	word ptr Default_6C_FCB+0,ax
 002D  A3 000F R			mov	word ptr Default_6C_FCB+2,ax
				
 0030  8C DB				mov	bx,ds
 0032  8E C3				mov	es,bx
 0034  BB 0003 R			mov	bx,offset buffer:DosExecParameterBlock
				
 0037  C5 56 06				lds	dx,[bp].PgmPointer	   ; setup program name
 003A  B8 4B00				mov	ax,4b00h
 003D  CD 21				int	21h			   ; exec program  and
 003F  72 10				jc	ErrorExit		   ;   check for error
				
 0041  B4 4D				mov	ah,4dh
 0043  CD 21				int	21h			   ; get return code of program
 0045  72 0A				jc	ErrorExit		   ;   just executed and jump if
									   ;	   error
 0047  BB ---- R			mov	bx,seg buffer
 004A  8E DB				mov	ds,bx
 004C  A3 0001 R			mov	DosExecPgmReturnCode,ax    ; else, save return code
				
 004F  33 C0				xor	ax,ax			   ; set no error code
				
 0051				ErrorExit:
					Mexit				   ; pop registers
 005D  CA 0014				ret	size str - 6		   ; return
				
 0060				dosexecpgm  endp
				
Microsoft (R) Macro Assembler Version 5.10                  5/16/24 23:40:14
CP/DOS  DOSExecPrg  mapper                                  Page     1-3


 0060				dosxxx	ends
				
					end

Microsoft (R) Macro Assembler Version 5.10                  5/16/24 23:40:14
CP/DOS  DOSExecPrg  mapper                                  Symbols-1


Macros:

		N a m e			Lines

ENTER  . . . . . . . . . . . . .  	   3
MEXIT  . . . . . . . . . . . . .  	   3
POPAL  . . . . . . . . . . . . .  	   9
PUSHAL . . . . . . . . . . . . .  	   9

Structures and Records:

                N a m e                 Width   # fields
                                        Shift   Width   Mask    Initial

STR  . . . . . . . . . . . . . .  	001A	0008
  OLD_BP . . . . . . . . . . . .  	0000
  RETURN . . . . . . . . . . . .  	0002
  PGMPOINTER . . . . . . . . . .  	0006
  PROCESSID  . . . . . . . . . .  	000A
  ENVPOINTER . . . . . . . . . .  	000E
  ARGPOINTER . . . . . . . . . .  	0012
  TRACEINDIC . . . . . . . . . .  	0016
  ASYNCINDIC . . . . . . . . . .  	0018

Segments and Groups:

                N a m e         	Length	 Align	Combine Class

BUFFER . . . . . . . . . . . . .  	0011	WORD	PUBLIC	'BUFFER'
DOSXXX . . . . . . . . . . . . .  	0060	BYTE	PUBLIC	'DOS'

Symbols:            

                N a m e         	Type	 Value	 Attr

ARGUMENTPOINTER  . . . . . . . .  	L DWORD	0005	BUFFER

DEFAULT_5C_FCB . . . . . . . . .  	L DWORD	0009	BUFFER
DEFAULT_6C_FCB . . . . . . . . .  	L DWORD	000D	BUFFER
DOSEXECPARAMETERBLOCK  . . . . .  	L WORD	0003	BUFFER
dosexecpgm . . . . . . . . . . .  	F PROC	0000	DOSXXX	Global	Length = 0060
DosExecPgmCalled . . . . . . . .  	L BYTE	0000	BUFFER	Global
DosExecPgmReturnCode . . . . . .  	L WORD	0001	BUFFER	Global

ENVIRONMENTSEGMENT . . . . . . .  	L WORD	0003	BUFFER
ERROREXIT  . . . . . . . . . . .  	L NEAR	0051	DOSXXX

INV_PARM . . . . . . . . . . . .  	NUMBER	0002	

NOT_SUF_MEM  . . . . . . . . . .  	NUMBER	0004	

@CPU . . . . . . . . . . . . . .  	TEXT  0101h		
@FILENAME  . . . . . . . . . . .  	TEXT  execpgm		
@VERSION . . . . . . . . . . . .  	TEXT  510		

Microsoft (R) Macro Assembler Version 5.10                  5/16/24 23:40:14

CP/DOS  DOSExecPrg  mapper                                  Symbols-2






    163 Source  Lines
    187 Total   Lines
     32 Symbols

  47326 + 290526 Bytes symbol space free

      0 Warning Errors
      0 Severe  Errors
