* Finished AUI Example Code - written by Paul Overaa

LINKLIB 	MACRO
		move.l	a6,-(a7)
		move.l	\2,a6
		jsr		\1(a6)
		move.l	(a7)+,a6
		ENDM
CALLSYS 	MACRO
		LINKLIB _LVO\1,\2
		ENDM
TRUE				EQU	1
NULL 				EQU	0
DOS_VERSION			EQU	0
INTUITION_VERSION		EQU	36
SECONDS				EQU	50
TIME_DELAY			EQU	10*SECONDS
TAG_DONE			EQU	0
WA_BASE				EQU 	$80000063
WA_Left				EQU	WA_BASE+$01
WA_Top				EQU	WA_BASE+$02
WA_Width			EQU	WA_BASE+$03
WA_Height			EQU	WA_BASE+$04
WA_Title			EQU	WA_BASE+$0B
WA_DragBar			EQU	WA_BASE+$1F
WA_PubScreen			EQU	WA_BASE+$16
_AbsExecBase			EQU	4
_LVOOpenLibrary 		EQU 	-552
_LVOCloseLibrary 		EQU	-414
_LVOLockPubScreen		EQU	-510
_LVOUnlockPubScreen		EQU 	-516
_LVOOpenWindowTagList		EQU 	-606
_LVOCloseWindow			EQU 	-72
_LVODelay			EQU  	-198

_main		lea		dos_name,a1			load pointer to library name
		moveq		#DOS_VERSION,d0		any version will do!
open_dos	CALLSYS 	OpenLibrary,_AbsExecBase
		move.l	d0,_DOSBase			save returned pointer
		beq		exit				check open OK?
open_int	lea		intuition_name,a1		load pointer to library name
		moveq		#INTUITION_VERSION,d0	specify mimimum lib version
		CALLSYS 	OpenLibrary,_AbsExecBase
		move.l	d0,_IntuitionBase		save returned pointer
		beq		close_dos			check open OK?
lock_screen	lea		workbench_name,a0		pointer to screen name
		CALLSYS	LockPubScreen,_IntuitionBase
		move.l	d0,workbench_p		save returned pointer
		beq		close_int			check  return value?
open_window	move.l	#NULL,a0
		lea		tags,a1			our tag list
		CALLSYS	OpenWindowTagList,_IntuitionBase
		move.l	d0,window_p			pointer to our window
		beq		unlk_screen
		move.l	#TIME_DELAY,d1
		CALLSYS	Delay,_DOSBase
		move.l	window_p,a0			window to close
		CALLSYS	CloseWindow,_IntuitionBase
unlk_screen	move.l	#NULL,a0			screen name not needed
		move.l	workbench_p,a1		screen to unlock
		CALLSYS	UnlockPubScreen,_IntuitionBase
close_int	move.l	_IntuitionBase,a1		library to close
		CALLSYS 	CloseLibrary,_AbsExecBase
close_dos	move.l	_DOSBase,a1			library to close
		CALLSYS 	CloseLibrary,_AbsExecBase
exit		clr.l		d0
		rts						logical end of program
_DOSBase		ds.l	1
_IntuitionBase	ds.l	1
window_p		ds.l	1
tags			dc.l	WA_PubScreen
workbench_p		ds.l	1
			dc.l	WA_Left,100
			dc.l	WA_Top,50
			dc.l	WA_Width,440
			dc.l	WA_Height,100
			dc.l	WA_DragBar,TRUE
			dc.l	WA_Title,window_name
			dc.l	TAG_DONE,NULL
dos_name 		dc.b 	'dos.library',NULL
intuition_name	dc.b	'intuition.library',NULL
workbench_name	dc.b	'Workbench',NULL

window_name		dc.b	'AUI RULES OK!',NULL


