;;; libface.c
;
;   DESCRIPTION:
;   ===========
;
;	This is the skeleton for an Amiga Exec library.
;	This version is written for Aztec C. It is based on the example
;	library by Jim Mackraz who got some stuff from Neil Katin.
;	This library implements a protocol transfer library.
;	All changes and additions by me.
;
;   AUTHOR/DATE:  W.G.J. Langeveld, February 1989.
;   ============
;
;;;

	include	'exec/types.i'

setup	macro
	movem.l	d2/d3/d4-d7/a2-a6,-(sp)
	jsr	_geta4			;set up a4 for small model
	endm

push	macro
	move.l	\1,-(sp)
	endm

fix	macro
	ifc	'\1',''
		mexit
	endc
	ifle	\1-8
		addq.l	#\1,sp
	endc
	ifgt	\1-8
		lea	\1(sp),sp
	endc
	endm

restore	macro
	fix	\1
	movem.l	(sp)+,d2/d3/d4-d7/a2-a6	
	rts
	endm

	dseg

	public	_libfunctab
_libfunctab:
	dc.l	XPRopen
	dc.l	XPRclose
	dc.l	XPRexpunge
	dc.l	$0000
        dc.l	XPRXProtocolCleanup
        dc.l	XPRXProtocolSetup
        dc.l	XPRXProtocolSend
        dc.l	XPRXProtocolReceive
;        dc.l	XPRXProtocolHostMon
;        dc.l	XPRXProtocolUserMon
	dc.l	$ffffffff

	cseg

	;--- library functions
	public	_XPROpen
	public	_XPRClose
	public	_XPRExpunge
        public  _XProtocolCleanup
        public  _XProtocolSetup
        public  _XProtocolSend
        public  _XProtocolReceive
;        public  _XProtocolHostMon
;        public  _XProtocolUserMon

	public	_geta4

XPRopen:
	setup
	push a6
	jsr	_XPROpen
	restore	4

XPRclose:
	setup
	push a6
	jsr	_XPRClose
	restore 4

XPRexpunge:
	setup
	push a6
	jsr	_XPRExpunge
	restore 4

XPRXProtocolCleanup:
	setup
	push a0
	jsr	_XProtocolCleanup
	restore 4

XPRXProtocolSetup:
	setup
	push a0
	jsr	_XProtocolSetup
	restore 4

XPRXProtocolSend:
	setup
	push a0
	jsr	_XProtocolSend
	restore 4

XPRXProtocolReceive:
	setup
	push a0
	jsr	_XProtocolReceive
	restore 4

;XPRXProtocolHostMon:
;	setup
;	push d1
;	push d0
;	push a1
;	push a0
;	jsr	_XProtocolHostMon
;	restore 16

;XPRXProtocolUserMon:
;	setup
;	push d1
;	push d0
;	push a1
;	push a0
;	jsr	_XProtocolUserMon
;	restore 16


	end
