Assignment 4 for CSCI 255 / ECE 109

This is the first of three little LC-3 programming assignments that will be due April 10, 17, and 24. There will also be a small non-programming assignment due on April 24.

Due date

This assignment must be submitted as a single file for Assignment 4 of the CSCI 255/ECE 109 section on UNCA moodle by 5:00 PM on Friday, 10 April.

Programming Task

In Assignment 2 the following encoding was used for transforming seven-bit inputs into a three-bit encoding.

Binary inputsASCII character input
000 Character '0'
001 Characters '1' to '7'
010 Characters '8' or '9'
011 Characters 'A' to 'F' or 'a' to 'f'
100 Characters 'u' or 'U'
101 Characters 'l' or 'L'
110 Characters 'x' or 'X'
111 Any character not covered by the above cases

Your assignment is to write a LC-3 program to perform this encoding. Here are a few more rules:

  1. Your program must be loaded at address x3400. That is, it must start with the psuedo-op .ORIG x3400.
  2. Your program must accept its input as a sixteen-bit value stored in register R0.
  3. Your program must not change R7.
  4. Your program must store the encoded result into register R0 and then call the RET instruction (which I know we have yet to cover in class).
  5. Your program must follow the official flowchart.
  6. Your program must be the result of your own creative work.

A sample and a driver

The program DecodeLong.asm is an example of a program that solve most of this problem. Don't try to use it as a starting point for a solution as it doesn't follow the official flowcart and it is really very inefficient in its use of address space.

The program TestAssign4.asm can be used to test your program on many samples. To use TestAssign4.asm you must first load your program into the LC-3 simulator and then load TestAssign4.asm. When you run the two loaded programs, you should see a table of outputs appearing from memory locations x3FF8 to x40FF.