ASSGN3.asm - # Mayank Gupta # TA - CSE/EEE 230 .data num1:...

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

The preview shows page 1 - 2 out of 3 pages.
# Mayank Gupta# TA - CSE/EEE 230.datanum1: .word 0num2: .word 0text1: .asciiz "\nProduct "text2:.asciiz "\nQuotient "name: .asciiz "\nMayank Gupta\n"endline: .asciiz "\n"prompt: .asciiz "\nEnter a positive integer: "errormessage: .asciiz "big ERROR: Input should be >0\n".text.globl mainmain:lui $a0, 0x1001# get start of dataaddiu $a0, $a0,0x1d# get start of nameandi $a2, $a0, 0# set flag to falsejal print# print nameori $s0, $0, 5# repeat 5 timestop:beq $s0, $0, end# if counter is zero, stop loopaddi $a2, $0, 0 # This needed to be addded cause otherwise some random garbage would be printed. lui $a0, 0x1001# set address of first wordaddiu $a1, $a0, 4# set address of second wordjal getinput# call function to get input, store into memorylui $t0, 0x1001# get address of first wordlw $a0, 0($t0)# get the first value from memorylw $a1, 4($t0)# get the second value from memoryjal multiply# multiply the values, result in $v0addi $a1, $v0, 0# get value to print from $v0lui $a0, 0x1001# get start of data sectionaddi $a0, $a0, 8# get start of product output stringori $a2, $0, 1# set flag to true

Upload your study docs or become a

Course Hero member to access this document

Upload your study docs or become a

Course Hero member to access this document

End of preview. Want to read all 3 pages?

Upload your study docs or become a

Course Hero member to access this document

Term
Fall
Professor
nakamura
Tags
Natural number, A0, lui, T0

  • Left Quote Icon

    Student Picture

  • Left Quote Icon

    Student Picture

  • Left Quote Icon

    Student Picture