Question: Write an ARM assembly language combination of a main program and a subroutine. The main program should set up the stack pointer with the

Write an ARM assembly language combination of a main program and a subroutine. The main program should set up

Write an ARM assembly language combination of a main program and a subroutine. The main program should set up the stack pointer with the start of the stack at 0x20001000. The main program should call the subroutine at least once, with proper input arguments. You are going to write a subroutine to copying a string from one memory location to another, just like the function strcpy(str_from, str_to) in the C-language. The ARM assembly language subroutine should be named StrCpy. The subroutine StrCpy should take any two pointers from the main program, just like C-language subroutine, one pointer to copy data from and another pointer to copy data to. Each of the data pointer must be passed to the StrCpy in a separate register, the pointer to copy data from must be passed in RO and the pointer to copy data to must be passed in R1. The StrCpy is not expected to return any value. The label for string to copy from is "myStrToCopy" and the memory address for string to be copied to is 0x20001200. The subroutine can use other registers as needed, but the subroutine must preserve all the registers it uses, except RO and R1. myStrToCopy DCB "I want to copy this string!!!", 0x0 Remember rules of C-strings; the last character on the string has to be NULL, i.e. Ox0. Hint: Use can you loop construct to write your subroutine. Note: You must use STM and LDM instructions to get full credit, no PUSH and POP instructions allowed.

Step by Step Solution

3.47 Rating (154 Votes )

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock

ARM Assembly AREA text CODE READONLY ENTRY main MOV R13 0x200010... View full answer

blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!