Pedro Zorzenon Neto wrote:
Code generated by mspgcc:
.L3:
mov &menu_i, r15 ; Load 'menu_i' into r15
rla r15 ; Rotate Left twice to adjust index
rla r15 ; into a memory offset (element size
is 4)
add #menu_stack+2, r15 ; Add start of the array to the offset
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
As I see it --
The add and move of @r15 to r15 followed by compare if zero to r15 is
not functionally different from just the add and move, since the add is
with @r15 and not r15.
There may be a bug lurking elsewhere, but I don't think that's it.
Does your code work correctly when compiled on your PC?
Are there any mspgcc developers out there with any feedback for Pedro?
- jake.