



; 	metrowerks sample code



	section		rtlib
	org p:
 	
	global Fasmtorqueestimated

	SUBROUTINE "Fasmtorqueestimated",Fasmtorqueestimated,FasmtorqueestimatedEND-Fasmtorqueestimated

 Fasmtorqueestimated:
 
 		move.w		X:(R2)+,y0				;save the first parameter (i_s[0]) to the register y0
 		move.w		X:(R2)+,y1				;save the second parameter (i_s[1]) to the register y1
		move.w		X:(R2)+,B1				;save the third parameter (Psi_s[0]) to the register B1
		neg			y0						;negate the first parameter (-i_s[0])
		mpy			y1,B1,A		X:(R2)+,x0	;multiply the parameters (i_s[1]*Psi_s[0]) store the result in the register A and one parallel move (save the fourth parameter (Psi_s[1]) to the register x0) and post-increment the address register R2 by one 	
		mac			y0,x0,A					;multiply the parameters (-i_s[0]*Psi_s[1]) and add the result to the register A
		rts									;return from a call to a subroutine		
		 	
 FasmtorqueestimatedEND:
 
 	endsec
 	
	end
