COE
538/BME 538 Quiz
Notes:
1.
Closed
book
2.
Write
the answers in the space provided
3.
Show
the process that is used to derive your answers
4.
No
question during the quiz. State your assumptions.
1.
How
many different memory locations can a CPU with a 16-bit address bus and an
8-bit data bus access? [1
mark]
216
x 8 = 65536B = 64 KB
2.
Give
an instruction that can store the contents of accumulator A at the memory
location with an address larger than the contents of X by 8. [2
marks]
STAA 8,X
3.
What
are the contents of accumulator D following the execution of the instruction at
$5000? [2 marks]
ORG
$4000
FDB
5 [$4000]=$00; [$4001]=$05
FCB
6 [$4002]=$06
ORG
$5000
LDD $4001 [A]=$05; [B]=$06
4.
How
many times does the DECA instruction execute if the initial value of AccA is 8? [3
marks]
LOOP
DECA
CMPA #2
BNE LOOP
Six
times
5.
What
will be the content of the memory location at $1000, after the following
program has been executed? Will the
program end with the SWI at label SMALL or the SWI at label BIG? [6 marks]
N EQU 5
ORG $1000
TOTL RMB 1
ORG $1500
LDAA #0
STAA TOTL
LDX #ARRY
LDAB #N
LOOP ADDA 0,X
INX
DECB
BNE LOOP
STAA TOTL
CMPA #0
BGT BIG signed comparison
SMALL SWI
BIG SWI
ARRY FCB 2,4,6,3,128
END
[$1000]=143=10001111.
This is a negative number; therefore, the program will end with the SWI at
label SMALL.
6.
Find
the values of condition flags N, Z, V, and C in the CCR register after the
execution of each of the following instructions, given that [A] = $50 and the
condition flags are N = 0, Z = 1, V = 0, and C = 1 [6
marks]
Content of A
|
N (0) |
Z (1) |
V (0) |
C (1) |
$50 = 80 |
SUBA #40 |
0 |
0 |
0 |
0 |
40 |
TSTA |
0 |
0 |
0 |
0 |
40 |
ADDA #$50 |
0 |
0 |
0 |
0 |
120=01111000 |
LSRA |
0 |
0 |
0 |
0 |
00111100 0 |