;store number of accounts to add
mov eax, SYS_READ
mov ebx, STDIN
mov ecx, nums
mov edx, 2
int 0x80
_storeLoop:
dec byte [nums]
;display nums
mov eax, SYS_WRITE
mov ebx, STDOUT
mov ecx, nums
mov edx, 1
int 0x80
mov eax, [nums]
cmp eax, 1
jnz _storeLoop
section.bss
nums resb 1
Why am i stuck in this loop. I can see nums equals zero eventually. I've tried using different comparisons like jg.
CodePudding user response:
As the comment above says, mov eax, [nums]
will read 4 bytes from a memory location holding a 1-byte counter. If the other 3 bytes don't happen to be all zeroed when this loop starts, it will never terminate.