
			;   autoinit if you ever reference DiceCache.library
			;
			;   (c)Copyright 1990, Matthew Dillon, All Rights Reserved
			;
			;   can't use pc-relative between different code sections
			;   and cannot put string in autoinit section!
			;
			;   As with the ARexx support, this does not abort
			;   if the library cannot be found.  Furthermore,
			;   this routine only opens the library if it
			;   already exists (i.e. cache explicitly turned on)

			xdef	_DiceCacheBase
			xref	__AutoFail0

_LVOOpenLibrary 	equ	-552
_LVOCloseLibrary	equ	-414
_LVOFindName		equ	-276
LibListOffset		equ	378

			section autoinit0,code

			lea	LibListOffset(A6),A0    ; LibList
			lea	dcname(pc),A1           ; library name
			jsr	_LVOFindName(A6)
			tst.l	D0
			beq	i10
			lea	dcname(pc),A1           ; library name
			moveq.l #0,D0
			jsr	_LVOOpenLibrary(A6)
			move.l	D0,_DiceCacheBase(A4)
			bra	i10
dcname			dc.b	'dicecache.library',0
			ds.w	0
i10

			section autoexit0,code

			move.l	_DiceCacheBase(A4),D0
			beq	l10
			move.l	D0,A1
			jsr	_LVOCloseLibrary(A6)
l10

			section libbss,bss

_DiceCacheBase		ds.l	1

			END

