Question: Task 3 ( 3 0 pts ) : Converting String to Integer In this task, you ll write an assembly code to convert a string

Task 3(30 pts): Converting String to Integer
In this task, youll write an assembly code to convert a string to an integer. For example, say a string is declared
in the .data segment:
1.data
2 numstr: .string "382"
3 number: .quad 0
Then your program will convert the string into an integer 382, and store it to number . You dont need to
consider negative numbers.
Just a refresher: if the string is "9082", the number can be calculated by 9103+0102+8101+2100.
Be Careful...
The characters in a string are stored as their ASCII values, not the real digit;
When loading a character, or a byte, into a register, the command is LDRB or LDRSB , and the destination
register is Wt not Xt .
2
Requirements
You must use loops or recursion. If you want to use recursion, you must follow calling conventions and
manage stack frames;
You must not assume the length of the string numstr , so you must not declare and hardcode any variable
representing string length in .data and .text ;
You must store the converted integer into variable number ;
You must not use any external libraries and functions;
You must use system call to print, not printf() ;
Write your name and pledge at the top of the code.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock 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!