You are on page 1of 12

Agenda

:
Problem solving session – Test Preparation
(Continued…)
All questions pertain to the HC11 MPU
1- In the HC11 list the number o! bits used in the:
address bus 1" data bus # ea$h memor% $ell
# a$$umulator A # CC& ---#-- inde' registers (
1" sta$) pointer 1" double a$$umulator 1" *
+- ,hat is the highest address that $an be addressed
using -./0 one b%te in the "#HC111
23344 5+66
13
7
8- 9tarting at address 233++ :rite the mnemoni$ $ode to
load immediate the he' value 2;# into a$$umulator A
/<AA =2;# 5= : immediate7 + b%tes
;- ,hat is the $ontent o! the program $ounter
immediatel% a!ter e'e$uting the $ode in 5871
PC > 233+;
6- ,rite the $ode starting at address 23383 to load
a$$umulator ? :ith the $ontents o! address 233;3
using minimum number o! b%tes* 5Ho: man% b%tes
o! memor% at a minimum are required !or this17
/<A? 2;3 5+b%tes7 : <ire$t
"- ,hat is the $ontent o! the program $ounter at end o!
$ode in 5671
PC > 2338+
@- Again in an #-bit s%stem :rite the mnemoni$ $ode to
store the he' value 24A at address 23?+C* ,hat t%pe o!
addressing mode is used here1
/<AA =2;A 5loaded the value into ACC A7
9TAA 23?+C
A'planation:
2#"
2;A
2?@
23?
2+C
.umber o! b%tes > 6 b%tes
#- In the same s%stem :rite a mnemoni$ $ode to load the he'
value 23201 stored at starting lo$ation 21A26 into BoneC
a$$umulator* 9pe$i!% the a$$umulator used !or this purpose*
Also :hat is the $ontent o! ACC? !ollo:ing the e'e$ution o!
the instru$tion1
- Must use ACC - <
/<< 21A+" 5load into < the $ontest o! 21A+"7
A'tended addressing mode
<> DA ?E > D 28+ 231E
F- :hat are the $ontents o! a$$umulators A and ? i! a!ter the
e'e$ution o! the $ode in 5#7 the !ollo:ing $ommand :as
e'e$uted: A<<< =21A+4
A<<< =21A+4 : add to $ontents o! < the 21A+4
28+31
21A+4 G
---------
> 26 3 83
A > 263
? >283
13- Per!orm the !ollo:ing #-bit binar% additions and !or ea$h
$ase give the e'pe$ted result in the $arr% 5C7 Hero 5I7 sign
5.7 and over!lo: 5J7 bits:
a7 1 1 3 1 1 3 1 1 b7 3 1 1 3 3 3 1 3
G 3 3 1 3 3 3 3 1 G 3 3 1 3 3 3 1 3
11111133 13333133
. >1 . >1
J >1
$7
11111111
33333331
1 33333333
C >1 I >1
d7
13311331
13333313
-------------
1 33311311
C >1 J >1
11- ,hat does this do /<< 233+;1 ?e spe$i!i$
/oads a$$ < :ith the $ontents o! lo$ation 233+; 5<ire$t7
1+- ,hat is the o!!set i! the instru$tion BEQ $0051 starts
at address 2338@ in a program $ode*1
-!!set > <estination- -rigin > 23361 - 2338F > 21#
The ma$hine $ode :ould be :
2+@
21#
18- ,hat t%pe o! addressing mode is used in 51+71
&elative
1;- 9tarting at address 23333 :rite an instru$tion $ode to
do the !ollo:ing:
a- /oad a$$umulator ? :ith the value stored at address
2338F 5this is a positive value7
b- In$rement a$$umulator ?
$- Che$) the $ontents o! address 2338+*
i- I! the value is positive load the $ontents o! 2318+
into A then stop the program*
ii- I! the value in 2338+ is negative load immediate
? :ith the value o! 23# and stop the program
iii- I! the value in 2338+ is equal to Hero store the
$ontents o! a$$umulator ? to address 2338+ and go to
step b*
Use onl% one HA/T instru$tion*
He'
Address
Mnemoni$
-p-
Code5He'7
Comments
3333 /<A? <" /-A< –<I&ACT- I.T- ?
C-.TA.T9 -4
3331 28F 8F THI9 /-CATI-.
333+ I.C? 6C ? > ?G1
3338 /<AA F" /-A< I.T- A
333; 28+ 8+ THA JA/UA AT THI9
/-CATI-.
3336 CMPA #1 C-MPA&A C-.TA.T9 -4 A
333" 233 33 T- THI9 JA/UA
A – 33 >  &AI9A 4/AK9
333@ ?HI ++ I4 aL3
333# 234 06
333F  ?/- +6 I! A M 3
333A 21; 3F
333? 9TA? <@ 9ave a $op% o! ?
333C 28+ 8+ here
333< ?&A +3 /oop
333A 3+ F3 ,ith this o!!set
3334  /<AA ?" /oad A :ith $ontents o!
3313 231 31
This lo$ation
3311 28+ 8+
331+ ?&A +3
9)ip to stop program
3318 21" 02
331; /<A? C"
9et ? > 3#
3316 3# 3#
331" H/T 8A 9top the program
4et$h and A'e$ute A'ample:
A'plain the !ollo:ing in terms o! 4et$h and A'e$ute*
1-
/<A? 231
9TAA 21+8@
-bNe$tive:
1- Illustrate the 4et$h and e'e$ute $%$les
+- <etermine = o! b%tes !or ea$h instru$tion
8- The number o! Be'e$utionC $%$les
A-/<A? =231
/oad into a$$ ? the value o! 231 5Immediate7
4et$h
Instr*
Per!orm
-peration
59et ? > 317
<e$ode
Inst*
?%tes: + b%tes
C%$les: + A'e$ution C%$les
A-5e'tra7 /<A? 231
/oad into a$$ ? the $ontents o! 231 5<ire$t7
?%tes: + b%tes
C%$les: 8 e'e$ution $%$les
4et$h
Instr*
-btain
Address o!
operand
<e$ode
Inst*
-btain the
data
Per!orm
-peration
?- 9TAA 21+8@
?%tes: 8
A'e$* C%$lesO ;
4ill in the table belo: to per!orm the !ollo:ing operations in
sequen$e* The instru$tions start at address 233+3*
a- set the $ontents o! a$$umulator A to 23C
b- trans!er the $ontents o! A to ? 5$reate a $op% o! A in ?7
$- in$rement the $ontents o! a$$umulator A
d- store the $ontents o! ? at lo$ation 2+A
e- 9tore the $ontents o! a$$umulator A to lo$ation 2+4
!- 9ubtra$t !rom ? the $ontents o! lo$ation 283
g- 9top the program*
He' Address -p-Code
5He'7
Mnemoni$
Comments
33+3 #" /<AA
9et A to
4et$h Instru$tion
<e$ode Instr*
-btain Higher
?%te Address
Put <ata on <ata
&egister
-btain /o:er
?%te Address
Put <ata on
<ata &egister
5obtain !or A7
-btain /o:er
?%te Address
Per!orm -peration
33+1 3C 23C
Aqual this value
33++ 1" TA?
Create a $op% o! A into ?
33+8 ;C I.CA
AAG1
33+; <@ 9TA?
9tore the $ontents o! ? to
33+6 +A 2+A
This lo$ation
33+" F@ 9TAA
9tore $ontents on A
33+@ +4 2+4
to this lo$ation
33+# <3 9U??
??-D283E
33+F 83 283
33+A 8A ,AI
stop
33+?
33+C
33+<
33+A M<ataL M<ataL
33+4 M<ataL M<ataL
3383 236
<ata
Problem .o* +
4or Problem .o* 1 ans:er the !ollo:ing:
1- Ho: man% b%tes does the instru$tion o! step 5a7 require1 2
+- ,hat is the $ontent o! the program $ounter a!ter the e'e$ution o! step
5a71
$0022
8- Ho: man% b%tes does the instru$tion o! step 5b7 require1
1
;- Ho: man% b%tes 5in$luding data lo$ations7 does the program o!
problem .o*1 require1
14
6- ,hat are the $ontents o! a$$umulator A and a$$umulator ? a!ter the
$omplete e'e$ution o! the program1
A>23<
?>3@
Problem no*8 &e!er to Te'tboo)
1- <ra: the programmerPs model* 5&e!er to page 637
+- ,hi$h are t:o b%tes registers1 ( ix, iy, D) PC, Address Register
8- In the $ondition $ode register :hat do the !ollo:ing represent1
a* J: I set, ! "!rry #r $#rr#% &'st #""'rred
%(e) 'si)g 2*s "#+,
b* I I set, i)di#"!ted !) #,er!ti#) res'-ted i)
! .er#
$* C I set, ! "!rry #r $#rr#% #""'red
d* . I set, !) #,er!ti#) res'-ted i) ! )eg!ti/e
)'+$er0