Pedro Zorzenon Neto wrote:
In the assembler, there is no "cmp" after "mov", and msp user guide
tells that "mov" opcode does not affect Z flag.
The ADD is the instruction that affects the Z flag, and since the MOV
doesn't alter Z, it is still intact when the JNE is executed. Mspgcc
looks like it is correct.
Code generated by mspgcc:
.L3:
mov &menu_i, r15
rla r15
rla r15
add #menu_stack+2, r15
add #llo(12), @r15
mov @r15, r15
jne .L3
Code that I think is correct:
.L3:
mov &menu_i, r15
rla r15
rla r15
add #menu_stack+2, r15
add #llo(12), @r15
mov @r15, r15
cmp #0, r15 ; <- this is missing
jne .L3