/ 
/ Long multiply.
/ 

	.globl	mul_l
	.globl	mul_li

/ 
/ long mul_li(a, b);
/ long a; int b;
/ Long multiplication op.
/ 

mul_li:	jsr	r0,__csav	/ Linkage
	clr	-(sp)		/ Clear sign flag
	clr	r2		/ Clear high order part
	mov	16(r5),r3	/ Get multiplicand
	bpl	1f		/ Skip compliments if positive
	neg	r3		/ Make pos.
	br	0f		/ Go flip flag !

/ 
/ long mul_l(a, b);
/ long a; long b;
/ Long multiplication op.
/ 

mul_l:	jsr	r0,__csav	/ Linkage
	clr	-(sp)		/ Clear sign flag
	mov	20(r5),r3	/ Get multiplicand lord
	mov	16(r5),r2	/ Get multiplicand hord
	bpl	1f		/ Br if pos.
	neg	r2		/ Negate.
	neg	r3
	sbc	r2
0:	com	(sp)		/ Flip flag.

1:	tst	12(r5)		/ Multiplier pos. ?
	bpl	0f		/ Yes !
	neg	12(r5)		/ Negate multiplier.
	neg	14(r5)
	sbc	12(r5)
	com	(sp)		/ Flip flag.

0:	mov	$32.,r4		/ Initialize bitcount
	clr	r0		/ Clear product
	clr	r1

1:	asl	r1		/ Double product
	rol	r0

	asl	r3		/ Shift multiplicand left (d.p.)
	rol	r2
	bcc	0f		/ If msb was set then
	add	14(r5),r1	/ Add multiplier to product
	adc	r0
	add	12(r5),r0

0:	dec	r4		/ Do all 32 bits.
	bne	1b

	tst	(sp)+		/ Recomplement if necessary.
	beq	0f
	neg	r0
	neg	r1
	sbc	r0

0:	jmp	__cret
