[comp.sys.mac.programmer] Inline assembly code in Think C 4.0

jyp@wucs1.wustl.edu (Jerome Yvon Plun) (07/27/90)

Think C manual states that the Toolbox functions not in ROM can not be used
in inline assembly code.   
Is there any way to use those routines using a different calling scheme than
the Trap name?

Jerome 

siegel@endor.harvard.edu (Rich Siegel) (07/27/90)

In article <1990Jul26.204548.8163@cec1.wustl.edu> jyp@wucs1.wustl.edu (Jerome Yvon Plun) writes:
>Think C manual states that the Toolbox functions not in ROM can not be used
>in inline assembly code.   

	That's an error in the doc; in fact, you can call any external routine
from within inline assembler code, including Toolbox routines which are
marked [Not in ROM]. To do so, just place an external reference in the
function in which you call the desired routine, push the arguments, 
and call the function:

void f( )
{
	extern pascal Boolean LClick();


	asm {
		clr.b	-(a7)		; space for result
		move.l	p, -(a7)	; a point
		move.w	m, -(a7)	; a word
		move.l	l, -(a7)	; a ListHandle
		jsr	LClick		; call it
		move.b	(a7)+, d7	; pop the result
	}
}


R.



~~~~~~~~~~~~~~~
 Rich Siegel
 Staff Software Developer
 Symantec Corporation, Language Products Group
 Internet: siegel@endor.harvard.edu
 UUCP: ..harvard!endor!siegel

"I have been known, on occasion, to howl at the moon."

~~~~~~~~~~~~~~~