Assignment 2

Assignment 2 - Sheet1 Page 1 # James Stape # CSE230 Tues....

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

View Full Document Right Arrow Icon

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

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

Unformatted text preview: Sheet1 Page 1 # James Stape # CSE230 Tues. Thurs. 9:15-10:30 # Program Assignment 1 Introduction into MIPS and SPIM .data name: .asciiz "James Stape " prompt1: .asciiz "Enter in an integer: " prompt2: .asciiz "Enter in a bit number: " newline: .asciiz "\n" endmessage: .asciiz "Thank you for running the program. Have a stupendous day! " .text .globl main main:move $s7, $ra# saves this address li $s2, 0 # intialize the number of times the while loop will run li $s3, 5# intialize the number of runs # Action 1 li $v0, 4# loads the display function into the register la $a0, name# loads the variable name into the register syscall# displays the variable name li $v0, 4# loads the display function in to the register la $a0, newline# loads the newline into register to be printed syscall# starts on a new line # Action 2 top:beq $s2,$s3, final# Starts the while loop and will run until $t0 = $t1 t # Action 3 li $v0, 4# loads the display function in to the register la $a0, prompt1# loads the prompt1 into register to be printed syscall# displays the prompt # Action 4 li $v0, 5# Loads the read command into $v0 syscall# Reads the integer into $v0 move $s0, $v0# Places the user value into $s0 # Action 5 li $v0, 4# loads the display function in to the register la $a0, prompt2# loads the prompt2 into register to be printed syscall# displays the prompt # Action 6 Sheet1 Page 2 li $v0, 5# Loads the read command into $v0 syscall# Reads the user value into $v0 move $s1, $v0# Places the user value into $s0 move $a0, $s0# Places the first user input into the passing register move $a1, $s1# Places the second user input into the passing register # Action 7 jal clearbits back: move $t1,$v0# Place the return value into $t1 li $v0, 1# loads the display function in to the register move $a0, $t1# loads the prompt2 into register to be printed syscall# displays the prompt li $v0, 4# loads the display function in to the register la $a0, newline# loads the newline into register to be printed syscall# starts on a new line move $a0, $s0# Brings the pass register to the first user input move $a1, $s1# Brings the pass register to the second user input # Action 8 jal extractbits to: move $t1,$v0# Place the return value into $t1 li $v0, 1# loads the display function in to the register move $a0, $t1# loads the integer into register to be printed syscall# displays the prompt...
View Full Document

This note was uploaded on 04/03/2008 for the course CSE 230 taught by Professor Calliss during the Spring '08 term at ASU.

Page1 / 6

Assignment 2 - Sheet1 Page 1 # James Stape # CSE230 Tues....

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

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