Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

[ 3 0 ] < 2 . 9 > Write a program in LEGv 8 assembly to convert an ASCII string containing a positive or

[30]<2.9> Write a program in LEGv8 assembly to convert an ASCII string containing a positive or negative integer decimal string to an integer. Your program should expect register X0 to hold the address of a null-terminated string containing an optional + or followed by some combination of the digits 0 through 9. Your program should compute the integer value equivalent to this string of digits, then place the number in register X0. If a non-digit character appears anywhere in the string, your program should stop with the value 1 in register X0. For example, if register X0 points to a sequence of three bytes 50ten, 52ten, 0ten (the null-terminated string 24), then when the program stops, register X0 should contain the value 24ten. The ARMv8 MUL instruction takes two registers as input. There is no MULI instruction. Thus, just store the constant 10 in a register.
Do not give the whole implementation. Just the LEGv8 code, like:
LOOP:
SUBIS X1, X1, #1
B.LE DONE
ADDI X0, X0, #2
B LOOPDONE:

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_2

Step: 3

blur-text-image_3

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

More Books

Students also viewed these Databases questions

Question

1. What is Ebola ? 2.Heart is a muscle? 3. Artificial lighting?

Answered: 1 week ago

Question

1. Which is the most abundant gas presented in the atmosphere?

Answered: 1 week ago

Question

=+Does this message make effective use of the AIDA model?

Answered: 1 week ago