Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Write an ARM program that takes takes an input n and uses recursion to print n down to zero and back to n. Here is

image text in transcribed

Write an ARM program that takes takes an input n and uses recursion to print n down to zero and back to n. Here is sample output [root@debian-aarch 4:/ workdir\# gcc -o printfun printfun.s g ir[root@debian-aarch64: /workdir\#./printfun [Please enter a number: 4 iP i 3 i 2 is 1 ir 0 i 2 i 3 i 4 is root@debian-aarch64: /workdir\# Here is the ct+ code for the procedure. (This is simply meant to help you understand the assignment!!) Requirements and Specifications Your inputs n cannot be stored as a global variable at any point. This means you cannot store them at a data section address, even when accepting them from scanf; they must be returned from scanf on the stack. X19X27 are global variables. You may not use X19X27 in your recursive function. If you want, you may use X19X27 in your main function. You can use any registers you want to in your main function. A recursion procedure requires: - Allocate stack space - Save the return address and argument on the stack. - Recursively call procedure with BL - Unwind the stack by restoring the return address and arguments and deallocating stack memory Hints and Warnings You must put the argument and return address on the stack before any bl call, and restore the argument and the return address after the bl call. This includes every printf call and every recursive call

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

Spatio Temporal Database Management International Workshop Stdbm 99 Edinburgh Scotland September 10 11 1999 Proceedings Lncs 1678

Authors: Michael H. Bohlen ,Christian S. Jensen ,Michel O. Scholl

1999th Edition

3540664017, 978-3540664017

More Books

Students also viewed these Databases questions