I am new to this forum and to the mips system. My task is to construct two subroutines for a program.
#-----------------------------------------------------------
# PROCEDURE: check_string
#
# DESCRIPTION: This procedure checks if the string contains
# integers separated with a plus-signs, e.g,
#
# int+int+int+...+int
#
# INPUT: $a0 - the address of the string
# $a1 - the length of the string
#
# OUTPUT: $v0 = 1 if the string is invalid
# $v0 = 0 if the string is valid
#-----------------------------------------------------------
and
#-----------------------------------------------------------
# PROCEDURE: int_to_string
#
# DESCRIPTION: This procedure converts an integer to a
# string. It assumes that the string is large
# enough for the number, and that the number
# is smaller than 2147483648. The end-of-string
# should be marked with a null-byte. The
# maximum string length should though be 11
# bytes.
#
# INPUT: $a0 - the number to be converted
# $a1 - the address of the string
#
# OUTPUT: None.
#-----------------------------------------------------------
I have started writing some code on the first subroutine,check string, this is how far I have come:
buffer: .space 80 # the place for the input-string li $v0, 8 la $a0, buffer li $a1, 80 syscall
I know i have to do a loop function, but not sure how to do it, is their anyone that can help?
Edited by dargueta, 22 April 2011 - 09:37 AM.


Sign In
Create Account

Back to top









