assign4.asm - Name Kumal Patel Class ID 139 Assignment...

This preview shows page 1 - 2 out of 3 pages.

# Name: Kumal Patel# Class ID: 139# Assignment Number: 4.dataname: .asciiz "Kumal Patel" # 0x10010000newLine: .asciiz "\n" # 0x1001000Cnumber: .asciiz "Enter a number " # 0x1001000E.space 1array: .space 40 # 0x10010020.globl main.textmain:# print namelui $t0, 0x1001 # base register of address for global dataaddi $a0, $t0, 0 # set address location of name in $a0ori $v0, $0, 4 # set command to print stringsyscall # print stringaddi $a0, $t0, 0x20 # address of arrayjal readvals # call readvalsaddi $a0, $t0, 0x20 # address of arrayaddi $a1, $t2, 0 # countjal average # call averageaddi $a0, $t0, 0x20 # address of arrayaddi $a1, $t2, 0 # countjal print # call printori $v0, $0, 10 # set command to end programsyscall # end programreadvals:ori $t1, $0, 0 # used for if < 0ori $t2, $0, 0 # count constantaddi $t3, $0, 10 # constant valueori $t5, $0, 0 # keep track of memory locationori $t7, $a0, 0 # argumentaddi $a0, $t0, 12 # set address of newLine in $a0ori $v0, $0, 4 # set command to print stringsyscall # print stringtop:addi $a0, $t0, 14 # set address of number in $a0ori $v0, $0, 4 # set command to print stringsyscall # print stirng

  • Left Quote Icon

    Student Picture

  • Left Quote Icon

    Student Picture

  • Left Quote Icon

    Student Picture