>> 4-BIT BCD CODES >> 6-BIT BCD CODES >> 8-BIT BCD CODES >> ZONED-DECIMAL &
PACKED DECIMAL FORMATS
INTRODUCTION HOW DOES A COMPUTER REPRESENT THE NUMERICAL DATA IN BINARY FORMAT? Base-2 digits [Straight Binary] BCD [Binary-Coded Decimal] Types of 4-bit BCD formatted codes >>Weighted 8-4-2-1 BCD Codes >>Weighted 4-2-2-1 BCD Codes* >>Non-weighted XS-3 BCD Codes
DECIMAL DIGITS
4-BIT BCD CODES 8-4-2-1 XS-3 0011
0000
1
2 3 4 5 6 7 8 9
0001
0010 0011 0100 0101 0110 0111 1000 1001
0100
0101 0110 0111 1000 1001 1010 1011 1100
Table : the binary representation for 4-bit codes
Example 2 What is the non-weighted BCD representation for 46910 in a computers memory cells? PRINCIPLE : Add 310 = 00112 for each decimal digit represented by the 8-4-2-1 BCD codes. Decimal Digit 4 6 9 8-4-2-1 BCD Codes 0100 0110 1001 Add 310 = 00112 + 0011 0011 0011 _____________________ The XS-3 BCD codes 0111 1001 1100
0111
1001
1100
XS-3 BCD Codes BCD Codes
6-BIT BCD CODES
WHY 6-BIT BCD CODES WERE BEING CREATED? THE REPRESENTATION ON NON-NUMERIC CHARACTERS & DATA (i.e. 26 Roman alphabetic & some special characters) IT CAN HANDLE UP TO 28 SPECIAL CHARACTERS MEMORY CELLS REPRESENTATION (2 types) used by mainframe computers to represent the numerals, the Latin letters, and some additional characters. It represents the numerals as BCD preceded by two zero bits.
0 1 2 3 4 5 6 7 8 9 A B C D EFGHIJKLMNOPQRSTUV WXYZ +-*/,.!=$( )
MEMORY CELLS REPRESENTATION (2 types)
Zone Bits
Numeric Bits
6-bit cells
2 1
7-bit cells
Check Bit
Zone Bits
Numeric Bits
RULES Check Bit Two variants of parity bits: even parity bit and odd parity bit Zone Bits combinations of two-binary digits Numeric Bits combinations of 4-binary digits
DESCRIPTIONS Zone bits to cluster the binary combination based on the 8-grouped characters. Check bits to ensure not a single bit is lost or gained in memory cells when data is internally transmitted, thus to avoid parity of the numeric bits that can only be distinguished by zone bit. Example 3 The use of parity check bit for characters. i) even parity bit ii) odd parity bit
Check Bit ii) ii) ii) ii) 7 P W 9 0 1 0 1
Zone Bit 00 10 01 00
Numeric Bit 0111 0111 1100 1001 3 is odd so its check bit =zero 4 is even so its check bit =1 3 is odd so its check bit =zero 2 is even so its check bit =1
Table : the binary representation for 6-bit codes for alphabets Table : the binary representation for 6-bit codes for numbers
Table : the binary representation for 6-bit codes for special characters
GOTO----WORD
8-BIT BCD CODES
WHY 8-BIT BCD CODES WERE BEING CREATED? TO HANDLE MORE (SPECIAL) CHARACTERS IN MODERN DATA PROCESSING. IT CAN HANDLE UP TO 28 = 256 CHARACTERS
MEMORY CELLS REPRESENTATION
Zone Bits
Numeric Bits
TWO STANDARDS OF 8-BIT BCD CODES IN COMPUTER INDUSTRY >>EBCDIC (Extended Binary-coded Decimal Interchange Code) i) An extension of 6-bit BCD ii) IBM mainframe and IBM midrange computer operating systems. >>ASCII (American Standard Code for Information Interchange) i) Extension of the 7-bit BCD ii) For non-IBM computers
EBCDIC represent numerical data in computer. The sign of a number is encoded by a 4 bit group which occupies the zone portion Note: the code for an unsigned(positive) number is the normal digit zone code. Z Z Z
8-BIT BCD
Zone bits
EXAMPLE: 275
Numeric bits
1111
0010
1111
0111
1111
0101
Sign indicator
Zoned-Decimal Format
Zoned-decimal format means that each byte of storage can contain one digit or one character. In the zoned-decimal format, each byte of storage is divided into two portions: a 4-bit zone portion and a 4-bit digit portion. The zoned-decimal format looks like this:
ZONED-DECIMAL & PACKED-DECIMAL FORMATS
WHY? To identify the sign of a number RULE Coding of a string of number occupies the zone bits of the right most digit. CODING SIGN
SIGN + unsigned
EBCDIC CODE 1100 1101 1111
+275
1111
0010
1111
0111
1100
0101
-275
1111
0010
1111 0111
1101
0101
Representation of the Number 21544