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

; This is a REALLY handly macro, that allows you to pop up messages at debugging
;points in your code. This was necessary to allow working on a multithreaded
; program, since you don't have a way of tracing the new threads.

; If you don't define 'Debug', then this macro assembles to nothing, otherwise
;you get the requester.
;
; If you wish to display multiple paramters, simply push them on the stack
;IN REVERSE ORDER of how you wish to display them, then put the stack pointer in
;A1

; To use this macro, you MUST link with lreqglue.o or areqglue.o.
;

;	MOVE.L	Val2,-(SP)
;	MOVE.W	Val1,-(SP)
;	MOVE.L	String,-(SP)
;	MOVE.L	SP,A1
;	showf	<%s is a string, Val1: %d is a word, Val2: %ld is a long.> 
;	LEA	10(SP),SP

showf	MACRO
	IFD	Debug

	IFD	.A68K
	MOVEM.L	D0-A6,-(SP)
	LEA	\\@showftext,A0
	CALL	SimpleRequest
	BRA	\\@around

\\@showftext	DC.B	"\1",0
	EVEN
\\@around
	MOVEM.L	(SP)+,D0-A6
	ENDC

	IFND	.A68K
	MOVEM.L	D0-A6,-(SP)
	LEA	\@showftext,A0
	CALL	SimpleRequest
	BRA	\@around

\@showftext	DC.B	"\1",0
	EVEN
\@around
	MOVEM.L	(SP)+,D0-A6
	ENDC

	ENDC
	ENDM

; The reason for two definitions is the difference between A68K (the PD
;assembler),which allows named local labels, and the Aztec assembler which
;doesn't.
; If you have a local label, and then this macro, and then a reference to that
;local variable, then under the Aztec version you would get an error, because
;the showf version (under Aztec) uses GLOBAL labels, which break up locals.
; That means that if you wish to use this macro while under Aztec, you can't use
;local labels in the same function.

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

CALL	MACRO
	public	\1
	JSR	\1
	ENDM

LOADLIB	MACRO
	MOVE.L	_\1Base,A6
	ENDM

SYS	MACRO
	XREF	_LVO\1
	JSR	_LVO\1(A6)
	ENDM

PUSH	MACRO
	MOVEM.L	\1,-(SP)
	ENDM

PULL	MACRO
	MOVEM.L	(SP)+,\1
	ENDM

AllRegs	REG	D0-A6

