Assign1

Assign1 - sub $t1, $s0, $s1 #subtract s0-s1 = t1 add $s3,...

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

View Full Document Right Arrow Icon
Sheet1 Page 1 .data str1: .asciiz "McCabe Tonna " str2: .asciiz "Enter a number " str3: .asciiz "\n " a:.word 0 b1:.word 0 # had to rename "b" because that character alone would give program errors c:.word 0 .globl main .text . main: li $s0, 13 #initialize the registers part 1 la $a0, str2 #prompt the user to enter into register $s1 li $v0, 4 syscall li $v0, 5 #this puts whatever the user inputs into register s1 syscall move $s1, $v0 la $a0, str2 li $v0, 4 #action 4, is output (print string) syscall li $v0, 5 #action 5, is read int syscall move $s2, $v0 #puts the number into s2 la $t0, a sw $s1, 0($t0) #store value of s1 into a la $t0, b1 sw $s2, 0($t0) #store value of s2 into b1
Background image of page 1

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

View Full DocumentRight Arrow Icon
Background image of page 2
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: sub $t1, $s0, $s1 #subtract s0-s1 = t1 add $s3, $t1, $s2#adds t1+s2 = c sw $s3, c #la $t0, c #sw $s3, c la $a0, str1 li $v0, 4 syscall #prints my name la $a0, str3 Sheet1 Page 2 syscall lw $t0, a li $v0, 1 add $a0, $t0, $0 #move $a0, $t0 syscall #prints value of a la $a0, str3 #newline li $v0, 4 syscall lw $t0, b1 li $v0, 1 move $a0, $t0 syscall #prints value of b la $a0, str3 #newline li $v0, 4 syscall lw $t0, c li $v0, 1 move $a0, $t0 syscall #prints value of c la $a0, str3 #newline li $v0, 4 syscall move $t0, $s1 #switch values of s1 and s2 move $s1, $s2 move $s2, $t0 sub $s0, $0, $s0...
View Full Document

This note was uploaded on 09/17/2009 for the course CSE 230 taught by Professor Calliss during the Spring '08 term at ASU.

Page1 / 2

Assign1 - sub $t1, $s0, $s1 #subtract s0-s1 = t1 add $s3,...

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

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