ClearDMRequest	macro
		addrin	\1,a0	;windowl
		move.l	_IntuitionBase(a4),a6
		jsr	-48(a6)		;_LVOClearDMRequest(a6)
		endm

ClearMenuStrip	macro
		addrin	\1,a0	;windowl
		move.l	_IntuitionBase(a4),a6
		jsr	-54(a6)		;_LVOClearMenuStrip(a6)
		endm

ClearPointer	macro
		addrin	\1,a0	;windowl
		move.l	_IntuitionBase(a4),a6
		jsr	-60(a6)		;_LVOClearPointer(a6)
		endm

closescreen	macro
scrcl		set	1
		addrin	\1,d0
		beq	1345$
		move.l	d0,a0
		move.l	_IntuitionBase(a4),a6
		jsr	-66(a6)		;_LVOCloseScreen(a6)
1345$
		endm

closewindow	macro
		addrin	\1,d0
		beq	1346$
		move.l	d0,a0
		move.l	_IntuitionBase(a4),a6
		jsr	-72(a6)		;_LVOCloseWindow(a6)
1346$
		endm

DrawBorder	macro
		addrin	\1,a0
		addrin	\2,a1
		varin	\3,d0
		varin	\4,d1
		move.l	_IntuitionBase(a4),a6
		jsr	-108(a6)	;_LVODrawBorder(a6)
		endm

DrawImage	macro
		addrin	\1,a0		;rport
		addrin	\2,a1		;border
		varin	\3,d0		;LeftOff
		varin	\4,d1		;TopOff
		move.l	_IntuitionBase(a4),a6
		jsr	-114(a6)	;_LVODrawImage
		endm

EndRequest	macro
		addrin	\1,a0		;address of request
		addrin	\2,a1		;addres of window
		move.l	_IntuitionBase(a4),a6
		jsr	-120(a6)	;_LVOEndRequest(a6)
		endm

InitRequest	macro
		addrin	\1,a0		;request
		move.l	_IntuitionBase(a4),a6
		jsr	-138(a6)	;InitRequest
		endm

ModifyIDCMP	macro
		addrin	\1,a0		;window
		varin	\2,d0		;flags
		move.l	_IntuitionBase(a4),a6
		jsr	-150(a6)	;_LVOModifyIDCMP
		endm

openscreen	macro
		lea	\1-database(a5),a0
		move.l	_IntuitionBase(a4),a6
		jsr	-198(a6)	;_LVOOpenScreen(a6)
		endm

openwindow	macro
		lea	\1-database(a5),a0
		move.l	_IntuitionBase(a4),a6
		jsr	-204(a6)	;_LVOOpenWindow(a6)
		endm

Request		macro
		addrin	\1,a0		;address of request
		move.l	\2(a4),a1		;addres of window
		move.l	_IntuitionBase(a4),a6
		jsr	-240(a6)	;_LVORequest(a6)
		endm

SetMenuStrip	macro
		addrin	\1,a0			;windowl
		lea	\2-database(a5),a1	;pointer to menu structure
		move.l	_IntuitionBase(a4),a6
		jsr	-264(a6)		;_LVOSetMenuStrip(a6)
		endm

SetWindowTitles	macro
		move.l	a2,-(sp)
		addrin	\1,a0		;window
		addrin	\2,a1		;address of windowtitle
		addrin	\3,a2		;address of screentitle
		move.l	_IntuitionBase(a4),a6
		jsr	-276(a6)	;_LVOSetWindowTitles(a6)
		move.l	(sp)+,a2
		endm

ViewAddress	macro
		move.l	_IntuitionBase(a4),a6
		jsr	-294(a6)	;_LVOViewAddress(a6)
		endm

AutoRequest	macro
		movem.l	d2/d3/a2/a3/a6,-(sp)
		addrin	\1,a0			;window structure
		lea	\2-database(a5),a1	;overtext structure
		lea	\3-database(a5),a2	;lefttext structure
		lea	\4-database(a5),a3	;righttext structure
		varin	\5,d0			;flags for lefth
		varin 	\6,d1			;flags for right
		varin	\7,d2			;the width of the requester
		varin	\8,d3			;the height of the requester
		move.l	_IntuitionBase(a4),a6
		jsr	-348(a6)		;_LVOAutoRequest(a6)
		movem.l	(sp)+,d2/d3/a2/a3/a6
		endm

RefreshGList	macro
		move.l	a2,-(sp)
		addrin	\1,a0			;address of gadget
		addrin	\2,a1		;addres of window
		addrin	\3,a2		;address of the gadget
		ifc	'\3','0'
		sub.l	a2,a2
		endc	
		varin	\4,d0			;number
		move.l	_IntuitionBase(a4),a6
		jsr	-432(a6)	;_LVORefreshGList(a6)
		move.l	(sp)+,a2
		endm

GetIntuiMsg	macro		;a0 windowbase
		addrin	\1,a0
		jsr	clickwindowcd(pc)
		ifnd	Clickwindowid
		bra	clickwindowover
clickwindowcd	movem.l	d2-d4/a4-a6,-(sp)
initclose	move.l	a0,d0		;window
		beq	errorghj		;no window
		move.l	a0,a5
		move.l	_IntuitionBase(a4),a6
		jsr	-456(a6)	;_LVORefreshWindowFrame(a6)

checkclose	move.l	4,a6			;execbase
		move.l	$56(a5),a0		;wd_UserPort get message
		jsr	-384(a6)		;_LVOWaitPort(a6)
		move.l	$56(a5),a0
		jsr	-372(a6)		;_LVOGetMsg(a6)
		move.l	d0,a1			;pointer
		move.l	20(a1),d2		;message class
		move.w	24(a1),d3		;message code
		jsr	-378(a6)		;_LVOReplyMsg(a6)
		cmpi.l	#$00000200,d2		;CLOSEWINDOW is correct
		beq	clswindwp
		cmp.w	#MENUPICK,d2
		bne	checkclose
		cmp.w	#MENUNULL,d3
		beq	checkclose
		moveq	#0,d0
		move.w	d3,d0		
		bra	errorghj
clswindwp	moveq	#-1,d0
errorghj	movem.l	(sp)+,d2-d4/a4-a6
		rts
Clickwindowid	set	1
clickwindowover
		endc
		endm

WaitIntuiMsg	macro
		addrin	\1,a0		;userport
		moveq	#0,d0			;bitmask
		move.b	15(a0),d1		;MP_SIGBIT
		bset	d1,d0			;do bitmask
		move.l	4,a6
		jsr	-318(a6)	;_LVOWait(a6)		;wait signal
		endm	

MENUNUM		macro
		varin	\1,d0
		and.l	#$1f,d0			;mask menunum
		endm

ITEMNUM		macro
		varin	\1,d0
		asr.l	#5,d0
		and.l	#$3f,d0
		endm

SUBNUM		macro
		varin	\1,d0
		asr.l	#8,d0
		asr.l	#3,d0
		and.l	#$1f,d0
		endm