{[ promptMessage ]}

Bookmark it

{[ promptMessage ]}

EEE230_ASU_Assign2

EEE230_ASU_Assign2 - CSE/EEE 230 Assignment 2 Part 1 In...

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

View Full Document Right Arrow Icon
CSE/EEE 230 Assignment 2 Part 1: In this part of the assignment, you are to make changes to the following program: # Assignment 2 Part 1 # Debra Calliss # # Program will prompt for an integer and then print the numbers from 1 # to the input number. .data prompt: .asciiz "Enter in an integer: " newline:.asciiz "\n" .globl main .text main: move $s7, $ra #save the return address in a register # prompt for input li $v0, 4 # set command to print string la $a0, prompt # set string to print syscall # print prompt # read in the number li $v0, 5 # set command to read integer syscall # call to read integer move $s0, $v0 # save the number # initialize loop li $t1, 0 # set loop counter to 0 # while loop counter != number top: beq $t1, $s0, end # compare loop counter and integer # increment counter addi $t1, $t1, 1 # add 1 to counter # print counter value and new line li $v0, 1 # set command to print integer move $a0, $t1 # set integer to print syscall # print counter li $v0, 4 # set command to print string la $a0, newline # set newline to print syscall # print newline # bottom of loop j top # repeat
Image of page 1

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

View Full Document Right Arrow Icon
Image of page 2
This is the end of the preview. Sign up to access the rest of the document.

{[ snackBarMessage ]}