mult:				; unsigned sixteen bit integer multiply.
;
; on entrance:	multiplier in de.
;		multiplicand in hl.
;
; on exit: result in hl.
;
; register uses:
;
;
;	h	high order partial result
;	l	low order partial result
;	d	high order multiplicand
;	e	low order multiplicand
;	b	counter for number of shifts
;	c	high order bits of multiplier
;	a	low order bits of multiplier
;
	ld	b,16		; number of bits- initialize
	ld	c,d		; move multiplier
	ld	a,e		;
	ld	x,y		; should get 'u' error
	load	a,b		; should get 'o' error
	cp	'A'		; test 'x' format
	ex	de,hl		; move multiplicand
	ld	hl,0		; clear partial result
	eject			; test eject processing
;
mloop:	srl	c		; shift multiplier right
	rra			; least significant bit is in carry
	jr	nc,noadd-$	; if no carry skip the add
	add	hl,de		; else add multiplicand to partial result
;
noadd:	ex	de,hl		; shift multiplicand left
	add	hl,hl		; by multiplying it by two
	ex	de,hl
	djnz	mloop-$		; repeat until no more bits
	ret
;
	end
