Assignment2Answers - Mayank Gupta TA EEE/CSE 230...

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

# Mayank Gupta# TA - EEE/CSE 230# Assignment 2.dataname: .asciiz "Mayank Gupta\n"prompt: .asciiz "\nEnter the no. of times to repeat " #14prompt1: .asciiz "Enter a number " #49prompt2: .asciiz "\nThe smallest number is " #65prompt3: .asciiz "\nThe largest number is " # 89prompt4: .asciiz "\nThere are no numbers to test\n" #115prompt5: .asciiz "Program complete\n" #144prompt6: .asciiz "\n".globl main.textmain:# Print Name lui $s0, 0x1001ori $v0, $0, 4 # setting syscall to print a string (load immediateadd $a0, $s0, $0 # load the addresssyscall # system call# Prompt for number of times to repeatori $v0, $0, 4 # setting syscall to print a string (load immediatelui $a0, 0x1001 # load the addressori $a0, $a0, 14 # Each memory location occupies 4 bytes and thereare 3 values before name so 4*3=12syscall # system call# Read the integerori $v0, $0, 5 # setting syscakk to read an integersyscall ori $s1, $v0, 0 # The integer is read and stored in register s1jal enter # printing an empty line# Run in a loopbeq $s1, $0, endinner_loop:addi $s1, $s1, -1 # subtract 1 from loop count# Part 4(a) keep_reading:

  • Left Quote Icon

    Student Picture

  • Left Quote Icon

    Student Picture

  • Left Quote Icon

    Student Picture