*************************************************************************
*
*	Copyright (C) 1985, Commodore Amiga Inc.  All rights reserved.
*	Permission granted for non-commercial use
*
* asmsupp.i -- random low level assembly support routines
*
*************************************************************************

CLEAR	MACRO		;quick way to clear a D register on 68000
	MOVEQ	#0,\1
	ENDM

;BHS	 MACRO
;	 BCC.\0  \1 ;\0 is the extension used on the macro (such as ".s")
;	 ENDM
;BLO	 MACRO
;	 BCS.\0  \1
;	 ENDM

EVEN	MACRO		; word align code stream
	DS.W	0
	ENDM

LINKSYS MACRO		; link to a library without having to see a _LVO
	MOVE.L	A6,-(SP)
	MOVE.L	\2,A6
	JSR	_LVO\1(A6)
	MOVE.L	(SP)+,A6
	ENDM

CALLSYS MACRO		; call a library via A6 without having to see _LVO
	JSR	_LVO\1(A6)
	ENDM

XLIB	MACRO		; define a library reference without the _LVO
	XREF	_LVO\1
	ENDM
;
; Put a message to the serial port at 9600 baud.  Used as so:
;
;     PUTMSG   <'Init: called'>
;
		XREF	DPutStr

PUTMSG: 	MACRO	* level,msg

	IFD DEBUG
		MOVEM.L A0-A1/D0-D1,-(SP)
		LEA	msg\@,A0	;Point to static format string
		JSR	DPutStr
		MOVEM.L (SP)+,A0-A1/D0-D1
		BRA.S	end\@

msg\@		DC.B	\1
		DC.B	10
		DC.B	0
		DS.W	0
end\@

	ENDC
		ENDM

;
; Put a message to the serial port at 9600 baud.  Used as so:
;
;     NS_PUTMSG   <'Init: called'>
;
;	Uses NO stack, but trashes a0,a1,d0,d1
;
		XREF	DPutStr

NS_PUTMSG: 	MACRO	* level,msg

	IFD DEBUG
		LEA	msg\@,A0	;Point to static format string

a1\@:		MOVE.B	(A0)+,D0
		BEQ.S	end\@
a3\@:	MOVE.B	$BFD000,D1
		BTST		#0,D1
		BNE.S	a3\@
		MOVE.B	#$FF,$BFE301
		MOVE.B	D0,$BFE101

		BRA.S	a1\@

msg\@:	DC.B	\1
		DC.B	10
		DC.B	0
		DS.W	0
end\@:

	ENDC
		ENDM

