Quiz1a_S - 0306-250-01 Assembly Language Programming 3...

Info iconThis preview shows page 1. Sign up to view the full content.

View Full Document Right Arrow Icon
This is the end of the preview. Sign up to access the rest of the document.

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. MyCode: main: Entry: SECTION MyData: Result1: Result2: SECTION DS.W 1 DS.B 2 ldab CR ldd #$CEDE std Result2 ldab #‘A’ std Result1 ldab Result1 bra * nop MyConst: SECTION ;Maps to $C014 CR: DC.B 13 LF: DC.B 10 Data2: DC.W $FADE, 7 SCI_PE: DC.B %10 ZeroChar: DC.B $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. MyCode: main: Entry: SECTION ldab ldd std ldab std ldab bra nop CR #$CEDE Result2 #‘A’ Result1 Result1 * MyConst: CR: LF: Data2: SCI_PE: ZeroChar: SECTION DC.B DC.B DC.W DC.B DC.B MyData: Result1: Result2: SECTION DS.W 1 DS.B 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 13 10 $FADE, 7 %10 $30 0306-250-01 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. $1100 $1102 $1104 $1106 $1108 $110A $110C $EF09 $09D4 $0002 $2000 $0902 $8012 $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

Ask a homework question - tutors are online