		NEWPAGE
		SUBTITLE    "< System memory manager and associated routines >"
		scope
; Update to LSDOS 6.3.1 2022-09-16 dpm
			
; Memory routines to set or retrieve HIGH$/LOW$

		ORG	zspace.MEMORY$

zHIGH		LD	A,H			; Test if put or get.
		OR	L
		JR	Z,GETHILO		; Go if get.
		LD	A,(CFLAG$)		; Is HIGH$ changeable?
		RRCA	
		LD	A,43			; Init SVC parm error.
		RET	C			; Back with NZ.
		INC	B			; Test for HIGH$/LOW$.
		DEC	B
		JR	NZ,PUTLO		; Go if LOW$.
		LD	(zHIGH$),HL		; Set new HIGH$.
GETHI		LD	HL,(zHIGH$)		; P/u the value &
		RET				; ret with Z-flag.
GETHILO		INC	B			; Test for HIGH$/LOW$.
		DEC	B
		JR	Z,GETHI
		LD	HL,(zLOW$)		; P/u LOW$.
PUTLO		LD	(zLOW$),HL		; Get LOW$.
		XOR	A			; Set Z-flag.
		RET