; Glue routines for arp.library and MANX/AZTEC 'C'
; Copyright (C) 1987, Scott Ballantyne
; Use at your own risk, etc., etc.
; May be freely used.

	INCLUDE "exec/execbase.i"
	INCLUDE "libraries/arpbase.i"
	INCLUDE "libraries/dosextens.i"

; Variables used by 'C' to access certain extra arplibrary returns

	dseg
	public	_ArpBase

	cseg

*-------------------------------------------------------------------------

	xdef	_ArpAllocMem

_ArpAllocMem:
	movem.l 4(sp),d0-d1
	pea	(a6)
	move.l	_ArpBase,a6
	jsr	-390(a6)
	move.l	(sp)+,a6
	bra	Check_Save

*-------------------------------------------------------------------------

	xdef	_ArpOpen

_ArpOpen:
	movem.l 4(sp),d1-d2
	pea	(a6)
	move.l	_ArpBase,a6
	jsr	-396(a6)
	move.l	(sp)+,a6
	bra	Check_Save

*-------------------------------------------------------------------------

	xdef	_ArpDupLock

_ArpDupLock:
	move.l	4(sp),d1
	pea	(a6)
	move.l	_ArpBase,a6
	jsr	-402(a6)
	move.l	(sp)+,a6
	bra	Check_Save

*-------------------------------------------------------------------------

	xdef	_ArpLock

_ArpLock:
	movem.l 4(sp),d1/d2
	pea	(a6)
	move.l	_ArpBase,a6
	jsr	-408(a6)
	move.l	(sp)+,a6
	bra	Check_Save

*-------------------------------------------------------------------------

	xdef	_ArpAlloc

_ArpAlloc:
	move.l	4(sp),d0
	pea	(a6)
	move.l	_ArpBase,a6
	jsr	-384(a6)
	move.l	(sp)+,a6
	bra	Check_Save

*-------------------------------------------------------------------------

	xdef	_RListAlloc

_RListAlloc:
	move.l	4(sp),a0
	move.l	8(sp),d0
	pea	(a6)
	move.l	_ArpBase,a6
	jsr	-414(a6)
	move.l	(sp)+,a6
	bra	Check_Save

*-------------------------------------------------------------------------

	xdef	_ArpOpenLibrary

_ArpOpenLibrary:
	move.l	4(sp),a1
	move.l	8(sp),d0
	pea	(a6)
	move.l	_ArpBase,a6
	jsr	-654(a6)
	move.l	(sp)+,a6
	bra	Check_Save

*-------------------------------------------------------------------------

	xdef	_ArpAllocFreq

_ArpAllocFreq:
	pea	(a6)
	move.l	_ArpBase,a6
	jsr	-660(a6)
	move.l	(sp)+,a6
	bra	Check_Save

*-------------------------------------------------------------------------

	xdef	_GetTracker

_GetTracker:
	pea	(a6)
	move.l	_ArpBase,a6
	jsr	-486(a6)
	move.l	(sp)+,a6

	tst.l	d0
	beq	1$		; No tracker, ERROR!

	move.l	4(sp),d1
	move.w	d1,dt_ID(a1)	; Save ID  (It was LONG)

1$	move.l	a1,d0		; Put into return register
	bra	Save_Second	; Also save it...

Check_Save:
	tst.l	d0		; Check for return error...
	beq	Exit_Fail	; If error, skip setting...

Save_Second:
	move.l	(4).w,a0	; This used to be _SysBase absolutely
				; referenced. -olsen
	move.l	ThisTask(a0),a0
	move.l	a1,pr_Result2(a0)

Exit_Fail:
	rts

	END
