I am getting an error when I try to run this code The error

I am getting an error when I try to run this code. The error is located in the part where it says \"\"PUT CODE HERE\"\"

Bubble Sort ( MIPS {assembly language})

############# Assembly Code ###############

##########################################

.data
nums: .word 0 : 12 # \"array\" of 12 words to contain values
size: .word 12 # size of \"array\"
.text
la $s0, nums
la $s5, size # load address of size variable
lw $s5, 0($s5)
# Populate fibs with twelve values
addi $t1, $zero, 55
sw $t1, 0($s0)
addi $t1, $zero, 88
sw $t1, 4($s0)
addi $t1, $zero, 0
sw $t1, 8($s0)
addi $t1, $zero, 22
sw $t1, 12($s0)
addi $t1, $zero, 77
sw $t1, 16($s0)
addi $t1, $zero, 44
sw $t1, 20($s0)
addi $t1, $zero, 99
sw $t1, 24($s0)
addi $t1, $zero, 33
sw $t1, 28($s0)
addi $t1, $zero, 110
sw $t1, 32($s0)
addi $t1, $zero, 66
sw $t1, 36($s0)
addi $t1, $zero, 121
sw $t1, 40($s0)
addi $t1, $zero, 11
sw $t1, 44($s0)

##################################################################
# AT THIS POINT: $s0 is the address of the start of the array
# $s5 is the size (n)
#################################################################
# PUT CODE HERE
add $t1,$zero,$s5
addi $t1, $t1, -1
  
oloop: add $t2,$zero,$zero
iloop: sll $t4,$t2,2
  
add $t5,$t4,$s0
addi $t6,$t5,4

lw $t0,0($t5)
lw $t7,0($t6)
  
slt $t3,$t0,$t7
  
beq $t3,$zero,swap
j overSwap
   swap: sw $t7,0($t5)
sw $t0,0($t6)
overSwap:
addi $t2,$t2,1
bne $t1,$t2,iLoop

addi $t1,$t1,-1
bne $zero,$t1,oloop

  
##################################################################
la $a0, nums # first argument for print (array)
add $a1, $s5, $zero # second argument for print (size)
jal print # call print routine.
li $v0, 10 # system call for exit
syscall # we are out of here.

######### routine to print the numbers on one line.
######### don\'t touch anything below this line!!!!

.data
space:.asciiz \" \" # space to insert between numbers
head: .asciiz \"Sorted array:\ \"
.text
print:add $s0, $zero, $a0 # starting address of array
add $t1, $zero, $a1 # initialize loop counter to array size
la $a0, head # load address of print heading
li $v0, 4 # specify Print String service
syscall # print heading
out: lw $a0, 0($s0) # load fibonacci number for syscall
li $v0, 1 # specify Print Integer service
syscall # print fibonacci number
la $a0, space # load address of spacer for syscall
li $v0, 4 # specify Print String service
syscall # output string
addi $s0, $s0, 4 # increment address
addi $t1, $t1, -1 # decrement loop counter
bgtz $t1, out # repeat if not finished
jr $ra # return

Solution

Ans-

My Assembly code:

I am getting an error when I try to run this code. The error is located in the part where it says \
I am getting an error when I try to run this code. The error is located in the part where it says \

Get Help Now

Submit a Take Down Notice

Tutor
Tutor: Dr Jack
Most rated tutor on our site