I am new to Assembly. I'd like to produce a loop counter that sums up the first 10 decimal numbers (in 32-bit). Here is what I came up with. The code must run in MASM compiler. Should not output anything to the console but save the result in to a registry memory. Any thought how to achieve this? Here is what I have so far
.386
.model flat
.code
main proc
mov eax, 0 ; initialize the counter
FLP:
mov ebx, ecx
add ebx, eax
sub ebx, edx
mov ecx, ebx
inc eax
cmp eax, 10
jle FLP
main endp
end main
Solution
.model flat
;.data
.code
main PROC
xor ecx, ecx
xor eax, eax
loop10:
add eax, ecx
inc ecx
cmp ecx, 10
jbe loop10
main ENDP
END main