Question: Write a program to read data starting at the label data: ( the end of the data will be indicated by 0 x 0 0
Write a program to read data starting at the label data: the end of the data will be indicated by x generate a sorted linkedlist using the new: and insert: procedures described above, then flatten: the sorted list back into memory starting at the label data:.
You may assume the existence of procedures new:, insert:, and flatten: as described previously. Since you don't know the implementation details of these procedures, you'd better save any register values you care about!
main:
your code goes here
mov x
svc
here are the existing procedures:
insert:
cbz x newhead
ldr xx
mov x x
mov x
loop:
ldr xx
cmp x x
ble earlierval
mov x x
ldr xx
cbz x end
b loop
newhead:
str xx
mov x x
ret
earlierval:
str xx
cbz x sethead
str xx
mov x x
ret
end:
str xx
str xzrx
mov x x
ret
sethead:
mov x x
retnew:
mov x x
mov xxD
mov x
svc
mov x x
add x x
mov xxD
svc
str xx
mov xx
str xx
mov x x
ret
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
