Chapter 9: Advanced Arithmetic


Download CD Content

9.1 Chapter Overview

This chapter deals with those arithmetic operations for which assembly language is especially well suited, but for which high level languages are, in general, poorly suited. It covers four main topics: extended precision arithmetic, arithmetic on operands whose sizes are different, decimal arithmetic, and computation via table look-up.

By far, the most extensive subject this chapter covers is multiprecision arithmetic. By the conclusion of this chapter you will know how to apply arithmetic and logical operations to integer operands of any size. If you need to work with integer values outside the range 2 billion (or with unsigned values beyond 4 billion), no sweat; this chapter will show you how to get the job done.

Operands whose sizes are not the same also present some special problems in arithmetic operations. For example, you may want to add a 128-bit unsigned integer to a 256-bit signed integer value. This chapter discusses how to convert these two operands to a compatible format so the operation may proceed.

This chapter also discusses decimal arithmetic using the binary coded decimal (BCD) features of the 80x86 instruction set and the FPU. This lets you use decimal arithmetic in those few applications that absolutely require base 10 operations (rather than binary).

Finally, this chapter concludes by discussing the use of tables to speed up complex computations.




The Art of Assembly Language
The Art of Assembly Language
ISBN: 1593272073
EAN: 2147483647
Year: 2005
Pages: 246
Authors: Randall Hyde

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net