1

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.

1 Answer 1

1

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 ;)).

Sign up to request clarification or add additional context in comments.

1 Comment

same results. btw, i'm using 8086 assembly

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.