#################################################################### # # # Starter code for CSE 410 Homework 2, Spring 2010 # # # #################################################################### #==================================================================== # Static data allocation and initialization #==================================================================== # PUT YOUR STATIC DATA DEFINITIONS BELOW .data # Sample data for main program - replace or modify as needed n42: .asciiz "42" # digit string # titles for output nis: .asciiz "The int value of the string " is: .asciiz " is " #==================================================================== # Program instructions #==================================================================== .text .globl main # # Placeholder atoi function - always returns 17 # Replace with your own code, and add comments about # calling and register conventions # atoi: li $v0, 17 jr $ra # # Main program entry # main: addiu $sp, $sp, -4 # allocate stack frame sw $ra, 0($sp) # save return address # # Main body - calls dummy atoi and prints results # replace with your code # li $v0, 4 # print "the int value of ths string " la $a0, nis syscall li $v0, 4 # print "42" la $a0, n42 syscall li $v0, 4 # print "is" la $a0, is syscall jal atoi # call atoi move $a0, $v0 # print result int li $v0, 1 syscall # # main exit # exit: lw $ra, 0($sp) # restore return address addiu $sp, $sp, 4 # pop stack jr $ra # return