Question: please follow the submission and provide the binary or hex portion for the text file and 3 screenshots for each X and Y . Programming

please follow the submission and provide the binary or hex portion for the text file and 3 screenshots for each X and Y.
Programming Assignment 1
Objective:
The objective of this lab assignment is to demonstrate your ability in
Moving data from memory locations to a register and vice versa;
Negating a positive integer;
Adding two numbers with both numbers stored in registers or one stored in a register
and one being a literal;
Performing logical ADD, NOT, and OR operations;
Checking the parity of a number.
Lab Statement:
Two numbers, x and Y, are stored in memory locations 03050 and 03051 respectively. Write
an LC-3 machine language program that does the following:
Compute the sum of x and Y and place it at location 03052.
Compute x-Y and store the result at location 3053
Compute X AND Y and store the result at location 0x3054
Compute NOT(X) and store the result at location 0x3055.
Compute x OR Y and store the result at location 03056.
Compute x+3 and store the result at location 03057
Computer x-3 and store the result at location 03058
If x is even, place 0 at location 03059; otherwise, meaning if x is odd, place 1 at
03059.
LC-3 Syntax:
Move data to/from memory locations.
LC-3 has three set of instructions to move data to/from memory locations: LD/ST,
LDR/STR, and LDI/STI. They differ in how they calculate the address of the memory
location. LD/ST use a PCoffset9, meaning the address is calculated by adding the
incremented PC to a 9-bit offset supplied by the user in the instruction. Since the offset
is limited to a 9-bit 2's complement integer, the range of the offset is -256 to 255 in
decimal, or x1FF-xOFF. You can use LD/ST if the target location is within this range. In
this lab assignment, if the program begins at 3000, the target locations, 3050-3058,
are within the offset range. We can use LD/ST to move the data around.
For example, if the first statement, which is stored in 3000, is to move x, stored in
x3050, to RO, the instruction will be formed as followed:
Opcode: 0010
Operand 1: 000(DR)
Operand 2: The PC will be incremented to 3001 when this instruction is being
executed and the location for x is 3050. Therefore the offset is (x3050)-
(x3001)=x004F. So the 9-bit offset is 04F or 001001111.
Instruction: 0010000001001111=x204F
Subtraction
LC-3 does not have an instruction for subtraction. However, x-Y=x+(-Y). We need to
form -Y through 2's complement by finding NOT (Y) first then add one to the result
OR operation
LC-3 does not have an OR instruction. However, de Morgan rule says, ?bar(A)ANDbar(B)=
?bar(A)ORbar(B)=A OR B. Therefore A or B can be evaluated as NOT((NOT A) AND (NOT B))
Checking parity
In binary format, the parity can be decided by the least significant bit, or bit 0. An
integer is even if bit 0 is 0 and is odd if bit 0 if 1. One way to determine the parity is to
AND the number with x0001(which is a bit mask for this purpose).
Testing:
Use the following pairs of (X, Y) for testing: (10,21),(-11,15),(9,12).
Submission:
Your machine code, either in binary or hex, in a text file.
For each pair of (x,Y), the screen shot of contents of locations 0x3050 through 0x3059.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!