PLEASE SOLVE WILL RATE AND THUMBS UP
Simple assembly code question: In this question you will write a simple program to loop through an array (i.e., writing while statements in assembly) of non-zero numbers. Write an LC3 assembly program for converting a list of non-zero integers into their absolute values. The program starts at x3000. It will first load the address ARRAY of the start of the list into register R0. After this, R0 now contains the location in memory of the start of the list, and the end of the list of numbers is signified by a zero. The code will replace the number in the list with its absolute value. (You can reuse the code for this question in other programs you write.)
For example, if ARRAY= x4000 then R0 will contain the value x4000, and the memory contains the following values
x4000: 10
x4001: -20
x4002: 15
x4003: 0
then the program writes out the following values into the locations:
x4000: 10
x4001: 20
x4002: 15
x4003: 0
Running your program. We would like you to work with an example where you load data from another object file (and ARRAY starts at x4000)– the simulator allows you to load multiple object files.
Following image contains the LC3 code.
WHILE label indicates the while loop .The absolute value of the non zero integer is checked by first checking if the number is postive or negative and if the number is negative it's absolute value is calculated.
Get Answers For Free
Most questions answered within 1 hours.