Unpacked BCD numbers are made up of bytes containing a single decimal digit in the lower four bits of each byte. Packed BCD numbers are made up of bytes containing two decimal digits: one in the upper four bits and one in the lower four bits. The leftmost digit holds the sign (0 for positive, 1 for negative).
Packed BCD numbers are encoded in the 8087 coprocessor's packed BCD format. They can be up to 18 digits long, packed two digits per byte. The assembler zero-pads BCDs initialized with fewer than 18 digits. Digit 20 is the sign bit, and digit 19 is reserved.
Summary: The TBYTE directive allocates packed BCD constants.
When you define an integer constant with the TBYTE directive and the current radix is decimal (t), the assembler interprets the number as a packed BCD number.
The syntax for specifying packed BCDs is exactly the same as for other integers.
pos1 TBYTE 1234567890 ; Encoded as 00000000001234567890h
neg1 TBYTE -1234567890 ; Encoded as 80000000001234567890h
Unpacked BCD numbers are stored one digit to a byte, with the value in the lower four bits. They can be defined using the BYTE directive. For example, an unpacked BCD number could be defined and initialized as shown below:
unpackedr BYTE 1,5,8,2,5,2,9 ; Initialized to 9,252,851
unpackedf BYTE 9,2,5,2,8,5,1 ; Initialized to 9,252,851
Least-significant digits can come either first or last, depending on how you write the calculation routines that handle the numbers.