Question: need help debugging this mips code to convert decimal to 8 bit binary using shifts. even numbers are returning 0000000 and odd 11111111 .data zeroString:

need help debugging this mips code to convert decimal to 8 bitneed help debugging this mips code to convert decimal to 8 bit binary using shifts. even numbers are returning 0000000 and odd 11111111

.data zeroString: .asciiz "00000000 " text main: li $v0, 5 # 5 = syscall code to read int syscall beq $v0, 0, exit #exit when 0 is entered move $t0, $v0 #te-ve la $t2, 0 #counter #Loop do: ANDI $t1, $t0, 0x01 #check if least significant digit is 1 addi $t2, $t2, 1 #inc rease counter move $a0, $t1 #printing value of t1 li $v0, 1 syscall srl $t1, $t1, 1 #shift to next digit bne $t2, 7, do #check if counter equal to target # Print a new line li $a0 , . . # $a0 = ascii code for newline char li $ve, 11 # 11-syscall code to print char syscall # Print newline j main exit: La $a0, zeroString li $v0, 4 syscall li $v0, 10 syscall

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 Databases Questions!