Reputation: 63
I have an assembly loop:
mov dx, [block_pos]
mov bx,offset GameBoard
add bx, dx
; bx now holds the address of the player
mov cx,5
rows_loop:
add bx,COL_NUM
inc rows_counter
cmp [bx],'_'
je print_rows
loop rows_loop
I'm adding to bx the number of cols in the board, and each time I check if there is a wall in there.
And somehow, when [bx] is equal to '_' (a wall in the game), it won't jump to print_rows
After many tries, I'm pretty sure it's something with the actual syntax or something else instead of the logic behind the code.
Upvotes: 1
Views: 220
Reputation: 58762
You didn't specify operand size for the cmp [bx], '_'
. Sensible assemblers will abort with an error. You didn't mention what assembler you are using, so maybe yours uses word size by default and that will not match your board. You might need something like cmp byte ptr [bx], '_'
PS: Learn to use a debugger (and your assembler ;)).
Upvotes: 1