Jump to content

BCD (character encoding)

From Wikipedia, the free encyclopedia

This is an old revision of this page, as edited by 71.41.210.146 (talk) at 18:56, 18 April 2017 (BCD code variations: Explained better.). The present address (URL) is a permanent link to this revision, which may differ significantly from the current revision.

BCD ("Binary-Coded Decimal"), also called alphanumeric BCD, alphameric BCD, BCD Interchange Code,[1] or BCDIC,[1] is a family of representations of numerals, uppercase Latin letters, and some special and control characters as six-bit character codes.

Unlike later encodings such as ASCII, BCD codes were not standardized. Different computer manufacturers, and even different product lines from the same manufacturer, often had their own variants, and sometimes included unique characters. Other six-bit encodings with completely different mappings, such as some FIELDATA[1] variants or Transcode, are sometimes incorrectly termed BCD.

Many variants of BCD encode the characters '0' through '9' as the corresponding binary values.

History

Technically, binary-coded decimal describes the encoding of decimal numbers where each decimal digit is represented by a fixed number of bits, usually four.

With the introduction of the IBM card in 1928, IBM created a code capable of representing alphanumeric information,[2] later adopted by other manufacturers. This code represents the numbers 0-9 by a single punch, and uses multiple punches for upper-case letters and special characters.[3] A letter had two punches (zone [12,11,0] + digit [1–9]); most special characters have two or three punches (zone [12,11,0,or none] + digit [2–7] + 8).

The BCD code is the adaptation of the punched card code to a six-bit binary code by encoding the digit rows (nine rows, plus unpunched) into the low four bits, and the zone rows (three rows, plus unpunched) into the high two rows.[4] The digit zero (a single punch in row 0) was usually handled specially in some way, and the digit code was extended to values 10 through 15 by combining a digit in the range 2–7 with a punch in row 8. IBM applied the terms binary-coded decimal and BCD to the variations of BCD alphamerics used in most early IBM computers, including the IBM 1620, IBM 1400 series, and non-Decimal Architecture members of the IBM 700/7000 series.

Among the vendors using BCD were Burroughs,[5] Bull, CDC,[6] IBM, General Electric (the computer division was purchased by Honeywell in 1969), NCR, Siemens, and Sperry-UNIVAC.

IBM later created the 8-bit Extended Binary Coded Decimal Interchange Code (EBCDIC) based on BCDIC.

Special characters

The Recordmark or Record mark character (represented as ‡) is a character used to mark the end of a record.[7] The BCD code for this character is 328 in some BCD variants. The closest Unicode equivalent is U+29E7 THERMODYNAMIC, but that is not found in many fonts, so U+2021 DOUBLE DAGGER is often used instead. Functionally this corresponds to the EBCDIC IRS character (ASCII RS), X'1E'.

The Groupmark or Group mark character (represented as ) is a character used to indicate the start or finish of a group of related fields.[8] The BCD code for this character is 778 in some BCD variants. The groupmark was proposed for Unicode standardization in 2015,[9] and was assigned to value U+2BD2 GROUP MARK. Another visually simolar character is U+2E59 TOP HALF LEFT PARENTHESIS. Functionally this corresponds to the EBCDIC IGS character (ASCII GS), X'1D'.

The Wordmark, by contrast, is not a BCD character. Rather, it is a flag bit used to mark the end of a word on some variable word length computers such as the IBM 1401.

BCD code variations

There are many different versions of the six-bit BCD code. There are three major categories of difference:

  1. The mapping from zone punches to high-order bits. All codes translate no zone punches to a bit pattern of 00, but some encode the zone punches in 12-11-0 order, preserving alphabetical order, while others use 0-11-12 order, resulting in a partially reversed alphabet.
  2. The handling of the digit 0. The straightforward translation from punched form would place the blank before digits 1–9, and encode 0 somewhere else entirely. All codes have some special-case handling which either translates the digit 0 to the all-zero binary code (and moves the blank elsewhere), or gives it binary code 001010 (decimal 10) and uses the 8+2 punch elsewhere.
  3. The assignment of special characters. The characters assigned to codes beyond the basic alphanumeric set varied widely, even within one model of computer.

In "Spanish speaking countries", the character "Ñ" did not exist in the original system, therefore "@" was chosen by most manufacturers: Bull, NCR, and Control Data, but there was an inconsistency when merging databases to 7-bit ASCII code, for in that coding system the "/" character was chosen, resulting in two different codes for the same character.

Examples of BCD codes

The following charts show the numeric values of BCD characters in hexadecimal (base-16) notation, as that most clearly reflects the structure of 4-bit binary coded decimal, plus two extra bits. For example, the code for 'A", in row 2x and column x1, is hexadecimal 21, or binary '01 0001'.

IBM 704 BCD code

The following table shows the code assignments for the IBM 704 computer. Unassigned code positions appear as blanks.[10]

x0 x1 x2 x3 x4 x5 x6 x7 x8 x9 xA xB xC xD xE xF
0x 0 1 2 3 4 5 6 7 8 9 = -
1x + A B C D E F G H I . )
2x - J K L M N O P Q R $ *
3x space / S T U V W X Y Z , (

IBM 1401 BCD code

The IBM 1401 used the all-zero code for blank, and moved the digit zero to the code 10. It had defined characters forms for all possible values, for documentation purposes,[11] but only 48 of the 63 non-blank characters were printable, and there was considerable variation in how the other characters (shaded in the table below) were printed in practice. Even the other characters varied between different available print chains for the IBM 1403 printer.

x0 x1 x2 x3 x4 x5 x6 x7 x8 x9 xA xB xC xD xE xF
0x space 1 2 3 4 5 6 7 8 9 0 # @ : >
1x ¢ / S T U V W X Y Z , % = ' "
2x - J K L M N O P Q R ! $ * ) ; Δ
3x & A B C D E F G H I ? . ( <

GBCD code

Below is the table of GE/Honeywell's GBCD code, a variant of BCD.[12]

x0 x1 x2 x3 x4 x5 x6 x7 x8 x9 xA xB xC xD xE xF
0x 0 1 2 3 4 5 6 7 8 9 [ # @ : > ?
1x space A B C D E F G H I & . ] ( < \
2x ^ J K L M N O P Q R - $ * ) ; '
3x + / S T U V W X Y Z _ , % = " !

Burroughs B5500 BCD code

The following table shows the code assignments for the Burroughs B5500 computer, sometimes referred to as BIC (Burroughs Interchange Code).[13]

x0 x1 x2 x3 x4 x5 x6 x7 x8 x9 xA xB xC xD xE xF
0x 0 1 2 3 4 5 6 7 8 9 # @ ? : >
1x + A B C D E F G H I . [ & ( <
2x × J K L M N O P Q R $ * - ) ;
3x space / S T U V W X Y Z , % = ] "

Code page 353

The BCDIC-A Code page was assigned as Code page 353, also known as CP353. Some of the characters in this code page are not in Unicode.

x0 x1 x2 x3 x4 x5 x6 x7 x8 x9 xA xB xC xD xE xF
0x space 1 2 3 4 5 6 7 8 9 0 # @ : >
1x / S T U V W X Y Z , % γ \
2x - J K L M N O P Q R ! # * ] ; Δ
3x & A B C D E F G H I ? . [ <

At 0x1A is the record mark, which was not proposed separately due to its similarity to the double dagger. At 0x3F is the group mark.

PTTC/BCD code pages

PTTC/BCD had 5 options. There were five code pages. They are shown below. The PTTC/BCD Standard Option was assigned as Code page 355, or CP355.

x0 x1 x2 x3 x4 x5 x6 x7 x8 x9 xA xB xC xD xE xF
0x space 1 2 3 4 5 6 7 8 9 0 #
1x @ / S T U V W X Y Z , γ
2x - J K L M N O P Q R < $
3x & A B C D E F G H I ) .

The PTTC/BCD H Option was assigned as Code page 357, or CP357.

x0 x1 x2 x3 x4 x5 x6 x7 x8 x9 xA xB xC xD xE xF
0x space 1 2 3 4 5 6 7 8 9 0 =
1x ' / S T U V W X Y Z ,
2x - J K L M N O P Q R ! $
3x + A B C D E F G H I ? .

The PTTC/BCD Correspondence Option was assigned as Code page 358, or CP358.

x0 x1 x2 x3 x4 x5 x6 x7 x8 x9 xA xB xC xD xE xF
0x space 1 2 3 4 5 6 7 8 9 0 '
1x ! / S T U V W X Y Z ,
2x - J K L M N O P Q R < ;
3x = A B C D E F G H I > .

The PTTC/BCD Monocase Option was assigned as Code page 359, or CP359.

x0 x1 x2 x3 x4 x5 x6 x7 x8 x9 xA xB xC xD xE xF
0x space 1 2 3 4 5 6 7 8 9 0 #
1x @ / S T U V W X Y Z ,
2x - J K L M N O P Q R $
3x & A B C D E F G H I .

The PTTC/BCD Duocase Option was assigned as Code page 360, or CP360.

x0 x1 x2 x3 x4 x5 x6 x7 x8 x9 xA xB xC xD xE xF
0x space 1 2 3 4 5 6 7 8 9 0 #
1x @ / S T U V W X Y Z ,
2x - J K L M N O P Q R $
3x & A B C D E F G H I .

See also

References

  1. ^ a b c Mackenzie, Charles E. (1980). Coded Character Sets, History and Development (1 ed.). Addison-Wesley Publishing Company, Inc. ISBN 0-201-14460-3. LCCN 77-90165. ISBN 978-0-201-14460-4. Retrieved 2016-05-22. {{cite book}}: |work= ignored (help) [1]
  2. ^ Pugh, Emerson W.; Heide, Lars. "STARS:Punched Card Equipment". IEEE Global History Network. Archived from the original on 2012-05-11. Retrieved 2012-06-09. {{cite web}}: Unknown parameter |dead-url= ignored (|url-status= suggested) (help)
  3. ^ Pugh, Emerson W. (1995). Building IBM: Shaping and Industry and Its Technology. MIT Press. pp. 50–51. ISBN 978-0-262-16147-3.
  4. ^ Jones, Douglas W. "Punched Card Codes". Retrieved 2014-01-01.
  5. ^ Burroughs Corporation (1964). Burroughs B5500 Information Processing Systems: Reference Manual (PDF).
  6. ^ Control Data Corporation (1965). Codes/Control Data 6600 Computer System (PDF).
  7. ^ "Record-mark". PC Magazine: Encyclopedia. Retrieved 2016-04-09.
  8. ^ "group mark". Encyclopedia.com. Retrieved 2016-04-09.
  9. ^ Shirriff, Ken. "Proposal for addition of Group Mark symbol" (PDF). unicode.org. Retrieved 2016-04-09.
  10. ^ "Fortran Automatic Coding System for the IBM 704" (PDF). IBM. 1956-10-15. p. 49. Retrieved 2015-09-15.
  11. ^ IBM (April 1962). IBM 1401 Data Processing System: Reference Manual (PDF). p. 170. A24-1403-5.
  12. ^ "Section: Tables of characters in BULL computers" (PDF).
  13. ^ Burroughs B 5500 Information Processing Systems Extended Algol Reference Manual (PDF). 1966. p. B-1.

Further reading