Docsity

5 Problems for Computer Systems and Assembly Language - Homework 1 | EECS 388, Assignments of Electrical and Electronics Engineering

Toggle sidebar
bg1
EECS 388: Computer Systems and Assembly Language
Homework 1
Due Feb. 12, 2007
Justify your answers!
Figure 1 shows a part of the memory (both contents and locations).
Contents Locations
_____________________________________
$20 $4000
$50 $4001
$01 $4002
: :
: :
$B5 $5000
$CD $5001
Figure 1.
Problem 1 (10 Points):
Consider the memory shown in Figure 1. Write a program to add the two
numbers in $4000 and $4001 and store the results in $5002.
Problem 2 (10 Points):
Consider the memory shown in Figure 1. What is the content in accumulator D
after the following lines are executed?
LDD $4001
ADDA $5000
D: _________________
Problem 3 (30 points):
Consider the memory shown in Figure 1. What are the contents in memory
location $5002 and accumulator A after the following lines are executed?
LDAA $4000
LDD #$5000
LDAB $4002
STD $5002
Memory location $5002: ___________
A: ___________
pf2

Partial preview of the text

Download 5 Problems for Computer Systems and Assembly Language - Homework 1 | EECS 388 and more Assignments Electrical and Electronics Engineering in PDF only on Docsity!

EECS 388: Computer Systems and Assembly Language

Homework 1

Due Feb. 12, 2007 Justify your answers! Figure 1 shows a part of the memory (both contents and locations). Contents Locations


$20 $ $50 $ $01 $

$B5 $

$CD $

Figure 1. Problem 1 (10 Points): Consider the memory shown in Figure 1. Write a program to add the two numbers in $4000 and $4001 and store the results in $5002. Problem 2 (10 Points): Consider the memory shown in Figure 1. What is the content in accumulator D after the following lines are executed? LDD $ ADDA $ D: _________________ Problem 3 (30 points): Consider the memory shown in Figure 1. What are the contents in memory location $5002 and accumulator A after the following lines are executed? LDAA $ LDD #$ LDAB $ STD $ Memory location $5002: ___________ A: ___________

Problem 4 (25 points): If A contains $BB, B contains $CD and the carry bit in CCR is 1, what are the results of the following instructions? Assume that A, B, and CCR are restored to their original values before each instruction. a) ASLA, A:______ b) ASRB, B:______ c) LSLD, A:______, B: ______ d) ROLB, D:_____________ Problem 4 (10 Points): Write a program to add two values $20 and $40 and store the result in memory location $8000. Problem 5 (15 Points): Write a program to implement the following 16 bit rotation, i.e., originally, A and B contain a 7 (^) a 6 L a 0 and b 7 (^) b 6 L b 0 , respectively. After the 16 bit rotation, the contents in A and B are a 6 (^) a 5 L a 0 b 7 and b 6 (^) b 5 L b 0 a 7 , respectively. (Note: You can only use the data transfer and manipulation instructions in Section 2.4.1). a 7 a 0 b 7 b 0 accumulator A accumulator B