Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Can somebody help me convert thid code to ARM Assembly language program str2int: #convert string to integer li $t6, 0x30 #$t6= 0 li $t7, 0x39

Can somebody help me convert thid code to ARM Assembly language program

str2int: #convert string to integer li $t6, 0x30 #$t6= 0 li $t7, 0x39 #$t7= 9 li $v0, 0 #initialize $v0=0 move $t0,$a0 #$t0=pointer to string lb $t1,($t0) #load $t1=digit character LOOP : blt $t1,$t6, NoDigit #char < 0 bgt $t1,$t7, NoDigit #char > 9 subu $t1,$t1,$t6 #convert char to integer mul $v0,$v0,10 #multiply by 10 add $v0,$v0,$t1 #$v0=$v0x10+digit addiu $t0,$t0,1 #point to next char lb $t1,($t0) #load $t1=next digit bne $t1,$0, #branch if not end of string jr $ra #return integer value NoDigit: li $v0,-1 #return -1 in $v0 jr $ra

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

Visual Basic Net Database Programming

Authors: Rod Stephens

1st Edition

0789726815, 978-0789726810

More Books

Students also viewed these Databases questions

Question

What is meant by staff authority ?

Answered: 1 week ago

Question

Discuss the various types of policies ?

Answered: 1 week ago

Question

Briefly explain the various types of leadership ?

Answered: 1 week ago

Question

Explain the need for and importance of co-ordination?

Answered: 1 week ago

Question

Explain the contribution of Peter F. Drucker to Management .

Answered: 1 week ago