www.pudn.com > iccavr_lib.rar > emul16s.s, change:2003-11-08,size:465b


; 16 bit multiply 
; using enhanced core MUL instructions 
; 
; 
; input:  R16/R17, R18/R19 
; output: R16/R17 
 
	.define iLo	R16 
	.define iHi R17 
	.define dLo R18 
	.define dHi R19 
	.define rLo R24 
	.define rHi R25 
 
	.text 
empy16s:: 
	st -Y,R0 
	st -Y,R1 
	st -Y,rLo 
	st -Y,rHi 
 
	mul iLo,dLo 
	movw rLo,R0		; also rHi <-- R1 
	mul iHi,dLo 
	add rHi,R0 
	mul iLo,dHi 
	add rHi,R0 
 
	movw R16,rLo 
 
	ld rHi,Y+ 
	ld rLo,Y+ 
	ld R1,Y+ 
	ld R0,Y+ 
 
	ret