This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

division

div_Q15:

							; AR0 - in 
							; AR2 - div
							; AR6 - heap   
							; AR6 - out 1 var
	clrc	SXM			
	CLRC	OVM
;
	LAR		AR6,#heap1
	MAR		*,AR0
	lacc	*,16,AR2
	ABS	
	rpt		#14
	subc	*	   		; ACCH = Rem', ACCL = QuotH

	NOP
	NOP
	
	MAR		*,AR6
	sacl	*
	xor		*+,AR2			; ACCH = Rem', ACCL = 0
	or		#0FFFFh			; ACCH = Rem', ACCL = NumL
	rpt		#15	
	subc	*  		; ACCH = Rem , ACCL = QuotL
	NOP
	NOP
	MAR		*,AR6
	sacl	*
	LACC	*-
	ADDH	*

	SACH	*,AR0
	
	LACC	*,16,AR6
	BCND	done_div,GEQ
	LACC	*,16
	NEG          

Hello! why are there two times the command is executed subc? maybe there are errors...