CSCI 255 Homework 7

This assignment is due in class or to my office assistant in RH 215 by 1:45 pm on 6 November.

Problem 1

Suppose the eight registers of the LC-3 have the following values.

R0A000
R1A100
R2A200
R3A300
R4A400
R5A500
R6A600
R7A700

Also suppose that the eight memory locations from memory address x4210 to x4217 have the following values.

x4210B000
x4211B100
x4212B200
x4213B300
x4214B400
x4215B500
x4216B600
x4217B700

For the ten addresses shown below, write a single LC-3 instruction to load the values stored in specified memory location into register R4. If the location can't be loaded in one instruction, state why this is not possible.

Assume that the LC-3 instruction is stored at location 4200 when attempting to address all of these addresses.

  1. 3000
  2. 4100
  3. 4101
  4. 4200
  5. 4201
  6. A030
  7. A0FF
  8. A111
  9. B001
  10. B100

Problem 2

Use the symbol table shown below in this question.

BROADWAY421B
EDGEWOOD4251
MERRIMON4309
WEAVER4402

Write the appropriate 16-bit LC-3 machine language word, in binary or hex, for each assembly language statement shown below. Assume that the address is located at 4200 in all cases. If the assembly language statement is illegal, state the reason why.

  1. ADD     R0,R3,#5
  2. AND     R0,R3,R5
  3. AND     R0,R3,#25
  4. BR      EDGEWOOD
  5. BRn     MERRIMON
  6. BRp     WEAVER
  7. LD      R5,EDGEWOOD
  8. LDI     R5,BROADWAY
  9. LDR     R5,R3,#0
  10. LDR     R5,R3,#-19