Lecture 3 - Data Representation-I
Lecture 3 - Data Representation-I
• Binary Numbers
• Translating between binary and decimal
• Binary Addition
• Integer Storage Sizes
• Hexadecimal Integers
• Translating between decimal and hexadecimal
• Hexadecimal subtraction
• Signed Integers
• Binary subtraction
• Character Storage
Every binary
number is a
sum of powers
of 2
37.6875 = 100101.1011
Irvine, Kip R. Assembly Language for Intel-Based Computers, 2003. 25
Exercises
carry: 1
0 0 0 0 0 1 0 0 (4)
+ 0 0 0 0 0 1 1 1 (7)
0 0 0 0 1 0 1 1 (11)
bit position: 7 6 5 4 3 2 1 0
word 16
Standard sizes:
doubleword 32
quadword 64
• Divide the sum of two digits by the number base (16). The quotient
becomes the carry value, and the remainder is the sum digit.
1 1
36 28 28 6A
42 45 58 4B
78 6D 80 B5
21 / 16 = 1, rem 5
16 + 5 = 21 – 7 = 14 = E
−1
C6 75
A2 47
24 2E
1 1 1 1 0 1 1 0
Negative
0 0 0 0 1 0 1 0 Positive
The highest bit is reserved for the sign. This limits the range:
Practice: What is the largest positive value that may be stored in 20 bits?