Watch me learn MIPS...

Discussion in 'Computer Science & Culture' started by Adam, Oct 21, 2002.

Thread Status:
Not open for further replies.
  1. Adam §Þ@ç€ MØnk€¥ Registered Senior Member

    Messages:
    7,415
    Lab 2:

    -----------------------------------------------------------------------------------

    #data is chunks of info used by the programme
    .data
    menu:
    .asciiz "0: Add A+B \n1: Subtract A-B \n2: Divide A/B \n3: Multiply A*B\n"

    number1:
    .asciiz "\nEnter A: "
    number2:
    .asciiz "\nEnter B: "

    newline:
    .asciiz "\n"



    #text in asm means the programme space
    .text

    #main programme
    main:

    #load strings into registers
    la $a0, menu

    #syscall to display strings
    li $v0, 4
    syscall

    #user selection
    #depends on selection, goes to different tags
    li $v0, 5
    syscall
    move $t0, $v0

    #ask for A and B
    la $a0, number1
    li $v0, 4
    syscall
    li $v0, 5
    syscall
    move $t1, $v0

    la $a0, number2
    li $v0, 4
    syscall
    li $v0, 5
    syscall
    move $t2, $v0


    #function selector
    li $s0, 0
    beq $t0, $s0, addem
    li $s0, 1
    beq $t0, $s0, subtractem
    li $s0, 2
    beq $t0, $s0, divideem
    li $s0, 3
    beq $t0, $s0, multiplyem
    selector:

    move $a0, $t1
    li $v0, 1
    syscall
    la $a0, newline
    li $v0, 4
    syscall

    #exit programme
    li $v0, 10
    syscall

    #add each tag, do a function and display menu again or go to end

    addem:
    add $t1, $t1, $t2
    b selector

    subtractem:
    sub $t1, $t1, $t2
    b selector

    divideem:
    div $t1, $t1, $t2
    b selector

    multiplyem:
    mul $t1, $t1, $t2
    b selector

    end:
     
  2. Google AdSense Guest Advertisement



    to hide all adverts.
  3. Adam §Þ@ç€ MØnk€¥ Registered Senior Member

    Messages:
    7,415
    Can anyone give me some help with this please?

     
  4. Google AdSense Guest Advertisement



    to hide all adverts.
  5. Adam §Þ@ç€ MØnk€¥ Registered Senior Member

    Messages:
    7,415
    So far, my code for this next one seems about half as big as some other chap's. *pats self on back* Neat small code. Good job.

    Please Register or Log in to view the hidden image!

     
  6. Google AdSense Guest Advertisement



    to hide all adverts.
  7. sjmarsha Registered Senior Member

    Messages:
    363
    Do you ever get the feeling that you are talking to yourself Adam?
     
  8. Adam §Þ@ç€ MØnk€¥ Registered Senior Member

    Messages:
    7,415
    Absolutely. Especially whenever I post anything even vaguely technical.
     
  9. sjmarsha Registered Senior Member

    Messages:
    363
    yeah. I wouldn't bother if I was you.

    Unless you were really stuck.
     
  10. malisha Registered Senior Member

    Messages:
    64
    And why do you feel like your talking to yourself when you post something technical ?

    Wonder what your like in person or towards other people at uni who may not get things as easily when it comes to computers

    Please Register or Log in to view the hidden image!



    Sometimes i dont know if your trying to motivate yourself or simply trying to gloat, but this is not how you get people to help.

    maybe you should try to find another messageboard, dont know why you keep comming to this one since your technical skills are so l33t, it could be that your to scared to be going to more 'Advanced messageboards' .
     
  11. Adam §Þ@ç€ MØnk€¥ Registered Senior Member

    Messages:
    7,415
    I post this stuff because I am clearly not an expert with it. I'm seeking help.

    And yes, I am absolutely hopeless at dealing with people.
     
  12. sjmarsha Registered Senior Member

    Messages:
    363
    So harsh...

    Personally I do not mind helping people help themselves?!? But I do not like giving people the answer... I would rather point them in the correct direction.. (i.e. LOOK AT THE GOD DAMN MAN PAGE, THATS WHAT ITS THERE FOR)

    Unless its my friend who gives me a lift in / anyone who is female with a pretty face. (Not too many where I am...:-( )
     
Thread Status:
Not open for further replies.

Share This Page