********************************************************************************
*
*	Program:	Open/Close intuition.library
*	Filename:	ItuLib.a
*
*	Contents:	Open/Close routine for intuition.library
*			(_IntuitionBase)
*
*	Language:	68000 Assembler
*
*	Author:		Johannes R. Geiss
*
*	Copyright:	Amigavisions
*
*	History:	$HISTORY:
*			2.2 (26-Oct-91) changed JRG
*			2.1 (15-Oct-91) changed JRG
*			2.0 (14-Oct-91) changed JRG
*			1.3 (10-Oct-91) changed JRG
*			1.2 (05-Oct-91) changed JRG
*			1.1 (02-Sep-91) changed JRG
*			1.0 (27-Jun-91) written JRG
*
*	Version:	$VER: ItuLib.a 2.2 (26-Oct-91)
*
********************************************************************************


*------ Equates
Version equ	33


*------ Includes
	include 'xref.i'
	include 'call.i'
	include 'exec/types.i'
	include 'libraries/dos.i'


*------ Imports
	XLIB	OpenLibrary
	XLIB	CloseLibrary
	xref	_SysBase


*------ Exports
	xdef	_IntuitionBase
	xdef	OpenItu
	xdef	CloseItu


********************************************************************************

	SECTION ItuLib

*------ OpenItu procedure
OpenItu movea.l #ILname,a1		; open ItuLib
	moveq.l #Version,d0
	LINKEXE OpenLibrary
	move.l	d0,_IntuitionBase
	beq.s	OpenErr
	moveq.l #RETURN_OK,d0
	rts
OpenErr moveq.l #ERROR_INVALID_RESIDENT_LIBRARY,d0
	rts

*------ CloseItu procedure
CloseItu
	move.l	_IntuitionBase,d0	; close ItuLib
	beq.s	NotOpen
	movea.l d0,a1
	LINKEXE CloseLibrary
	clr.l	_IntuitionBase
NotOpen rts


********************************************************************************

	section data,DATA

*------ Datafield
_IntuitionBase	dc.l	0
ILname		dc.b	'intuition.library',0
	END
