	opt l-
	
	incdir ":include/"
	include "intuition/intuition_lib.i"
	include "intuition/intuition.i"
	include "exec/exec.i"
	include "exec/exec_lib.i"
	
	lea 	intname,a1
	moveq 	#0,d0
	CALLEXEC 	OpenLibrary
	move.l 	d0,_IntuitionBase

	CALLINT 	OpenWorkBench
	move.l 	d0,a0
	move.l 	sc_FirstWindow(a0),a0
	move.l	a0,a4
	
Loop	move.l	a4,a0
	move.l	wd_UserPort(a0),a0
	CALLEXEC	GetMsg
	tst.l	d0
	beq	ChiudiFinestra
	move.l	d0,a1
	CALLEXEC	ReplyMsg
	bra	Loop	
ChiudiFinestra
	CALLEXEC 	Forbid
	move.l	a4,a0
	CALLINT 	CloseWindow
	CALLEXEC 	Permit
	
	move.l 	_IntuitionBase,a1
	CALLEXEC 	CloseLibrary
	rts

intname INTNAME
_IntuitionBase	ds.l 1
