Question: I am writing a code for the LC3 Simulator. This is in assembly, I need assistance with the numbers 5-8. Thank you. ALU OPERATIONS 1.
I am writing a code for the LC3 Simulator. This is in assembly, I need assistance with the numbers 5-8. Thank you.
ALU OPERATIONS
1. Compute the sum X +Y and place it at location x3102.
2. Compute X AND Y and place it at location x3103.
3. Compute X OR Y and place it at location x3104.
4. Compute NOT(X) and place it at location x3105.
5. Compute NOT(Y) and place it at location x3106.
6. Compute X +3 and place it at location x3107.
7. Compute Y 3 and place it at location x3108.
8. If the X is even, place 0 at location x3109. If the number is odd, place 1 at the same location
MY CODE SO FAR (COMPLETED 1-4):
.ORIG x3000 LEA R2, xFF ;R2 Loaded with the begenning address of data LDR R1, R1, x0 ;X, located at x3100, and loaded in R1 LDR R3, R2, x1 ;Y, located at x3101, and loaded in R2
;X + Y AND R4, R4, x0 ;Clearing R4 ADD R4, R1, R3 ;Addition of X and Y STR R4, R2, x2 ;Storing in x3102
;And Gate of X and Y AND R4, R4, x0 ;Clearing R4 AND R4, R1, R3 ;AND gate STR R4, R2, x3 ;Storing in x3103
;OR of X and Y AND R4, R4, x0 NOT R1, R1 NOT R3, R3 AND R4, R1, R3 NOT R4, R4 STR R4, R2, x4
;RESTORE NOT R1, R1 NOT R3, R3 ;NOT GATE OF X AND R4, R4, x0 AND R4, R1, R1 NOT R4, R4
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
