Can anyone help me with writing a simple example of the for loop in assembly language for this code:
for (i = -n; i < n; ++i)
{
...
}
where n != 0
I can’t find any example of how to write a for loop where the loop doesn’t start from 0.
So far I have this structure
mov ax, n
mov cx, n
neg cx
cmp cx, ax
JGE ENDFOR01
DO01:
; output
LOOP DO01
ENDFOR01:
Consider a “long hand” way of writing it in C:
Hope that gives some insights!