Dismiss Notice
Join Physics Forums Today!
The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

Help with MIPS

  1. Jan 27, 2007 #1
    I'm trying to write a program that will have the user enter in an expression in the form: A (operation) B (operation) C and print out the result. After the user enters in the expression, I want to parse out each individual digit or expression by reading the ASCII code of each individual character by storing each digit or operation in its own register. I'm having trouble reading each seperate character after the user enters the expression.

    li $v0, 8
    la $a0, expr
    li $a1, 20
    syscall

    How do I store each character? Something like the code below? (I know the code below will not work.) Am i supposed to store the string in a new register before reading each seperate byte?

    sb 0(expr), $t0



    Also, since i'm only working with numbers between 20 and 99, and the operations + and *, is it ok to reserve only 5 bytes for the entire expression since 1 byte can represent one ASCII character?
     
    Last edited: Jan 27, 2007
  2. jcsd
Know someone interested in this topic? Share this thread via Reddit, Google+, Twitter, or Facebook

Can you help with the solution or looking for help too?
Draft saved Draft deleted



Similar Discussions: Help with MIPS
  1. MIPS help (Replies: 7)

  2. Mips ascii help (Replies: 5)

Loading...