Question: Consider the following data structure, found in the file linked. s , expressed in E 2 0 assembly language: The above code describes a linked

Consider the following data structure, found in the file linked. s, expressed in E20 assembly language:
The above code describes a linked list, starting at memory address head. Each node in the linked list
occupies two memory cells: the cell at address n stores a 16-bit number, an element of the list. The
cell at address n+1 stores either the pointer to the next node, or zero, indicating that there is no next
node.
In other words, the memory layout of the nodes of this linked list correspond to this C++ data
structure:
In addition to the linked list itself, the above code includes certain "garbage values" that, although
present in memory, are not part of the linked list.
Your task is to write a program in E20 assembly language that will calculate the sum of all elements
in the above linked list. Your program must iterate through the list until it reaches its end. The only
data label that your program may refer to by name is head; however, you may define and use your
own labels within your code. Your program should leave the sum in register $1 before halting.
Your solution must be thoroughly commented, or else it will not be graded. Make sure that the
comments help the grader understand the intent of your code.
Include the provided data structure in your submission. Submit your complete file named linked.s.
Consider the following data structure, found in

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 Programming Questions!