walters
  • walters
hi how can i write the following statement in assembly language.
Computer Science
  • Stacey Warren - Expert brainly.com
Hey! We 've verified this expert answer for you, click below to unlock the details :)
SOLVED
At vero eos et accusamus et iusto odio dignissimos ducimus qui blanditiis praesentium voluptatum deleniti atque corrupti quos dolores et quas molestias excepturi sint occaecati cupiditate non provident, similique sunt in culpa qui officia deserunt mollitia animi, id est laborum et dolorum fuga. Et harum quidem rerum facilis est et expedita distinctio. Nam libero tempore, cum soluta nobis est eligendi optio cumque nihil impedit quo minus id quod maxime placeat facere possimus, omnis voluptas assumenda est, omnis dolor repellendus. Itaque earum rerum hic tenetur a sapiente delectus, ut aut reiciendis voluptatibus maiores alias consequatur aut perferendis doloribus asperiores repellat.
schrodinger
  • schrodinger
I got my questions answered at brainly.com in under 10 minutes. Go to brainly.com now for free help!
walters
  • walters
while (n>1){ if ( n is even) n : = n/2 else n:=3*n+1 }
walters
  • walters
@Opcode
anonymous
  • anonymous
8086? mips?

Looking for something else?

Not the answer you are looking for? Search for more explanations.

More answers

walters
  • walters
yes pls help @A.Avinash_Goutham
walters
  • walters
8086
walters
  • walters
@hartnn
eSpeX
  • eSpeX
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
walters
  • walters
@eSpeX what about 8086
walters
  • walters
@artofspeed and @nubeer
eSpeX
  • eSpeX
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.
walters
  • walters
how to use modulus using assembly
eSpeX
  • eSpeX
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.
walters
  • walters
so tell me wat is the deffrence between 8086 and mips
eSpeX
  • eSpeX
They use a different instruction set, while they do basically the same thing, it is a difference in how the instruction is formed.
walters
  • walters
so to run it i need to install mips software or should i use MASM615
eSpeX
  • eSpeX
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/
eSpeX
  • eSpeX
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.

Looking for something else?

Not the answer you are looking for? Search for more explanations.