;-------------------------mbinadd routine begins--------------------------+
; from BLUEBOOK OF ASSEMBLY ROUTINES FOR IBM PC & XT.
;         page : 116
;
; NAME  MBINADD
;
; ROUTINE FOR Multidigit Binary Addition
;
; FUNCTION: This routine adds two multidigit binary numbers.
;
; INPUT: Upon entry DS:SI points to the first number; DS:DI points to
; the second number, and DS:BX points to the location where the result
; will be stored.  The size of these multidigit numbers is controlled
; by the constant ISIZE.  All three numbers contain 16*ISIZE number of
; bits and are stored in ISIZE number of 16-bit words of memory.
;
; OUTPUT: Upon exit DS:BX points to where the result is stored.
;
; REGISTERS USED:  No registers are modified.
;
; SEGMENTS REFERENCED:  Upon entry the data segment must contain
; storage for three multidigit numbers; two for input and one for output.
;
; ROUTINES CALLED:  None
;
; SPECIAL NOTES: None
;
; ROUTINE TO ADD MULTIDIGIT BINARY NUMBERS
;
mbinadd	proc	far
;
	push	si		; save registers
	push	di
	push	bx
	push	cx
	push	ax
;
	mov	cx,isize	; get the number of 16-bit 'digits'
	clc			; clear the carry in
;
mbinadd1:
	mov	ax,[si]		; get 'digit'' from 1st number
	inc	si		; point to next number
	inc	si
	adc	ax,[di]		; add 'digit' from 2nd number
	inc	di		; point to next 'digit'
	inc	di
	mov	[bx],ax		; move resulting digit into place
	inc	bx		; point to next free 'digit' place
	inc	bx
	loop	mbinadd1	; loop through all the 'digits'
;
	pop	ax		; restore registers
	pop	cx
	pop	bx
	pop	di
	pop	si
	ret
;
	ret			; return
;
mbinadd	endp
;-------------------------mbinadd routine ends---------------------------+
