# 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.

 `R0` `A000` `R1` `A100` `R2` `A200` `R3` `A300` `R4` `A400` `R5` `A500` `R6` `A600` `R7` `A700`

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

 `x4210` `B000` `x4211` `B100` `x4212` `B200` `x4213` `B300` `x4214` `B400` `x4215` `B500` `x4216` `B600` `x4217` `B700`

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.

 `BROADWAY` `421B` `EDGEWOOD` `4251` `MERRIMON` `4309` `WEAVER` `4402`

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`