

Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
Prepare for your exams
Study with the several resources on Docsity
Earn points to download
Earn points by helping other students or get them with a premium plan
Solutions to assembler directive-related questions, including showing memory contents after assembler directives, label values in the symbol table after the first pass, and assembly code for specific instructions. It also includes corrections for incorrect instructions.
Typology: Assignments
1 / 2
This page cannot be seen from the preview
Don't miss anything!


Consider the assembler directives given below when answering the following questions.
3a. MOVE.W #INC, D
3b. MOVE.L ARRAY, D
3c. MOVE.L #MAX, A
Fall, 2004 In Class : Assembler Directives and the Symbol Table - Solution updated:20-sep-
Memory Address Contents (in hexadecimal) Label (if applicable) $002000 $00 05 MAX $002002 ???? ARRAY (1st long word) $002004 ????^ ARRAY (1st long word) $002006 ???? ARRAY (2nd long word) $002008 ???? ARRAY (2nd long word)
Label Value MAX $ INC 1 ARRAY $
4a. Move the address of ARRAY into address register A0.
4b. Move the value of MAX into data register D1.
4c. Move the value of INC into data register D1.
4d. Move the first element of ARRAY into data register D1.
5a. MOVE.W INC, D
After INC is replaced with the number 1 during the second pass, this instruction looks like the source operand is absolute long, but it is referencing memory at location $000001, which is probably not what you want (it could be, but it is unlikely). Correct: MOVE.W #INC,D
5b. MOVE.W #ARRAY,A
#ARRAY indicates that you would like to move the immediate value of the address of ARRAY into A0. However, you have indicated that the operand size is W (WORD). Addresses are 24 bits, longer than a WORD, and therefore you will have incomplete information in A0. Correct: MOVE.L #ARRAY,A
5c. MOVE.W ARRAY,D
The elements in ARRAY were declared to be LONG WORDS, so using just .W here would result in copying only a part of the first array element. Correct: MOVE.L ARRAY,D