Assignment1.asm - Mayank Gupta CSE/EEE230 Fall 2016...

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

# Mayank Gupta# CSE/EEE230 Fall 2016 # Assignment 1.data val1: .word 1 # creates a single integer variable with initial value 1val2: .word 2val3: .word 3name: .asciiz "Mayank Gupta\n” .globl main.text main:# Part 1 lui $t0, 0x1001 # load address command. # setting register $t0 to start ofdata segment# Part 2 ori $v0, $0, 4 # setting syscall to print a string (load immediatelui $a0, 0x1001 # load the addressori $a0, $a0, 12 # Each memory location occupies 4 bytes and there are 3 values before name so 4*3=12syscall # system call # Part 3 ori $s0, $0, 7 # Store 7 in register s0addi $s1, $0, 8 # Store 8 in register s1addi $s2, $0, -3 # Store -3 in register s2# Part 4 lui $t0, 0x1001 # Store the address of val1 in register t0sw $s1, 0($t0) # Store value at address stored in register t0 in s1#ori $t0, $t0, 4 sw $s2, 4($t0) # Store value at 4 bytes ahead of address stored in register t0 in s1# Part 5 addi $t0, $s2, -5 # Subtract 5 from value in s2 and store in t0add $t0, $t0, $s0 # Add value in s0 to value in t0 and store in t0sub $t0, $t0, $s1 # Add value in s1 to value in t0 and store in t0

  • Left Quote Icon

    Student Picture

  • Left Quote Icon

    Student Picture

  • Left Quote Icon

    Student Picture