*
* Macros for SANE glue code in saneglue.asm
*
* Written in 1997 by Soenke Behrens.
* This code is hereby placed into the Public Domain.
*

*
* phptr - push a pointer to a variable on the DP
* of a function as DP+offset: Pointer is valid
* even if DP is changed.
* 

	macro
&lab	phptr	&n1
&lab	pea	$0
	tdc
	clc
	adc	#&n1
	pha
	mend

*
* copyx - copy an 'extended' variable to another
*

	macro
&lab	copyx	&n1,&n2
&lab	lda	&n1
	sta	&n2
	lda	&n1+2
	sta	&n2+2
	lda	&n1+4
	sta	&n2+4
	lda	&n1+6
	sta	&n2+6
	lda	&n1+8
	sta	&n2+8
	mend

*
* sterr - store returned error code in _toolErr
* Must be used _immediately_ after tool call because
* it relies on carry flag being set and A containing
* the error code (if any).
*

	macro
&lab	sterr
&lab	bcs	~&SYSCNT
	lda	#0
~&SYSCNT sta	_toolErr
	mend

* End Of File
