Thread: Convert Binary to BCD code View Single Post
2005-09-17, 04:56   #8

"Richard B. Woods"
Aug 2002
Wisconsin USA

1E0C16 Posts

RMAC9.5,

I started programming computers in 1963. At that time (which was before IBM announced its System/360), many mainframes (IBM and others) used word lengths that were a multiple of 3 bits, the number system most commonly used (other than binary and decimal) was octal (base-8), and character codes were 6 bits long, not 8.

Hexadecimal was not commonly used by programmers (except possibly on a few obscure non-IBM systems) at that time.

In its System/360 introductory documents, IBM had to include explanations of the hexadecimal system and how it was related to binary, octal, and decimal, because few programmers were familiar with it.

Quote:
 Originally Posted by RMAC9.5 Cheesehead's answer is partly correct but incomplete (as he left out the last 6 "digits").
No, I left out no digits.

As TravisT pointed out, the D in BCD stands for Decimal, not "Hexadecimal".

Quote:
 IBM's hexadecimal BCD code has 16 characters, 0 - 9 and A - F.
Correction: The hexadecimal (base-16) numbering system, which was not invented by IBM, has 16 digits. The hexadecimal digits corresponding to decimal values 10, 11, 12, 13, 14, and 15 are usually written as A, B, C, D, E, and F, respectively.

In the Binary-Coded Decimal system, the four-bit binary values whose decimal equivalents are 10, 11, 12, 13, 14, and 15 are interpreted as sign (+ or -) codes, not numeric digits.

tinhnho quoted "1. A 16-bit register in a computer contains 10110011 11000100. What does its contents represent if it contains
a) a 4-digit decimal number in the BCD(binary coded decimal) code". It is possible that the writer of that question made a mistake -- the reference to BCD doesn't really match the register value presented. I've worded my previous responses under the assumption that the writer meant what s/he said, but that might not actually be true.

- - - - -

Also see http://en.wikipedia.org/wiki/Binary-coded_decimal

Last fiddled with by cheesehead on 2005-09-17 at 05:09