The following code does not behave as expected.
The issue is that if the values are as follows;
ptr 37 = 110
ptr 36 = 100
ptr 35 = 88
b1 = 105,
b20 calculates to 115
the logic will take the process through to REF 2 at which stage the ptr should be at 36. The simulator says it is still at 37.
However it uses value stored at ptr 35!
Following this closely in the simulator,
at REF 1, the ptr does not change but after the then of the test at REF 2 it has jumped to 35.
So even though the line is processed and the test undertaken at REF 1, AND the ptr has decremented to 36 it does not show up that way in the simulator. It has decremented else it would not decrement to 35 at the next @ptrdec.
However at REF 2, it does not use the value for ptr 36 (as it should) but uses the value for ptr 35.
It seems to behave inconsistently.
The behaviour in hardware is the same as that in the simulator.
Code:
Let b6=0
' read 137,b21
ptr = 37
b20 = @ptr +9 /20 +@ptr
If b1 > b20 Then
' hi2cout [IO_3],$12,(%11111111)
Goto SpeedEnd
EndIf
If b1 >= @ptrdec Then '## REF 1
b6=180
goto SpeedOut
EndIf
' read 136,b21
If b1 >= @ptrdec Then '## REF 2
b6=179
goto SpeedOut
EndIf
ptr 37 = 110
ptr 36 = 100
ptr 35 = 88
b1 = 105,
b20 calculates to 115
the logic will take the process through to REF 2 at which stage the ptr should be at 36. The simulator says it is still at 37.
However it uses value stored at ptr 35!
Following this closely in the simulator,
at REF 1, the ptr does not change but after the then of the test at REF 2 it has jumped to 35.
So even though the line is processed and the test undertaken at REF 1, AND the ptr has decremented to 36 it does not show up that way in the simulator. It has decremented else it would not decrement to 35 at the next @ptrdec.
However at REF 2, it does not use the value for ptr 36 (as it should) but uses the value for ptr 35.
It seems to behave inconsistently.
The behaviour in hardware is the same as that in the simulator.
Last edited: