; User Function Skeleton
; How to make a call to a subroutine at a specified address
	
	stl #a

	;set up pseudo call stack, as if generated with a 'call' instruction
	ajw	-4		; Create return address
	ldc	#26		; This is set up to return to SubReturn below
	ldpi			;   however may need adjustment if code is 
	stl	#0		;   inserted below changing the offset
	
	ldc	#40000000	; AReg
	stl	#1
	
	ldc	#1		; BReg
	stl	#2
	
	ldc	#7ff80000	; CReg
	stl	#3
	
	ldc	#0fffffff	; init
	stl	#4		;  in subroutine will start as local #0
	
	ldc	#8000062F	; Load address of subroutine and do a general call
	gcall
	
	;
	;
SubReturn:
	ldl #a
	gcall

SubRoutine:
	ldc	#a5a5
	stl	#4		; On return will be lcl#0
	ret
		
	