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

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

# Name: Kumal Patel# Class ID: 139# Assignment Number: 1.data.word 0 .word 0.word 0.asciiz "Kumal Patel".asciiz "Enter a number " .asciiz "\n".text.globl mainmain:# set resgister $s0 to 35addi $s0, $s0, 35# prompt user to enter a number, read it and store it in register $s1lui $a0, 0x1001addi $a0, $a0, 24addi $v0, $0, 4 # print stringsyscalladdi $v0, $0, 5 # read intsyscalladdi $s1, $v0, 0 # stores input into $s1# prompt user to enter a number, read it and store it in register $s2lui $a0, 0x1001addi $a0, $a0, 24addi $v0, $0, 4 # print stringsyscalladdi $v0, $0, 5 # read intsyscalladdi $s2, $v0, 0 # stores intput into $s2# store value of $s1 into 0x10010000sw $s1, 0x10010000# store value of $s2 into 0x10010004sw $s2, 0x10010004# calculate $s0 - $s1 + $s2 and store into memory location 0x1001008sub $t0, $s0, $s1 # $s0 - $s1add $t1, $t0, $s2 # $t0($s0 - $s1) + $s2sw $t1, 0x10010008# print your namelui $a0, 0x1001

  • Left Quote Icon

    Student Picture

  • Left Quote Icon

    Student Picture

  • Left Quote Icon

    Student Picture