Needed Example of while loop in Nasm
assembly, nasm
Solution
I guess you ask about x86 assembler? In assembler there is no while loop (maybe you can use special macros for that sometime, depends on the Assembler). You have to construct by your own. You can use assembler commands like
jne, jnz, je, jz, cmp, inc, dec
or some more special outdated command
jcxz, loop
for example:
mov ecx,255
L1:
dec ecx
jne L1
ret
This example counts the value in the register ecx until 0 and then left the loop. Another example but which count above.
mov ecx,0
L2:
inc ecx
cmp ecx, 255
jne L2
ret
Problem
Could someone please explain me how to write a While loop in NASAM assembly language , example which registers are involved what mov operations are needed and how the counter is kept, i'm trying to grasp assembly but it's a little tricky at the begining... Thanks Guys Btw : I'm trying to learn this language for a course i'm taking