I declare this array:
array dw 10 dup(0)
But when I want to increase a value with this:
mov bx, 5
inc array[bx]
It changes next one by 256 and the correct value by 1: Like this
Your array initializes these 20 bytes in memory:
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
The instructions
mov bx, 5
inc array[bx]
will change the array to
0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0
because BX
is used as an offset measured in bytes from the start of the array.
The screenshot that you've posted is easily created from trying to visualize the word-sized elements from the array but incrementing by 1 the pointer that is used in the algorithm instead of raising that pointer by 2 which would be correct.
0,0 0:
0,0 0:
0,0 0:
0,0 0:
0,1 256:
1,0 1:
0,0 0:
0,0 0:
0,0 0:
0,0 0:
0,0 0:
Verify if this is the case...