***
***	$VER: Colors.s 1.0 (26.3.94)
***
***	Created by Lauri Aalto (kilroy@tolsun.oulu.fi), Public Domain.
***

		include	libraries/exec_lib.i
		include	libraries/reqtools_lib.i
		include	exec/execbase.i
		include	dos/dosextens.i
		include	libraries/reqtools.i
		include	intuition/intuitionbase.i
		include	macros.i

;---------------------------------------------------------------------------

		section	TEXT,code

start		clear	d7			; clear wbmsg reg
		cleara	a1
		move.l	(absexecbase).w,a6
		flib	FindTask		; could use ThisTask(a6), but
		move.l	d0,a2			;  we won't
		tst.l	(pr_CLI,a2)		; run from cli?
		bne.b	cli

		lea	(pr_MsgPort,a2),a2	; no - let's catch the wbmsg
		move.l	a2,a0
		flib	WaitPort
		move.l	a2,a0
		flib	GetMsg
		move.l	d0,d7			; and store it for later use

cli		lea	(intname,pc),a1		; reqtoolsbase contains also
		clear	d0			;  an intuition base pointer,
		flib	OpenLibrary		;  but it's illegal to share
		tst.l	d0			;  library pointers other than
		beq.b	exit			;  exec's with tasks or
		move.l	d0,a5			;  processes...

		lea	(reqname,pc),a1		; open reqtools library
		clear	d0
		flib	OpenLibrary
		tst.l	d0
		beq.b	cint
		move.l	d0,a6

		link	a4,#-12			; allocate mem for taglist
		lea	(-12,a4),a4

		move.l	#RT_Screen,(a4)+	; RT_Screen tag into taglist
		move.l	(ib_FirstScreen,a5),(a4)+ ; topmost scrptr to taglist
		clr.l	(a4)+			; TAG_DONE

		lea	(title,pc),a2		; window title
		cleara	a3			; no req struct
		lea	(-12,a4),a0		; tag list
		flib	rtPaletteRequestA

		unlk	a4			; free taglist

creq		move.l	a6,a1			; close reqtools
		move.l	(absexecbase).w,a6
		flib	CloseLibrary

cint		move.l	a5,a1			; close intuition
		flib	CloseLibrary

exit		tst.l	d7			; test for wbmsg
		beq.b	.exit
		move.l	d7,a1
		flib	ReplyMsg

.exit		clear	d0
		rts

versionstring	dc.b	0,'$VER: '
title		dc.b	'Colors 1.0 (26.3.94)',0
intname		dc.b	'intuition.library',0
reqname		REQTOOLSNAME

