Assignment 4 for CSCI 255

Due date

This assignment must be submitted as a single file named yourlastname.asm for Assignment 4 of the CSCI 255 section on UNCA moodle by 11:00 PM on Wednesday, 2 November.

The task

This assignment is similar to that exciting classroom presentation of an LC-3 implementation of C's < operator. However, this time you're going to implement C's << operator for two unsigned integers.

For two unsigned integers E1 and E2, E1 << E2 is the result of shifted E1 to the left E2 times while shifting a zero into the vacated rightmost bit. If E1 is stored in R1, E2 is stored in R2, and the result is to be stored in R0; this means copying R1 into R0 and then adding R0 to itself R2 times.

The C language reference manual specifies that, if E2 is greater than the number of bits in E1 (which is 16 for the LC-3), the result of the shift is "undefined". However, let's make the result 0 in that case.

Suggestion

This isn't as hard as Assigment 3, but you've got a week to do it.