Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Lab 3 : String manipulation and memory addressing Objective The objective of this lab is to learn about the ARM instructions through programming an assembly
Lab : String manipulation and memory addressing
Objective
The objective of this lab is to learn about the ARM instructions through programming an assembly program using the materials covered in your textbook.
Background
By now, you are familiar with the ARM processor and its different kind of instructions data movement, arithmetic, code control, etc. In this lab, you will write a program that will put all this information to use. You are to write a program that will copy certain bytes of data in a string from one memory location to another memory location.
You will debug andor navigate and explain to your TA the program using the information you learned in chapters three and four, and the tools provided by the Altera Monitor Program AMP
Implementation
You will write a program that copies data from one memory location to another using several methods.
I Write a "copy" program
You are to write a program that will copy a string from one memory location to another. Your program should eliminate spaces between the characters when copying the string. For instance, the string "I am a Cane" should be copied as "IamaCane". To do this, you need to create space for the original message, destination message, copy one character at a time as long as it is not a space character.
Requirements:
Your program should copy the data as strings
Your program should be less than lines of code, comprehensively.
Compile and download your program to the board. In your project, click on the "Memory" tab and examine the content. What do you see? Explain the memory content to your TA and write down the answers in your lab report.
II Optimizing your program
Modify the code of your program so that it uses fewer instructions, compared to I Hint: You may need to consider instructions that handle multiple data transfer, such as multiple load and multiple store, or branching to different subroutines based on the result of a single comparison instruction
For instance, CMP R #
bne subR
b subR
Requirements:
Must use subroutines
Lab : String manipulation and memory addressing
How many instructions are you able to save, if any? Demonstrate the new program to your TA and write the new approach in your lab report.
Note: if you already used this approach for part I try a different approach eg a different addressing mode Part I and II of this lab cannot be the same.
III Expanding your program
Modify the code so that the program either copies the string forward, or backward. For instance, backwards mean "IamaCane" becomes "enaCamal". If the first character of the string is lower case letter, curly bracket, or tilde, then the program should copy the string backwards, otherwise the program should copy the string forwards.
Part III of this lab does not need to be optimized. You may use as many instructions or registers as you need to get the program executing.
Requirements:
Must use subroutines.
Demonstrate your program to your TA and describe your implementation in the lab report.
IV Lab Report
Complete the lab report and include the answers to the questions in sections I to III Follow the instructions in the lab report assignment to write your lab report.
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