Question
Hello I need help with the problem above, I tried to write the code but it does not compile. It has to be in assemble
Hello I need help with the problem above, I tried to write the code but it does not compile. It has to be in assemble language in LC3, I put the code I have written below can someone please fix my errors or write the correct code, please.
.ORIG x3000 LDI R0, X LDI R1, Y NOT R4, R2 ADD R4, R4, #1 ADD R3, R1, R4 STI R3, sub ADD R5, R1, #0 BRzp ABSX NOT R5, R5 ADD R5, R5, #1 ABSX STI R5, absx ADD R6, R2, #0 BRzp ABSY NOT R6, R6 ADD R6, R6, #1 ABSY STI R6, absy NOT R6, R6 ADD R6, R6, #1 ADD R5, R5, R6 BRzp Z01 AND R7, R7, #0 ADD R7, #2 STI R7, Z Z01 LDI R5, R5 BRz Z1 AND R7, R7, #0 ADD R7, R7, #0 STI R7, Z BR STOP Z1 AND R7, R7, #0 ADD R7, R7, #1 STI R7, Z STOP .HALT X .FILL x3120 Y .FILL x3121 sub .FILL x3122 absx .FILL x3123 absy .FILL x3124 Z .FILL x3125 .end
ARITHMETIC FUNCTIONS 2.1 Problem Statement The numbers X and Y are found at locations x3120 and x3121, respectively. Write a program in LC-3 assembly language that does the following: . Compute the difference X -Y and place it at location x3122. . Place the absolute values l and P1 at locations x3123 and x3124, respectively . Determine which ofand P1 is larger. Place l at location x3125 if XI is, a 2 ifIYI is, or a 0 if they are equal. 2.1.1 Inputs The integers X and Y are in locations x3120 and x3121, respectively: x3120X x3121Y 2.1.2 Outputs The outputs at their corresponding locations are as follows x31 x3123 x3124Y x3125Z X-Y where Z is defined as Revision: I.II, Jamuary 26, 2007 2-1 ARITHMETIC FUNCTIONS 2.1 Problem Statement The numbers X and Y are found at locations x3120 and x3121, respectively. Write a program in LC-3 assembly language that does the following: . Compute the difference X -Y and place it at location x3122. . Place the absolute values l and P1 at locations x3123 and x3124, respectively . Determine which ofand P1 is larger. Place l at location x3125 if XI is, a 2 ifIYI is, or a 0 if they are equal. 2.1.1 Inputs The integers X and Y are in locations x3120 and x3121, respectively: x3120X x3121Y 2.1.2 Outputs The outputs at their corresponding locations are as follows x31 x3123 x3124Y x3125Z X-Y where Z is defined as Revision: I.II, Jamuary 26, 2007 2-1Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started