
* the PJCO library example.
* this library is called "test" and shows you how to create a simple
* library.

	opt	l+,c+,p+	* Linkable files, case sensitive labels
				* position indepentant code checking
				
	include	LIBRARY.H	* include our bits 'n' bobs
	
	library TEST		* define name of library
	
	XREF	get_string	* this lot is needed when getting/returning
	XREF	get_array	* creating strings and getting arrays.
	XREF	make_string
	XREF.L	gl_scratch
	
	XDEF	mytest1		* the name of our first command.
	XDEF	mytest2		* "    "   "   "  second    "
	XDEF	mytest3		* and so on
		
	subdef	lng,lng,int,lng	* mytest1 is a sub, inputs two longs, 
				* int and long
	fn_int	vlng,aint	* mytest2 is a function which returns
				* a int, the first input is a long, but
				* HBASIC will pass it as an address to this.
				* Also, an array of ints is needed.
	fn_int_np		* mytest3 is a function which returns
				* a int, but with no parameters.
				
mytest1		move.l	4(sp),a0	* lng1 at 4(sp).l
		move.l	8(sp),a1	*    2 at 8(sp).l
		move.w	12(sp),d0	* int  at 12(sp).w
		move.l	14(sp),a2	* lng3 at 14(sp).l
		
*		<code in here>

		RTS
		
mytest2		move.l	4(sp),a1	* address of variable
		move.l	#1,(a1)		* put number 1 into it
		
		move.l	8(sp),a0	* address of ints
		move.w	#1,d0		* 1 dimension
		
		bsr	get_array	* checks array for us
					* a2.l now is the address of first
					* element
					* d4.l is total length in bytes

		move.l	#2,tos		* return value 2

		RTS
				
mytest3		
		* this could be used as an initialisation code, or a 
		* global access point...
		
		RTS