Hello Merlin and Thomas,
with the optimiser the problem happens here:
endcase;
textbuffer := filename;
for some (for me unknown) reasons the optimiser seems
to provide a wrong Frame offset for the local source string "FileName".
When I take a look into the RAM Window before this assignment it shows:
Pict_1
After this it shows:
Pict_2
This is because the register register (R30, R31) is loaded with the wrong
address, $21A0 instead of $219D, so the whole string block transfer fails.
Here we can see the differences in DSM:
Code
.FRAME 6
MOVW _ACCCLO, _FRAMEPTR
ADIW _ACCCLO, 000008h
CALL SYSTEM.StrVar2Str
....
.FRAME 6
MOVW _ACCCLO, _FRAMEPTR
ADIW _ACCCLO, 000008h
CALL SYSTEM.StrVar2Str
and this is in the optimised ASM:
Code
.FRAME 3
MOVW _ACCCLO, _FRAMEPTR
ADIW _ACCCLO, 000005h
RCALL SYSTEM.StrVar2Str
...
.FRAME 6
MOVW _ACCCLO, _FRAMEPTR
ADIW _ACCCLO, 000008h
RCALL SYSTEM.StrVar2Str
The second
.Frame directive seems to be wrong.
The resulting ASM code should be:
Code
.FRAME 3
MOVW _ACCCLO, _FRAMEPTR
ADIW _ACCCLO, 000005h
RCALL SYSTEM.StrVar2Str
With
.Frame 3 and
offset 05h it works.
Sorry Merlin, this is a problem of the Optimiser.
rolf