Question: 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
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
