Professional Documents
Culture Documents
• Binary Numbers
• Translating between binary and decimal • Digits are 1 and 0
• Binary Addition • 1 = true
• Integer Storage Sizes • 0 = false
• Hexadecimal Integers • MSB – most significant bit
• Translating between decimal and hexadecimal • LSB – least significant bit
• Hexadecimal subtraction
MSB LSB
• Signed Integers • Bit numbering: 1011001010011100
• Binary subtraction 15 0
• Character Storage
Irvine, Kip R. Assembly Language for Intel-Based Computers, 2003. 21 Irvine, Kip R. Assembly Language for Intel-Based Computers, 2003. 22
• Each digit (bit) is either 1 or 0 1 1 1 1 1 1 1 1 Weighted positional notation shows how to calculate the
• Each bit represents a power of 2: 27 26 25 24 23 22 21 20 decimal value of each binary bit:
dec = (Dn-1 2n-1) + (Dn-2 2n-2) + ... + (D1 21) + (D0 20)
D = binary digit
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 Irvine, Kip R. Assembly Language for Intel-Based Computers, 2003. 26
1
Binary Addition Integer Storage Sizes
• Starting with the LSB, add each pair of digits, include
byte 8
Standard sizes:
the carry if present.
word 16
doubleword 32
quadword 64
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
Irvine, Kip R. Assembly Language for Intel-Based Computers, 2003. 27 Irvine, Kip R. Assembly Language for Intel-Based Computers, 2003. 28
Irvine, Kip R. Assembly Language for Intel-Based Computers, 2003. 29 Irvine, Kip R. Assembly Language for Intel-Based Computers, 2003. 30
• Multiply each digit by its corresponding power of 16: Used when calculating hexadecimal values up to 8 digits
dec = (D3 163) + (D2 162) + (D1 161) + (D0 160) long:
Irvine, Kip R. Assembly Language for Intel-Based Computers, 2003. 31 Irvine, Kip R. Assembly Language for Intel-Based Computers, 2003. 32
2
Converting Decimal to Hexadecimal Convert Decimal Fraction to Octal Fraction
Irvine, Kip R. Assembly Language for Intel-Based Computers, 2003. 33 Irvine, Kip R. Assembly Language for Intel-Based Computers, 2003. 34