Assembler Directives and Memory Table Analysis, Assignments of Computer Architecture and Organization

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

Pre 2010

Uploaded on 08/18/2009

koofers-user-k3c
koofers-user-k3c 🇺🇸

10 documents

1 / 2

Toggle sidebar

This page cannot be seen from the preview

Don't miss anything!

bg1
Consider the assembler directives given below when answering the following questions.
1. Show the data in memory after the directives above have been assembled.
2. Based on your answers above, show the value of each label in the symbol table after the first pass of
the assembler.
3. Based on your answers above, show the assembly code for each instruction below, as it appears after
the second pass of the assembler.
3a. MOVE.W #INC, D1
MOVE.W #1, D1
3b. MOVE.L ARRAY, D3
MOVE.L $002002, D3
3c. MOVE.L #MAX, A0
M
OVE.L #$002000, A0
CEG 320/520: Computer Organization and Assembly Language Programming
Fall, 2004
In Class : Assembler Directives and the Symbol Table - Solution updated:20-sep-04
1 ORG $002000
2 MAX DC.W 5
3 INC EQU 1
4 ARRAY DS.L 2
Memor
y
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 $002000
INC 1
ARRAY $002002
pf2

Partial preview of the text

Download Assembler Directives and Memory Table Analysis and more Assignments Computer Architecture and Organization in PDF only on Docsity!

Consider the assembler directives given below when answering the following questions.

  1. Show the data in memory after the directives above have been assembled.
  2. Based on your answers above, show the value of each label in the symbol table after the first pass of the assembler.
  3. Based on your answers above, show the assembly code for each instruction below, as it appears after the second pass of the assembler.

3a. MOVE.W #INC, D

MOVE.W #1, D

3b. MOVE.L ARRAY, D

MOVE.L $002002, D

3c. MOVE.L #MAX, A

MOVE.L #$002000, A

CEG 320/520: Computer Organization and Assembly Language Programming

Fall, 2004 In Class : Assembler Directives and the Symbol Table - Solution updated:20-sep-

1 ORG $

2 MAX DC.W 5

3 INC EQU 1

4 ARRAY DS.L 2

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 $

  1. Based on your answers above, give the instructions that would perform the operation described in each question.

4a. Move the address of ARRAY into address register A0.

MOVE.L #ARRAY, A

4b. Move the value of MAX into data register D1.

MOVE.W MAX, D

4c. Move the value of INC into data register D1.

MOVE.W #INC, D

4d. Move the first element of ARRAY into data register D1.

MOVE.L ARRAY, D

  1. Describe the problem with each of the following instructions, and give the correct version.

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