		SUBTITLE	"< RUN / LOAD SVC routines. >"
		NEWPAGE
		scope

; Update to LSDOS 6.3.1 2022-09-16 dpm
			
; Routine to RUN a program.

		org	1B1DH

zRUN		PUSH	HL		; Save register pair
		LD	HL,SFLAG$
		SET	2,(HL)		; Turn on RUN flag bit
		CALL	zLOAD		; Load the program module
		EX	(SP),HL		; Put traadr on the stack

; Error code is set to NOT abort.
; Errors will be passed back to calling module after zERROR.
; HL will contain the error #.

		Jr	NZ,POPERR
		LD	BC,INBUF$	; Place INBUF$ pointer in BC, reflect buffer pointer.

; Get TRAADR then test if we need to go to DEBUG.

		LD	A,(SFLAG$)
		BIT	1,A		; Go to the program if
		REt	NZ		; its EXEC only access
		BIT	7,A		; else test if DEBUG
		JP	NZ,zRST30	; is on & go to it
		RET			; else go to program

