Im trying to do a loop in NASM that simply writes to a variable 1 and then do it again but 1 byte up on the variable... i have come up with this design
mov ebx, 0
mov rax, 1
test_loop:
cmp ebx, 4
je test_loop_end
mov [numbet_to_text + ebx], al
inc ebx
jmp test_loop
test_loop_end:
but when i check it with this, it doesn't call:
mov ebx, [numbet_to_text]
cmp ebx, 1111
je teste
Checked with gdb and saw that when i wrote to a byte after writing one of them it got corrupted so...
write to byte 0 --->1 ok, but when I write to byte up I would get
byte 0----> random value.. and byte 1 ----> 1
some GDB screenshots to explain myself better: print1 print2
as you see on the print when i write to 0x40201b i got a 1... thats ok... but when i write a byte up i would get 0x40201c 1... ok but 0x40201b would get a random value in this case 257 and i cant see why