Answered step by step
Verified Expert Solution
Link Copied!

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

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

Professional Microsoft SQL Server 2014 Administration

Authors: Adam Jorgensen, Bradley Ball

1st Edition

111885926X, 9781118859261

More Books

Students also viewed these Databases questions

Question

=+free to pirate employees from competitors?

Answered: 1 week ago