I'm having trouble with my program. I believe I've figured out most of it, but there's one thing that I still have no clue about. That's how to go through a string and check whether it's a digit or letter.
I figured I could do something like this to remove whitespace (although I haven't tested it out yet... just saw this while searching other topics here):
li $t0, 32 # store a whitespace into temp variable bne $t1, $t0, remove # if not a whitespace branch to remove
Assuming $t1 is a character I want to check (and remove is defined later in the code).
But that doesn't handle symbols or anything. I'm thinking it may be easier to just check if the character IS a digit/letter instead of checking if it isn't. But I don't know how to do that either.
One more thing. Is there any way to take a input file as a argument? I realize I can prompt the user for input like this:
.data prompt: .asciiz "Input: " buf: .space 100 .text main: li $v0, 4 # system call code for print_string la $a0, prompt syscall li $v0, 8 # system call code for read_string la $a0, buf li $a1, 100 syscall
But can I actually read input from a file given as a argument?