Results 1 to 5 of 5

Thread: Assembly in MIPS-beginning

  1. #1
    Join Date
    Oct 2010
    Location
    Logan, UT
    Beans
    10

    Assembly in MIPS-beginning

    I recently started learning assembly in my CS 3810 course. I'm using QtSpim and am very new to this. This is my assignment:

    "Write a MIPS program that allows a user to enter two numbers and then an operation. The program should display the result. The only operations that you must include are addition and subtraction. The program should continue until the user indicates that they are done. In addition to these requirements your program must include at least one function call (jal instruction) and one loop construct (the equivalent of a for or while loop)."

    I have most of it written. The only problem I'm encountering is when it comes to the user choosing which operation to perform on the numbers entered(+ or -). Once the user enters the operand, how do i determine whether i take the user-entered numbers and branch to an addition label or a subtraction label? I need some way of comparing the user-entered operand with the + and - signs.

    Any code, hints, or explanations will be helpful. Thanks!

    Jason

  2. #2
    Join Date
    Oct 2010
    Location
    Logan, UT
    Beans
    10

    Assembly in MIPS-beginning

    I recently started learning assembly in my CS 3810 course. I'm using QtSpim and am very new to this. This is my assignment:

    "Write a MIPS program that allows a user to enter two numbers and then an operation. The program should display the result. The only operations that you must include are addition and subtraction. The program should continue until the user indicates that they are done. In addition to these requirements your program must include at least one function call (jal instruction) and one loop construct (the equivalent of a for or while loop)."

    I have most of it written. The only problem I'm encountering is when it comes to the user choosing which operation to perform on the numbers entered(+ or -). Once the user enters the operand, how do i determine whether i take the user-entered numbers and branch to an addition label or a subtraction label? I need some way of comparing the user-entered operand with the + and - signs.

    Any code, hints, or explanations will be helpful. Thanks!

    Jason

  3. #3
    Join Date
    Oct 2010
    Location
    Logan, UT
    Beans
    10

    Assembly in MIPS-beginning

    I recently started learning assembly in my CS 3810 course. I'm using QtSpim and am very new to this. This is my assignment:

    "Write a MIPS program that allows a user to enter two numbers and then an operation. The program should display the result. The only operations that you must include are addition and subtraction. The program should continue until the user indicates that they are done. In addition to these requirements your program must include at least one function call (jal instruction) and one loop construct (the equivalent of a for or while loop)."

    I have most of it written. The only problem I'm encountering is when it comes to the user choosing which operation to perform on the numbers entered(+ or -). Once the user enters the operand, how do i determine whether i take the user-entered numbers and branch to an addition label or a subtraction label? I need some way of comparing the user-entered operand with the + and - signs.

    Any code, hints, or explanations will be helpful. Thanks!

    Jason

  4. #4
    anewguy is offline I Ubuntu, Therefore, I Am
    Join Date
    Jun 2007
    Location
    Sometimes I visit earth
    Beans
    5,435
    Distro
    Ubuntu 12.04 Precise Pangolin

    Wink Re: Assembly in MIPS-beginning

    Should be a fairly straight forward compare with a branch or branch and link for each operation - if the assembler supports a "case" statement (not the usual case for assembler) you could do it that way as well.

    Can't give you any more specifics because then we would be doing your assignment for you, eh?

    Dave

  5. #5
    Join Date
    Feb 2007
    Beans
    24,961
    Distro
    Ubuntu 20.04 Focal Fossa

    Re: Assembly in MIPS-beginning

    Hi and please do not create multiple threads on the same issue. Threads merged.

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •