How would i get this program to show show instead of three?

31 Views Asked by At

I created an array in MIPS and this language is very new to me. Im suppose to show the number at position one instead i get position 2 which is 3

            #create a simple idea of an array

    .data
num1:   .word 1, 2, 3  #allows input for slot one in array

    
label1: .asciiz "Input the first number:"
label2: .asciiz "Input the second number:"
label3: .asciiz "Input the third number:"
label4: .asciiz "The number in slot 1 of the array is:"

    .text
main:
    #intiate the first label
    li $v0, 4
    la $a0, label1
    syscall
    #input first number into the array
    li $v0, 5
    syscall
    sw $v0, num1
    #initiate the second label
    li $v0,4
    la $a0, label2
    syscall
    #input second number into the array
    li $v0, 5
    syscall
    sw $v0, num1
    #initiate the third label
    li $v0, 4
    la $a0, label3
    syscall
    #input third number into the array
    li $v0, 5
    syscall
    sw $v0, num1
    #intiate the fourth label
    li $v0, 4
    la $a0, label4
    syscall
    #output position 1
    li $v0, 1
    lw $a0, num1
    syscall
    #end program
    li $v0,10
    syscall
0

There are 0 best solutions below