; DLSUtila.asm -- Alto DLS driver, assembly-language portion

; Last modified August 12, 1983  9:57 AM by Diebert

.ent UDiv

.srel

UDiv: .UDiv

.nrel
; UDiv(lvDividend, divisior, lvRemainder) = quotient

.UDiv:	sta 3 1 2
	sta 1 2 2	;save divisor
	mov 0 3		;lvDividend
	lda 0 0 3	;get dividend in to ac0 and ac1
	lda 1 1 3
	mov 2 3		;reserve stack pointer
	lda 2 2 3	;get divisor
	div
	 #77400
	mov 3 2		;restore sp
	sta 0 @3 2	;remainder
	mov 1 0		;return quotient
	lda 3 1 2
	jmp 1 3


	.end