Unformatted text preview: 0306-250-01 Assembly Language Programming 3 problems, 4 pages Quiz One Solution Fall 2009
September 25, 2009 Instructions: This quiz is closed book and closed note. Calculators and computers are not
permitted. If you have a question, raise your hand, and I will come to you. Please work the quiz
in pencil, and do not separate the pages of the quiz. For maximum credit, show your work. If
you need extra space for your work, raise your hand, and I will provide additional paper, which
you will submit with your quiz.
By submitting this quiz, you attest that you neither have given nor have received any
assistance in answering the quiz questions, and you further acknowledge that giving or
receiving such assistance will result in a failing grade for this quiz.
Best wishes! Your Signature: X Your Name (please print) Quiz One Solution 1 2 3 Total 20 60 20 100 1 0306-250-01 Assembly Language Programming 3 problems, 4 pages Quiz One Solution Fall 2009
September 25, 2009 Problem 1 (20 points) Condition Codes Suppose A is holding the value $4F. After the following instruction is executed, what is the hex
value in A, and what are the values of the CCR bits indicated?
adda #$70 A
$ BF CCR
1 0 1 0 N Z V C Problem 2 (2 parts, 60 points) Data Movement Instructions Consider the following HCS12 assembly language program.
Entry: SECTION MyData:
2 ldab CR
MyConst: SECTION ;Maps to $C014
$30 Part A (12 points) Registers What is the final value of D (in hexadecimal format)? (Your answer should show all bits in D.) D = $CECE 2 0306-250-01 Assembly Language Programming 3 problems, 4 pages Fall 2009 Quiz One Solution September 25, 2009 Part B (48 points: 4 points each blank) Memory For the program from Part A (shown again below), complete the memory map fragments that
follow with their final contents (i.e., after the program runs). For any memory location whose
content can not be determined from the information provided, enter “—” for its content.
2 Result1 $1100 $CE Word storage: $41
Result2 $CE 2-Byte storage: $DE Byte constant: 13: CR $C014 $0D Byte constant: 10 LF $0A Data2 $FA Word constant: $FADE $DE $C018 $00
Word constant: $0007 $07
Byte constant: %10 SCI_PE $02 Byte constant: $30 ZeroChar $30 3 ;Maps to $C014
3 problems, 4 pages Assembly Language Programming
Quiz One Solution Fall 2009
September 25, 2009 Problem 3 (2 parts, 20 points) Memory Addressing Consider the word memory map below.
$7990 Part A (10 points)
Suppose X initially contains the value $1104. Based on the memory map above, after the
following instruction executes, what does contain? (Your answer should show all bits in X.)
ldx 1,x X = $0220 Part B (10 points)
Explain your answer above for Part A. (In other words, why does X contain this value after the
instruction: ldx 1,x?)
The operand uses address register indirect with displacement addressing. The sum of
the value in X and 1 is used as the address for reading a word (i.e., two bytes) from
memory. X contained $1104, and the word from memory starting at address $1105,
(i.e., $1104 + 1), is $0220, which will be the value in X when the instruction completes. 4 ...
View Full Document