.data

msg: .asciiz "Enter array elements: \n"

array: .space 100

result: .asciiz "The result "

.text

.globl main

main:

li $v0,5

syscall

move $t0,$v0

li $t1,1

la $t3,array

la $a0,msg

syscall

loop:

beq $t0,$t1,print_array

li $v0,5

syscall

move $t2,$v0

sw $t2,0($t3)

addi $t3,$t3,4

addi $t1,$t1,1

nop

j loop

print_array:

li $t1,1

la $t3,array

print_loop:

beq $t0,$t1,exit

lw $t2,0($t3)

move $a0,$t2

syscall

addi $t3,$t3,4

addi $t1,$t1,1

j print_loop

exit:

li $v0,10

syscall

I have tried using .align 4 with the array,but this does not work,I am using qtspim

0

There are 0 best solutions below