home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Power Programming
/
powerprogramming1994.iso
/
progtool
/
asmutl
/
bluebook.arc
/
MULTIDGT.DOC
< prev
next >
Wrap
Text File
|
1986-05-11
|
5KB
|
105 lines
MULTIDGT.DOC -- Multidigit Arithmetic Procedures
================================================
From `BLUEBOOK of ASSEMBLY ROUTINES for the IBM PC & XT'
by Christopher L. Morgan
Copyright (C) 1984 by The Waite Group, Inc.
Purpose: These routines perform addition, subtraction, multiplication,
and division upon multidigit integers (16-bit).
Contents:
---------
MBINADD -- Multidigit binary addition
MBINDIV -- Multidigit binary division
MBINMUL -- Multidigit binary multiplication
MBINSUB -- Multidigit binary subtraction
Overview: These routines use 16-bit integers as `digits', but could easily
be modified to use 8-bit integers, instead. Many operations are performed
using 8- or 16-bit arithmetic operations on the individual `digits'. The
exception here is the division routine, which uses binary arithmetic.
____________________________ MULTIDIGIT ROUTINES ____________________________
Routine to perform 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 thes 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 in memory.
Output: Upon exit, DS:BX points to where the result is stored.
Registers used: Unmodified; SI, DI, BX, CX, & AX are saved & restored.
Segments referenced: Upon entry, the data segment must contain the constant,
ISIZE and storage for three multidigit numbers, two for input and one for
output.
______________________________________________________________________________
Routine to perform multidigit binary division.
Function: This routine divides two multidigit binary numbers, returning
both a quotient and a remainder.
Input: Upon entry, DS:SI points to the divisor, DS:BX points to where the
dividend is upon entry and where the remainder will be upon exit, and
DS:DI points to the location where the quotient will be upon exit. The
size of thes multidigit numbers is controlled by the constant,ISIZE.
The divisor and quotient contain 16 * ISIZE number of bits and the dividend
and remainder have double that precision. Both the divisor and quotient
are stored in ISIZE number of 16-bit words in memory, and the dividend
and remainder are stored in 2 * ISIZE number of 16-bit words of memory.
Output: Upon exit, DS:BX points to where the quotient is stored and
DS:DI points to where the remainder is stored.
Registers used: Unmodified; SI, DI, & CX are saved & restored.
Segments referenced: Upon entry, the data segment must contain the constant,
ISIZE and storage for the multidigit numbers described above.
______________________________________________________________________________
Routine to perform multidigit binary multiplicaton.
Function: This routine multiplies 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 thes 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 in memory.
Output: Upon exit, DS:BX points to where the result is stored.
Registers used: Unmodified; SI, DI, BX, CX, & AX are saved & restored.
Segments referenced: Upon entry, the data segment must contain the constant,
ISIZE and storage for three multidigit numbers, two for input and one for
output.
______________________________________________________________________________
Routine to perform 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 thes 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 in memory.
Output: Upon exit, DS:BX points to where the result is stored.
Registers used: Unmodified; SI, DI, BX, CX, & AX are saved & restored.
Segments referenced: Upon entry, the data segment must contain the constant,
ISIZE and storage for three multidigit numbers, two for input and one for
output.
______________________________________________________________________________
>>>>> Physical EOF MULTIDGT.DOC <<<<<