Category : Assembly Language Source Code
Archive   : ASM-SUBR.ZIP
Filename : MBINADD

 
Output of file : MBINADD contained in archive : ASM-SUBR.ZIP
;-------------------------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---------------------------+


  3 Responses to “Category : Assembly Language Source Code
Archive   : ASM-SUBR.ZIP
Filename : MBINADD

  1. Very nice! Thank you for this wonderful archive. I wonder why I found it only now. Long live the BBS file archives!

  2. This is so awesome! 😀 I’d be cool if you could download an entire archive of this at once, though.

  3. But one thing that puzzles me is the “mtswslnkmcjklsdlsbdmMICROSOFT” string. There is an article about it here. It is definitely worth a read: http://www.os2museum.com/wp/mtswslnk/