Re: Read N from keybord. Double even numbers. Using LOOP instruction



//\\o//\\annabee wrote:

....
mov edx 0
mov ecx 2
mov eax 1
While ecx <= N
add edx ecx
add edx ecx
add ecx 2
add edx eax
add eax 2
End_While


Sorry. I am drunk. Now I go kill myself :(

Heh! If you're drunk, you're already killing yourself. (don't get me started on the clinical effects of alcohol, as compared to, say, heroin...)

My CPU doesn't have a "While" opcode, so I can't test your code. I don't think it's quite right. But looking at it gave me the idea of doing the "double and add" by:

lea edx, [edx + ecx * 2]

Might be a "win"... not tested...

Best,
Frank
.



Relevant Pages