![]() sponsored by |
![]() | OSdata.com |
This web page examines binary coded decimal (BCD) instructions in assembly language. Specific examples of instructions from various processors are used to illustrate the general nature of assembly language.
OSdata.com is used in more than 300 colleges and universities around the worldFind out how to get similar high web traffic and search engine placement. |
For those with high speed connections, the very large single file summary is still on line.
Binary coded decimal (BCD) is a method for implementing lossless decimal arithmetic (including decimal fractions) on a binary computer. The most obvious uses involve money amounts where round-off error from using binary approximations is unacceptable. Some early computers used BCD exclusively.
Decimal digits (0-9) can be encoded in a nibble (half a byte), with some left over bit patterns (hexadecimal A-F). In BCD operations, the processor performs ordinary binary computations, then adjusts the result to conform to BCD. For example, if you add the binary number 5 (bit pattern 0101) to binary number 6 (bit pattern 0110), you get the binary result of 11 (bit pattern 1011, or hexadecimal B). With BCD arithmetic, the processor would adjust the result to make it into a valid BCD result (which in this case would be bit pattern 0001 0001).
BCD arithmetic includes BCD addition, BCD subtraction, BCD multiplication, BCD division, and BCD negate.
The Intel 80x86 series uses a two step approach for BCD arithmetic. Instead of having separate BCD instructions, the normal binary addition and subtraction instructions are used, then hardware instructions are used to adjust the results to correct BCD results. There are instuctions for both packed and unpacked adjustments. The advantage of this approach is greater flexibility (more addressing modes and choices of arithmetic operations because of the use of regular binary integer instructions in the first step). The disadvantage of this approach is that it is slower and takes more memory.
Pack (Motorola 680x0) converts byte encoded numeric data (such as ASCII or EBCDIC characters) into binary coded decimals. Unpack (Motorola 680x0) converts binary coded decimals into byte encoded numeric data (such as ASCII or EBCDIC characters). The ASCII adjustment field is $3030; the EBCDIC adjustment field is $F0F0.
For those with high speed connections, the very large single file summary is still on line.
OSdata.com is used in more than 300 colleges and universities around the worldfree downloadable college text book on computer programming. |

To donate, click here.
Note: Please mail donations to: Milo, PO Box 1361, Tustin, Calif, 92781, USA. Or use the link above to donate via credit cards.
A web site on dozens of operating systems simply cant be maintained by one person. This is a cooperative effort. If you spot an error in fact, grammar, syntax, or spelling, or a broken link, or have additional information, commentary, or constructive criticism, please e-mail Milo. If you have any extra copies of docs, manuals, or other materials that can assist in accuracy and completeness, please send them to Milo, PO Box 1361, Tustin, CA, USA, 92781.
Click here for our privacy policy.
| previous page | next page |

This web site handcrafted on Macintosh
computers using Tom Benders Tex-Edit Plus
and served using FreeBSD
.
Names and logos of various OSs are trademarks of their respective owners.
Copyright © 2000, 2001 Milo
Last Updated: September 16, 2001
Created: February 21, 2001 (from machcode.htm)
![]() osdata.com |
OSdata.com team support | |||||||
logo design![]() michaelm.com |
web hosting![]() KMThost.com |
hemp clothing![]() hempStar.com |
recording studio![]() casoundstudios |
cleanse ezwaterflo.com |
spiritual support![]() Pr Ntr Kmt .org |
|||
| web hosting provided by: KMThost.com
The author of this website can help you get high search engine placement. | ||||||||
| previous page | next page |