Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Can you help me solve the error of A label was found which was in no area. The assignment is the picture and the code
Can you help me solve the error of "A label was found which was in no area". The assignment is the picture and the code im using is "AREA text, CODE, READONLY
EXPORT main
EXPORT euclid
; Function: euclid
; Calculates the greatest common divisor GCD of two integers x and y
; Parameters:
; R int x
; R int y
; R int result
euclid
STMFD SPRR LR ; Push registers RR and LR onto stack for preserving them
MOV R R ; Move x to R
MOV R R ; Move y to R
; Make x positive
CMP R #
MOVGE R R ; If x R R
RSBLT R R # ; If x RR
; Make y positive
CMP R #
MOVGE R R ; If y R R
RSBLT R R # ; If y RR
MOV R R ; Move positive x to R
MOV R R ; Move positive y to R
euclidloop
CMP R R ; Compare R and R
BEQ euclidend ; If equal, GCD found
BGT euclidsubtract ; If R R subtract R from R
SUB R R R ; Else, subtract R from R
B euclidloop
euclidsubtract
SUB R R R
B euclidloop
euclidend
STR RR ; Store the result at the address in R
LDMFD SPRR PC ; Pop registers RR and PC return from function
; Function: main
; Initialize variables and call euclid function
main
STMFD SPLR ; Push LR onto stack for preserving it
; Initialize variables DCD directives will go in the data area
LDR R ; Load x
LDR R ; Load y
LDR Rx ; Address to store result earbitrary address
BL euclid ; Call euclid function
; Initialize other variables and repeat calls to euclid as necessary
LDMFD SPPC ; Pop PC to return from main
END". Is the code correct and can u fix the error for me im using keil uvision big endian
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started