Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Read the assembly code and the function prototype carefully and answer the following questions: a. How do you change the prototype code so that you
Read the assembly code and the function prototype carefully and answer the following questions:
a. How do you change the prototype code so that you can pass count to the function instead of
using the global variable?
b. How do you change the assembly code so that you can use the passed argument for count
instead of the global variable?
here is the code
AREA strcopy, CODE
IMPORT count
EXPORT strcpy_asm_in_s
ALIGN
strcpy_asm_in_s PROC
LDR r2, =count
LDR r2, [r2]
SUB r2, r2, #1
loop CMP r2, #0
BEQ end_loop
LDRB r3, [r0], #1
STRB r3, [r1], #1
SUB r2, #1
B loop
end_loop
STRB r2, [r1]
BX lr
ENDP
END
The above function has to be declared in a .c file before it can be used, as shown below.
extern void strcpy_asm_in_s(const char *src, char *dst);
uint8_t count = 20;
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