Quantcast

Got Homework?

Connect with other students for help. It's a free community.

  • across
    MIT Grad Student
    Online now
  • laura*
    Helped 1,000 students
    Online now
  • Hero
    College Math Guru
    Online now

Here's the question you clicked on:

55 members online
  • 0 replying
  • 0 viewing

walters Group Title

hi how can i write the following statement in assembly language.

  • one year ago
  • one year ago

  • This Question is Closed
  1. walters Group Title
    Best Response
    You've already chosen the best response.
    Medals 0

    while (n>1){ if ( n is even) n : = n/2 else n:=3*n+1 }

    • one year ago
  2. walters Group Title
    Best Response
    You've already chosen the best response.
    Medals 0

    @Opcode

    • one year ago
  3. A.Avinash_Goutham Group Title
    Best Response
    You've already chosen the best response.
    Medals 0

    8086? mips?

    • one year ago
  4. walters Group Title
    Best Response
    You've already chosen the best response.
    Medals 0

    yes pls help @A.Avinash_Goutham

    • one year ago
  5. walters Group Title
    Best Response
    You've already chosen the best response.
    Medals 0

    8086

    • one year ago
  6. walters Group Title
    Best Response
    You've already chosen the best response.
    Medals 0

    @hartnn

    • one year ago
  7. eSpeX Group Title
    Best Response
    You've already chosen the best response.
    Medals 0

    In MIPS, your code will look like this: .data N: .word 30 .text main: add $t0, $zero, N # copy N into the register WHILE: blt $t0, 1, END # while (n > 1) sll $t1, $t0, 31 # shift out so only least sig bit remains beq $t1, 1, ODD # else { ... } sra $s0, $t0, 1 # n = n/2 add $t0, $s0, $zero # copy result back to temp register j WHILE ODD: sla $s0, $t0, 1 # multiply by two add $s0, $t0, $zero # add N add $s0, $zero, 1 # + 1 add $t0, $s0, $zero # copy result back into register j WHILE END: sw $t0, N # write N to memory jr $ra

    • one year ago
  8. walters Group Title
    Best Response
    You've already chosen the best response.
    Medals 0

    @eSpeX what about 8086

    • one year ago
  9. walters Group Title
    Best Response
    You've already chosen the best response.
    Medals 0

    @artofspeed and @nubeer

    • one year ago
  10. eSpeX Group Title
    Best Response
    You've already chosen the best response.
    Medals 0

    I do not have experience with the 8086 instruction set, it was my hope that you could take what you have learned and adapt the logic and instructions to match those that you are using.

    • one year ago
  11. walters Group Title
    Best Response
    You've already chosen the best response.
    Medals 0

    how to use modulus using assembly

    • one year ago
  12. eSpeX Group Title
    Best Response
    You've already chosen the best response.
    Medals 0

    You won't really use modulus per se, you are dealing with binary, which is why I logically shifted the number to the left. Any 'odd' number will have to set the least significant bit, if it is a 0, then the number is even.

    • one year ago
  13. walters Group Title
    Best Response
    You've already chosen the best response.
    Medals 0

    so tell me wat is the deffrence between 8086 and mips

    • one year ago
  14. eSpeX Group Title
    Best Response
    You've already chosen the best response.
    Medals 0

    They use a different instruction set, while they do basically the same thing, it is a difference in how the instruction is formed.

    • one year ago
  15. walters Group Title
    Best Response
    You've already chosen the best response.
    Medals 0

    so to run it i need to install mips software or should i use MASM615

    • one year ago
  16. eSpeX Group Title
    Best Response
    You've already chosen the best response.
    Medals 0

    If I recall correctly, the MASM assembler interprets only the 8086 instruction set, if you want to compile MIPS, try using the QtSPIM assembler.http://sourceforge.net/projects/spimsimulator/

    • one year ago
  17. eSpeX Group Title
    Best Response
    You've already chosen the best response.
    Medals 0

    A cursory review of the x86 instructions show that they have some of the same instructions as MIPS, so it should be completely doable to convert the code I've given into instructions you can use with the 8086 assembler.

    • one year ago
    • Attachments:

See more questions >>>

Your question is ready. Sign up for free to start getting answers.

spraguer (Moderator)
5 → View Detailed Profile

is replying to Can someone tell me what button the professor is hitting...

23

  • Teamwork 19 Teammate
  • Problem Solving 19 Hero
  • You have blocked this person.
  • ✔ You're a fan Checking fan status...

Thanks for being so helpful in mathematics. If you are getting quality help, make sure you spread the word about OpenStudy.

This is the testimonial you wrote.
You haven't written a testimonial for Owlfred.