And now I modified it in lines 76 to 78 : I modified the order of the operators, putting the variables in leading position and the litteral at the end. And now ... IT WORKS !
I read some informations in the Help about operations, related with "Byte" or "Word" mode, and "casting" (in "Setting variables"). I suspect that the litteral in first place in the formula sometimes switches the compiler in a "wrong" mode, and that one should ever begin with variable names in a calculation ...
Test 2 produces INVALID ASM as follows: Note the first lds systemp2 has no register. So, systemp2 is not initialised to a known state, then this unknown state is INCremented. Therefore, the calculation IS incorrect. Examination the ASM shows that the asm should be lds systemp2, MARCHE_AVANT - this would yield the correct result. I will resolve in the new compiler.
I have tried to define a workaround. One method at the moment is to move the constant to the end, or, another method to try (I cannot prove here, so please test for me) is to use method Test 3
BUG FOUND: At releases prior to release v0.98.07 always add CONSTANTS at the end of the numerical calculation.
As follows: Where 1 is the constant.
numero_message_local = Marche_avant + gare + 1
This will fail to yield the correct result: Where the constant 1 is the first number in the maths calc.
numero_message_local = 1 + Marche_avant + gare
This issue is AVR only and does not impact the PIC.
I will look to resolve in v0.98.07 meanwhile alway put CONSTANTS at the end of the line of numeric calculations.
Anobium
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
I have located the compiler code segment where the LDS instruction does not have a parameter - this is the error in terms of the ASM.
I need to work back through the compiler to understand why the compiler is not determining the source variable correctly.
@Bertrand. I will add a check in the compiler to catch this error. The compiler could issue an error message and then the user would be aware, and, the user can then resolve. Not nice but much better than no message and bad ASM.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
I took my prog and modified it back, all numeric variables as Byte (no Word). This attached program has the error with PortD.7
And now I modified it in lines 76 to 78 : I modified the order of the operators, putting the variables in leading position and the litteral at the end. And now ... IT WORKS !
I read some informations in the Help about operations, related with "Byte" or "Word" mode, and "casting" (in "Setting variables"). I suspect that the litteral in first place in the formula sometimes switches the compiler in a "wrong" mode, and that one should ever begin with variable names in a calculation ...
I have found the bug based on your words in the post.
I need a really simple piece of code to test. This is the test.
Test 1 produces valid ASM as follows:
Test 2 produces INVALID ASM as follows: Note the first
lds systemp2
has no register. So, systemp2 is not initialised to a known state, then this unknown state is INCremented. Therefore, the calculation IS incorrect. Examination the ASM shows that the asm should belds systemp2, MARCHE_AVANT
- this would yield the correct result. I will resolve in the new compiler.I have tried to define a workaround. One method at the moment is to move the constant to the end, or, another method to try (I cannot prove here, so please test for me) is to use method Test 3
'Test 3
numero_message_local = 1 : numero_message_local = numero_message_local = Marche_avant + gare
Last edit: Anobium 2020-08-06
BUG FOUND: At releases prior to release v0.98.07 always add CONSTANTS at the end of the numerical calculation.
As follows: Where 1 is the constant.
numero_message_local = Marche_avant + gare + 1
This will fail to yield the correct result: Where the constant 1 is the first number in the maths calc.
numero_message_local = 1 + Marche_avant + gare
This issue is AVR only and does not impact the PIC.
I will look to resolve in v0.98.07 meanwhile alway put CONSTANTS at the end of the line of numeric calculations.
Anobium
I have located the compiler code segment where the LDS instruction does not have a parameter - this is the error in terms of the ASM.
I need to work back through the compiler to understand why the compiler is not determining the source variable correctly.
@Bertrand. I will add a check in the compiler to catch this error. The compiler could issue an error message and then the user would be aware, and, the user can then resolve. Not nice but much better than no message and bad ASM.
I am happy that I could contribute to resolve a bug ...
When can we expect 0.98.07 ?
We are awaiting Hugh to complete the deep compiler changes. Then we can release. Not sure when - sorry.
Issue is resolved in Great Cow BASIC v0.98.07 RC 22 or greater.
Last edit: Anobium 2020-08-07