Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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 0x00.), generate a sorted linked-list 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 x8,93
svc 0
here are the existing procedures:
insert:
cbz x1, new_head
ldr x2,[x0]
mov x3, x1
mov x4,0
loop:
ldr x5,[x3]
cmp x2, x5
b.le earlier_val
mov x4, x3
ldr x3,[x3,8]
cbz x3, end
b loop
new_head:
str x1,[x0,8]
mov x7, x0
ret
earlier_val:
str x3,[x0,8]
cbz x4, set_head
str x0,[x4,8]
mov x7, x1
ret
end:
str x0,[x4,8]
str xzr,[x0,8]
mov x7, x1
ret
set_head:
mov x7, x0
retnew:
mov x1, x0
mov x8,0xD6
mov x0,0
svc 0
mov x2, x0
add x0, x2,16
mov x8,0xD6
svc 0
str x1,[x2]
mov x3,0x0
str x3,[x2,8]
mov x7, x2
ret

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Concepts of Database Management

Authors: Philip J. Pratt, Joseph J. Adamski

7th edition

978-1111825911, 1111825912, 978-1133684374, 1133684378, 978-111182591

More Books

Students also viewed these Databases questions