EE319K Fall 2007 Quiz 3
Page 3 of 8
Jonathan W. Valvano
November 28, 2007
10:00am-10:50am
(5) Question 1.
Specify the proper order of events occurring during the context switch from
foreground (main program) to background (interrupt service routine, ISR).
Push registers
means
Push PC, Y, X, A, B, and CCR on the stack.
A) Finish instruction, push registers, I=1, PC=vector, execute ISR.
B) Finish instruction, push registers, clear trigger flag, I=1, PC=vector, execute ISR.
C) Finish instruction, push registers, I=0, PC=vector, execute ISR.
D) Finish instruction, I=1, push registers, PC=vector, execute ISR.
E) Finish instruction, I=1, push registers, clear trigger flag, PC=vector, execute ISR.
F) Finish instruction, I=0, push registers, PC=vector, execute ISR.
G) None of the above
(5) Question 2.
Consider a 12-bit ADC with a range of 0 to +5V. What is the approximate
resolution of this ADC? Give units.
(5) Question 3.
There are three decimal fixed-point numbers. The height,
H
, and the width,
W
,
have a resolution of 0.01 cm. The area,
A
, has a fixed-point resolution of 0.01 cm
2
. Let
IH
be the
integer part of
H
, let
IW
be the integer part of
W
, and let
IA
be the integer part of
A
..
The goal is
to calculate area,
A
=
H
*
W
. Show the mathematical equation needed to calculate
IA
in terms of
IH
,
IW
and numerical constants. Your answer will look something similar to
IA
=
IH
+
IW*2
Questions 4 and 5
involve the following assembly program involving one 16-bit parameter
passed on the stack and one 8-bit local variable, also on the stack.
main lds
#$4000
movw #1000,2,-sp
; pass 16-bit
in
parameter on stack
jsr
sub2
leas 2,s
; balance stack, discarding the
in
parameter
here bra
here
in
set
xxx
; binding of 16-bit input parameter
cnt
set
yyy
; binding of 8-bit local variable
sub2 des
; allocate 8-bit local variable called
cnt
psha
; save register A
pshx
; save register X
;****body of the subroutine
; .
......
other stuff.
......
ldx