Q3. Demonstrate the process of executing a nested subroutine, where you will have three subroutines. Subroutine...

Free

50.1K

Verified Solution

Question

Electrical Engineering

Q3. Demonstrate the process of executing a nested subroutine,where you will have three subroutines. Subroutine number 2 will becalled from subroutine number 1, while subroutine number 3 will becalled from subroutine number 2. In Keil uVision, screenshot yourresult, by showing the value of PC and LR. Discuss your results byrelating the values in PC, LR and stack for each subroutine call.

Answer & Explanation Solved by verified expert
3.6 Ratings (569 Votes)

Example:Example:

AREA subrout, CODE, READONLY     ; Name this block of code

ENTRY                     ; Mark first instruction to execute

start   MOV     r0, #10 ; Set up parameters
           MOV     r1, #3

           BL      doadd   ;

Call subroutine

stop    MOV     r0, #0x18         ; angel_SWIreason_ReportException

LDR     r1, =0x20026      ; ADP_Stopped_ApplicationExit

SVC     #0x123456         ; ARM semihosting (formerly SWI)

doadd   ADD     r0, r0, r1        ; Subroutine code
        BX      lr                ; Return from subroutine
        END                       ; Mark end of file


Get Answers to Unlimited Questions

Join us to gain access to millions of questions and expert answers. Enjoy exclusive benefits tailored just for you!

Membership Benefits:
  • Unlimited Question Access with detailed Answers
  • Zin AI - 3 Million Words
  • 10 Dall-E 3 Images
  • 20 Plot Generations
  • Conversation with Dialogue Memory
  • No Ads, Ever!
  • Access to Our Best AI Platform: Flex AI - Your personal assistant for all your inquiries!
Become a Member

Other questions asked by students