Answered step by step
Verified Expert Solution
Link Copied!

Question

00
1 Approved Answer

I was working on the MIPS ASSEMBLY code and I'm having problems and error in here. Can you help me what is wrong in my

I was working on the MIPS ASSEMBLY code and I'm having problems and error in here.

Can you help me what is wrong in my code?

This code is converting non-leaf function to a negative integer number to 2s complement in string

image text in transcribed

image text in transcribed

image text in transcribed

2 #Data Declaration 3 .data 4 binary: .asciiz "00000000" 5 input: .asciiz "Enter a decimal number from-128 to 127:" 6 outputl: .asciiz "The binary of" 7 output2: .asciiz "The number is:" 8 9 .text 10 #Prompt to get the input 11 repeat: 12 Sv0,4 13 la $va, 4 14 syscall 15 16 #Read the input 17 li $v0, 5 18 syscall 19 20 #Check the range 21 check: 22 blt $v0,-128, repeat 23 bgt $v0, 127, repeat 24 25 #store in a0 26 move $a0, $V0 27 move $s0, $v0 28 29 #get the base address of string array 30 la $al, binary 31 32 #Positive or 0-> convertion / else-> end 33 blt $a0, 0, end 34 jal binaryConvertion 35 36 #Call the Converter 37 move $al, $VO 38 71 #Loop until a0 value to 1 72 loop: 73 beq $t1, 0,next 74 #1f 1 then add char 1 in array 75 li $t1, 49 76 sb $t1, ($al) 77 #Repeat loop 78 back: 80 addi $al, $al, -1 81 loop 82 #otherwise 83 next: 84 li $t1, 48 85 sb $t1, ($a1) 86 j back 87 end val 89 #Add value into array 90 li $a0, 49 91 sb $a0, ($a1) 92 #Return to main 93 return1: 94 jr $ra 95 2 #Data Declaration 3 .data 4 binary: .asciiz "00000000" 5 input: .asciiz "Enter a decimal number from-128 to 127:" 6 outputl: .asciiz "The binary of" 7 output2: .asciiz "The number is:" 8 9 .text 10 #Prompt to get the input 11 repeat: 12 Sv0,4 13 la $va, 4 14 syscall 15 16 #Read the input 17 li $v0, 5 18 syscall 19 20 #Check the range 21 check: 22 blt $v0,-128, repeat 23 bgt $v0, 127, repeat 24 25 #store in a0 26 move $a0, $V0 27 move $s0, $v0 28 29 #get the base address of string array 30 la $al, binary 31 32 #Positive or 0-> convertion / else-> end 33 blt $a0, 0, end 34 jal binaryConvertion 35 36 #Call the Converter 37 move $al, $VO 38 71 #Loop until a0 value to 1 72 loop: 73 beq $t1, 0,next 74 #1f 1 then add char 1 in array 75 li $t1, 49 76 sb $t1, ($al) 77 #Repeat loop 78 back: 80 addi $al, $al, -1 81 loop 82 #otherwise 83 next: 84 li $t1, 48 85 sb $t1, ($a1) 86 j back 87 end val 89 #Add value into array 90 li $a0, 49 91 sb $a0, ($a1) 92 #Return to main 93 return1: 94 jr $ra 95

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access with AI-Powered Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started