Category : Assembly Language Source Code
Archive   : ASM_SUBR.ZIP
Filename : MBINSUB

 
Output of file : MBINSUB contained in archive : ASM_SUBR.ZIP
;-------------------------mbinsub routine begins--------------------------+
; from BLUEBOOK OF ASSEMBLY ROUTINES FOR IBM PC & XT.
; page : 118
;
; NAME MBINSUB
;
; ROUTINE FOR Multidigit Binary Subtraction
;
; FUNCTION: This routine subtracts 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 SUBTRACT MULTIDIGIT BINARY NUMBERS
;
mbinsub 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
;
mbinsub1:
mov ax,[si] ; get 'digit'' from 1st number
inc si ; point to next number
inc si
sbb ax,[di] ; sub '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 mbinsub1 ; loop through all the 'digits'
;
pop ax ; restore registers
pop cx
pop bx
pop di
pop si
ret
;
ret ; return
;
mbinsub endp
;-------------------------mbinsub routine ends---------------------------+


  3 Responses to “Category : Assembly Language Source Code
Archive   : ASM_SUBR.ZIP
Filename : MBINSUB

  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/