1s, 2s, 9s and 10s Complement
Irvine, Kip R. Assembly Language for Intel-Based Computers, 2003. 41
Forming the Two's Complement
• Negative numbers are stored in two's complement
notation
• Represents the additive Inverse
Note that 00000001 + 11111111 = 00000000
Irvine, Kip R. Assembly Language for Intel-Based Computers, 2003. 42
Binary Subtraction
• When subtracting A – B, convert B to its two's
complement
• Add A to (–B)
00001100 00001100
– 00000011 11111101
00001001
Practice: Subtract 0101 from 1001.
Irvine, Kip R. Assembly Language for Intel-Based Computers, 2003. 43
Subtraction using Complements
Irvine, Kip R. Assembly Language for Intel-Based Computers, 2003. 44
Subtraction using Complements
Irvine, Kip R. Assembly Language for Intel-Based Computers, 2003. 45
Learn How To Do the Following:
• Form the two's complement of a hexadecimal integer
• Convert signed binary to decimal
• Convert signed decimal to binary
• Convert signed decimal to hexadecimal
• Convert signed hexadecimal to decimal
Irvine, Kip R. Assembly Language for Intel-Based Computers, 2003. 46
BCD
Irvine, Kip R. Assembly Language for Intel-Based Computers, 2003. 47
BCD Addition Example
Irvine, Kip R. Assembly Language for Intel-Based Computers, 2003. 48
Other Decimal Codes
Irvine, Kip R. Assembly Language for Intel-Based Computers, 2003. 49
Character Storage
• Character sets
• Standard ASCII (0 – 127)
• Extended ASCII (0 – 255)
• ANSI (0 – 255)
• Unicode (0 – 65,535)
• Null-terminated String
• Array of characters followed by a null byte
• Using the ASCII table
• back inside cover of book
Irvine, Kip R. Assembly Language for Intel-Based Computers, 2003. 50
Numeric Data Representation
• pure binary
• can be calculated directly
• ASCII binary
• string of digits: "01010101"
• ASCII decimal
• string of digits: "65"
• ASCII hexadecimal
• string of digits: "9C"
next: Boolean Operations
Irvine, Kip R. Assembly Language for Intel-Based Computers, 2003. 51
ASCII
Irvine, Kip R. Assembly Language for Intel-Based Computers, 2003. 52
ASCII
Irvine, Kip R. Assembly Language for Intel-Based Computers, 2003. 53
Irvine, Kip R. Assembly Language for Intel-Based Computers, 2003. 54
Irvine, Kip R. Assembly Language for Intel-Based Computers, 2003. 55
Irvine, Kip R. Assembly Language for Intel-Based Computers, 2003. 56
Irvine, Kip R. Assembly Language for Intel-Based Computers, 2003. 57