#ArrayTest.asm #A program to demonstrate the use of arrays in #assembly language. #declare and initialize an array .data MyArray: .word 3, 2, 0, 1, 5, 7 NewLine: .asciiz "\n" InitialValue: .asciiz "\n The value in the array is: " UpdatedValue: .asciiz "\n The updated value in the array is: " .text main: la $t1, MyArray #load the address of the array into memory li $t2, 3 #load the index into a register add $t2, $t2, $t2 #double the index add $t2, $t2, $t2 #double it again add $t3, $t2, $t1 #add the index (offset) to the array address li $v0, 4 #print a new line character la $a0, NewLine syscall li $v0, 4 #print descriptive output la $a0, InitialValue syscall li $v0, 1 #print the value at MyArray[3] as an integer lw $a0, 0($t3) #load the value into the argument register syscall #perform the print li $t4, 77 #Load 77 into $t4 sw $t4, 0($t3) #Store the value in $t4 at the address in $t3 li $v0, 4 #print newline character la $a0, NewLine syscall li $v0, 4 #print descriptive output la $a0, UpdatedValue syscall li $v0, 1 #Print the new value lw $a0, 0($t3) syscall li $v0, 10 #end program syscall