Expectations
KINDNESS FOLLOWING PROBLEM FUN
INSTRUCTION SOLVERS
S
10/05/2025 1
Do Now
• Convert 2E (Hexadecimal) to decimal
• Convert 143 (decimal) to Hexadecimal
10/05/2025 2
Do Now
• Convert 2E (Hexadecimal) to decimal =
46
• Convert 143 (decimal) to Hexadecimal =
8F
10/05/2025 3
Binary Addition and
Binary Manipulation
Binary Addition & Logical Shifts
Learning Objectives
By the end of this lesson, you will be able to:
• Add two positive 8-bit binary integers.
• Explain the concept of overflow and why it occurs.
• Perform logical binary shifts (left and right) on a
positive 8-bit binary integer.
• Negative binary numbers
10/05/2025 5
Starter Activity: The Binary Challenge
• Add 10+5 in denary.
• Convert 10 and 5 to 8-bit binary.
• Add the two binary numbers together.
• What do you notice about the process?
• 00001111
10/05/2025 6
Binary Addition Rules
• The Rules Are Simple!
• 0+0=0
• 0+1=1
• 1+0=1
• 1+1=10 (which is 0 with a carry of 1)
• 1+1+1=11 (which is 1 with a carry of 1)
10/05/2025 7
Binary Addition Rules
• Example: Add 01011001 and 00100110
0 1 0 1 1 0 0 1
+ 0 0 1 0 0 1 1 0
0 1 1 1 1 1 1 1
10/05/2025 8
Binary Addition Rules
• Example: Add 10010100 and 00011110.
10010100
+ 00011110
10110010
10/05/2025 9
Practise
1. Add the 8-bit binary values 00011001 and
01000011.
2. 00011001 (Denary 25)
3. + 01000011 (Denary 67)
4. -------------
01011100 (Denary 92)
10/05/2025 10
Practise
2. Add the 8-bit binary values 00100110 and
01010111.
00100110 (Denary 38)
+ 01010111 (Denary 87)
-------------
01111101 (Denary 125)
10/05/2025 11
Overflow: What Happens When It's Too
Big?
• Add 1100 0000 and 1000 0000
• The sum is 320, which is larger than 255.
• The 9th bit, the most significant bit, is lost.
• The computer gives an incorrect answer.
10/05/2025 12
Overflow: What Happens When It's Too Big?
• An overflow error occurs when a calculation's result is
too large for the allocated number of bits.
• An 8-bit register can hold numbers up to 255
(11111111).
• And this case there is a 9th bit
10/05/2025 13
Logical Binary Shifts
• A logical shift moves all bits to the left or right. Zeros
are used to fill the empty spaces.
• Bits that fall off the end of the register are lost.
10/05/2025 14
Logical Left Shift
• Each shift to the left multiplies the number by 2.
• This means that each logical shift to the left multiples
the binary number by 2.
0 0 0 0 0 1 0 1
• Example: 00000101 (denary 5) Shift left by 1:
10/05/2025 15
Logical Left Shift
• Example: 00000101 (denary 5) Shift left by 1: (denary 10)
0 0 0 0 0 1 0 1
0 0 0 0 1 0 1 0
10/05/2025 16
Logical Left Shift
• Each shift to the left multiplies the number
• Example: Shift left by 2: (denary 20)
0 0 0 0 1 0 1 0
0 0 0 1 0 1 0 0
10/05/2025 17
Logical Right Shift
• Each shift to the right divides the number by 2. Any
remainder is discarded.
• This means that each logical shift to the right divides
the binary number by 2.
• Example: 00100100 (denary 36)
0 0 1 0 0 1 0 0
10/05/2025 18
Logical Right Shift
• Example: 00100100 (denary 36)
0 0 1 0 0 1 0 0
10/05/2025 19
Logical Right Shift
• Example: 00100100 (denary 36)
0 0 1 0 0 1 0 0
• Shift right by 1: (denary 18)
0 0 0 1 0 0 1 0
10/05/2025 20
Logical Right Shift
• Example: 00100100 (denary 36)
0 0 1 0 0 1 0 0
• Shift right by 1: (denary 18)
0 0 0 1 0 0 1 0
• Shift right by 2: (denary 9)
0 0 0 0 1 0 0 1
10/05/2025 21
Negative binary numbers
How the denary value -35 is represented as binary.
• Example: Convert 35 into binary
0 0 1 0 0 0 1 1
• Invert each of the values in the binary number:
1 1 0 1 1 1 0 0
• Then simply add 1:
1 1 0 1 1 1 0 1
10/05/2025 22
Two's complement method.
• 1011101 is the binary representation of -35 using the
two's complement method.
10/05/2025 23
Activity
1. Add 01001001 and 00110101.
2. Explain in your own words what an overflow error
is.
3. Take the number 00011000 (24).
Perform a logical left shift by two positions.
Perform a logical right shift by one position.
10/05/2025 24