			SUBTITLE    "< DIVIDE >"
			scope

; 2022-09-16 Update V 6.3.1 dpm
			
;		Divide HL by A - SVC 94
;		HL => dividend
;		A  => divisor
;		HL <= resulting quotient
;		A  <= remainder


zDIV16			PUSH		DE		;Save this reg pair
			LD		D,A		;Xfer divisor to D
			LD		E,16		;Init for 16-bits
			XOR		A
$?1			ADD		HL,HL		;Rotate dividend
			RLA				;& subtract divisor if
			JR		C,$?2		;carry into bit-16
			CP		D		;Compare divisor
			JR		C,$?3		;Go if no subtract
$?2			SUB		D		;else subtract divisor
			INC		L		;Set lo-order
$?3			DEC		E		;Count down one bit
			JR		NZ,$?1		;Loop for 16-bits
			POP		DE
			RET