anonymous
  • anonymous
how to make a while loop in assembly?
Computer Science
katieb
  • katieb
See more answers at brainly.com
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.

Get this expert

answer on brainly

SEE EXPERT ANSWER

Get your free account and access expert answers to this
and thousands of other questions

anonymous
  • anonymous
You'll need something like the following structure: label: ...
anonymous
  • anonymous
can u please show me with a simple example that does all those things
anonymous
  • anonymous
which architecture? X86, amd64, MIPS?

Looking for something else?

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

More answers

anonymous
  • anonymous
x86
anonymous
  • anonymous
Here a simple example that calculates 2 * n: movl $0, %eax # i = 0 movl $0, %ebx # result = 0 movl $10, %ecx # n = 10 jmp check # without this jmp, it'd be a do-while loop loop: addl $2, %ebx # result = 2 * result addl $1, %eax # i++ check: cmp %ecx, %eax jl loop # Jump if i < n Btw, most compilers can also output assembly code. If you compile some C-code with gcc, you need to add the `-S` flag. Then, gcc will only generate ASM for you.
walters
  • walters
wat are this ( $)
anonymous
  • anonymous
i'm getting errors
1 Attachment
anonymous
  • anonymous
There are two different syntaxes for writing x86 ASM: AT&T and Intel. The code I wrote is in AT&T syntax while your assembler probably expects Intel syntax. @walters The $ is part of the AT&T syntax to indicate an immediate (or constant) value. % indicates a register. A quick (but not tested yet) rewrite: mov eax, 0 mov ebx, 0 mov ecx, 10 jmp check loop: add ebx, 2 add eax. 1 check: cmp eax, ecx jl loop
anonymous
  • anonymous
that is why u have to analyse numbers correctly u'll get it
walters
  • walters
@slotema i get it
anonymous
  • anonymous
OOOH! I SEE IT! @slotema
anonymous
  • anonymous
@AuthenticationError WHAT DO YOU MEAN BY Numbers?
walters
  • walters
so using assembly @slotema how to do modulus because this is giving me errors a mod b
walters
  • walters
like looping if x is even is'nt i have to do modulus like in c and c+
anonymous
  • anonymous
If you really have different questions, you should start a new thread, so Mahlatse1 won't get a lot of notifications. For modulo, you'll need to do a division. After e.g. `div eax, ebx`, eax will contain the quotient and edx will contain the remainder. But divisions are costly. If you just want to check whether or not a number is even, there are faster ways of doing that. Like checking the LSB of the number (if it's 1, the number is odd).

Looking for something else?

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