DAT2343 Summary of Standard Data Encoding © Alan T. Pinck / Algonquin College; 2003.

7
DAT2343 Summary of Standard Data Encoding © Alan T. Pinck / Algonquin College; 2003

Transcript of DAT2343 Summary of Standard Data Encoding © Alan T. Pinck / Algonquin College; 2003.

Page 1: DAT2343 Summary of Standard Data Encoding © Alan T. Pinck / Algonquin College; 2003.

DAT2343

Summary of

Standard Data Encoding

© Alan T. Pinck / Algonquin College; 2003

Page 2: DAT2343 Summary of Standard Data Encoding © Alan T. Pinck / Algonquin College; 2003.

Character EncodingStorage Unit = byteASCII ‘A’:41h …’Z’:5Ah; plus 20h for lower case ‘0’:30h … ‘9’:39h blank:20h; carriage return:0Dh; line feed:0Ah

EBCDIC ‘A’:C1h … ‘I’:C9h; ‘J’:D1h …’R’:D9h;

‘S’:E2...‘Z’:E9h subtract 40h for lower case ‘0’:F0h … ‘9’:F9h blank 40h

Page 3: DAT2343 Summary of Standard Data Encoding © Alan T. Pinck / Algonquin College; 2003.

Basic Integer Numeric Forms

Storage Unit = wordUnsigned Binary position numbers (starting at 0 on right) position weights : 2position

2’s Complement subtract unsigned binary version of absolute

value from 0 (if working in binary) reverse bits and add 1

Page 4: DAT2343 Summary of Standard Data Encoding © Alan T. Pinck / Algonquin College; 2003.

Standard Integer Numeric Flags

Zero all bits in result word are 0 may not be a “true” zero e.g. AAAh + 556h (12-bit word) would turn Zero

“on”

Carry result wrong (too large or less than zero) for unsigned binary

Sign copy of left-most bit of result word

Overflow result is wrong if treated as 2’s complement (result sign is logically

impossible for given operand signs)

Page 5: DAT2343 Summary of Standard Data Encoding © Alan T. Pinck / Algonquin College; 2003.

Basic Float Form : 32-bit IEEE-754

1 bit : sign (0=positive; 1=negative)

8 bits: excess-127 binary exponent

23 bits : normalized binary mantissa without leading 1.0

Page 6: DAT2343 Summary of Standard Data Encoding © Alan T. Pinck / Algonquin College; 2003.

Hybrid Character-Numeric Forms

Zoned DecimalFd Fd … FD sd

BCD Packed Decimal (a form of BCD)

dd dd … dd ds(always an odd number of digits)

d: hex value in range 0 to 9 inclusive

s: C (hex) positive (also accepts A, E, and F as positive)

D (hex) negative (also accepts B as negative)

(sign is always in right-most byte)

Page 7: DAT2343 Summary of Standard Data Encoding © Alan T. Pinck / Algonquin College; 2003.

End of Lecture