EEE230_ASU_Assng4

EEE230_ASU_Assng4 - # Program takes in inputs from user and...

Info iconThis preview shows pages 1–3. Sign up to view the full content.

View Full Document Right Arrow Icon
Sheet1 Page 1 # Program takes in inputs from user and prints out the average of the numbers entered. # Alejandro Tinoco # CSE/EEE 230 -10:40 AM # 02/26/08 .data numbers: .space 80 #declare 80 bytes of storage to hold array of 20 integers name: .asciiz "Alejandro Tinoco\n" #put your name here! newline: .asciiz "\n" #new line OpenBracket: .asciiz "(" #open bracket CloseBracket: .asciiz ") " #closed bracket prompt: .asciiz "Enter a number " #prompt for input .globl main .text ############################################################################### main: addu $s7, $0, $ra # save the return address for the return to the calling code #print name li $v0, 4 # print_str (system call 4) la $a0, name # takes the address of a string as an arg. syscall # output string #read data into array la $a0, numbers # Array address loaded for parameter jal readData # jump and return to the Read Data function move $s0, $v0 # save number of integers read into $s0 #print array la $a0, numbers # array address loaded for parameter move $a1, $s0 # count loaded for parameter jal print # call print function addu $ra, $0, $s7 # restore address jr $ra # return to the calling program ############################################################################### readData:
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Sheet1 Page 2 addi $sp, $sp, -8
Background image of page 2
Image of page 3
This is the end of the preview. Sign up to access the rest of the document.

This note was uploaded on 04/06/2009 for the course CSE CSE/EEE230 taught by Professor Debracaliss during the Fall '09 term at ASU.

Page1 / 8

EEE230_ASU_Assng4 - # Program takes in inputs from user and...

This preview shows document pages 1 - 3. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online