Kuwait University Cpe-363: Introduction To Embedded Systems: Homework #4

Download as pdf or txt
Download as pdf or txt
You are on page 1of 1

Spring 2021 CpE-363/06

_________________________________________________________________________________

Kuwait University
Computer Engineering Department
CpE-363: Introduction to Embedded Systems
Homework #4
(10 points)
Due Date: May 10, 2021

1. (5 points) Write a program, that will add two 8-bit packed BCD numbers and
store the result in memory location 40H, assume the original numbers are stored
in R2 and R3.
Example:
If R2=36H, R3=28H
then 40H = 64H
Assume that the resulting BCD number can be correctly represented in 2 BCD
digits only.
Note: Your program should NOT use the DA instruction.
Hint: check the operation of the DA instruction.

2. (3 points) Assume that these registers contain the following: A=F0,B=55, and
R1=90. Perform the following operations. Indicate the result and the register
where it is stored.
a) ANL A,#45H b) XRL A,R1 c) ORL A,#99H

3. (1 point) Find the CY and AC flags for each of the following:


a) MOV A,#3FH b) MOV A,#0FEH
ADD A,#45H SETB C
ADDC A,#01

4. (1 point) Find the contents of register A after each of the following is executed
a) MOV A,#55H b) SETB C
SWAP A MOV A,#5AH
RR A SWAP A
RR A RLC A
RLC A

_________________________________________________________________________________

You might also like