Tutorial 4

You might also like

Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 6

Tutorial 4

1.
Convert 16810 to binaryBCD? Show steps for all possible methods.

BCD1 = 0000 1000


BCD2 = 0000 0110
BCD3 = 0000 0001

Packed BCD: 0001 0110 1000

2.
Convert 16810 to binary base 2? Show steps for all possible methods.

Method 1

168 ÷ 2 = 84 (Remainder 0)
84 ÷ 2 = 42 (Remainder 0)
42 ÷ 2 = 21 (Remainder 0)
21 ÷ 2 = 10 (Remainder 1)
10 ÷ 2 = 5 (Remainder 0)
5 ÷ 2 = 2 (Remainder 1)
2 ÷ 2 = 1 (Remainder 0)
1 ÷ 2 = 0 (Remainder 1)

1010 10002

Method 2

27 26 25 24 23 22 21 20
128 64 32 16 8 4 2 1

16810 = 12810 + 3210 + 810 = 1010 10002


3.
Convert 0111 0010BCD to binary base 2? Perform direct conversion and show the
steps. For BCD2, use repeat additions of 1010.

BCD1 = 0010
BCD2 = 0111

1010 is added 7 times:


1010
1010
1010
1010
1010
1010
+ 1010
0100 0110

0010
+ 0100 0110
0100 1000

Result = 0100 10002

4.
Convert 0010 0011 0001BCD to binary base 2? Perform direct conversion and show
the steps. For BCD2 and BCD3, use repeat additions of 1010 and 10010, respectively.

BCD1 = 0001
BCD2 = 0011
BCD3 = 0010

1010 is added 3 times:


1010
1010
+ 1010
0001 1110

10010 is added 2 times:


0110 0100
+ 0110 0100
1100 1000

0001
0001 1110
+ 1100 1000
1110 0111

Result = 1110 01112


5.
Add two packed BCD numbers for 3110 and 5610. Show the steps.

0011 0001 = 3110


+ 0101 0110 = 5610
1000 0111 = 8710

6.
Add three packed BCD numbers for 2410, 6610 and 5110. Show the steps.

0010 0100 = 2410


0110 0110 = 6610
+ 0101 0001 = 5110
1101 1011
+ 0110
1 0001
+ 0110 _
1 0100 0001 = 14110

7.
Find 2’s complement for value 67H. Shows steps for all possible methods to find
the 2’s complement.
Method 1

Binary number of 67H = 0110 0111


1’s complement = 1001 1000
2’s complement (add 1) = 1001 1001

Method 2

Binary number of 67H = 0110 0111


Keep all the bits up to and including the least significant 1, after that invert all the
other bits = 1001 1001
8.
What is the difference of 85H – 69H? Show the internal steps performed by 8085
for this unsigned binary subtraction and CY, S flags.

Binary number of 85H = 1000 0101

Binary number of 69H = 0110 1001


1’s complement = 1001 0110
2’s complement (add 1) = 1001 0111

1000 0101
+ 1001 0111
10001 1100

Complement CY = 0 0001 1100


Result = 0001 1100 = 1CH

CY = 0
S=0

9.
What is the difference of 85H – D9H? Show the internal steps performed by 8085
for this unsigned binary subtraction and CY, S flags.

Binary number of 85H = 1000 0101

Binary number of D9H = 1101 1001


1’s complement = 0010 0110
2’s complement (add 1) = 0010 0111

1000 0101
+ 0010 0111
01010 1100

Complement CY = 1 1010 1100


Result = 1010 1100 = ACH

CY = 1
S=1
10.
What is the addition of 8510 + 6910? Show the internal steps performed by 8085
for this signed binary addition and CY, S flags.

Binary number of 8510 = 0101 0101


Binary number of 6910 = 0100 0101

0101 0101
+ 0100 0101
1001 1010

Result = 15410

CY = 0
S=1

11.
What is the difference of 85H – 69H? Show the internal steps performed by 8085
for this signed binary subtraction and CY, S flags.

Binary number of 85H = 1000 0101


1’s complement = 0111 1010
2’s complement (add 1) = 0111 1011 = 7BH (magnitude)

85H – 69H = (-7BH) – (+69H)


= -(7BH + 69H)
= -E4H

-E4H = -(1110 0100)


2’s complement of E4H = 0001 1100
= 1CH

CY = 0
S=0
12.
What is the difference of 85H – D9H? Show the internal steps performed by 8085
for this signed binary subtraction and CY, S flags.

Binary number of 85H = 1000 0101


1’s complement = 0111 1010
2’s complement (add 1) = 0111 1011 = 7BH (magnitude)

Binary number of D9H = 1101 1001


1’s complement = 0010 0110
2’s complement (add 1) = 0010 0111 = 27H (magnitude)

85H – D9H = (-7BH) – (-27H)


= -(7BH – 27H)
= -54H

-54H = -(0101 0100)


2’s complement of 54H = 1010 1100
= ACH

CY = 0
S=1

You might also like