Compiler Error using W
Hello Terry;
A little obscure issue here with the SX/B compiler....
From time to time it is convenient to use W as a destination variable, and that usually works well. But I just tripped accross an·instance where in ORing two variables into W, at the end of the construct it attempts to set W to itself (mov w,w), and the assembler does not like that. The assembler wants to use WReg as the source, not just W.
The following snippets demonstrate the first few that work OK, and the last two that will not.
···· __41 SchedCallCtr and __41AlarmCallCtr are aliased regular varables
···W = __41SchedCallCtr + __41AlarmCallCtr··························'OK
···W = __41SchedCallCtr * __41AlarmCallCtr··························'OK
···W = __41SchedCallCtr / __41AlarmCallCtr·························· 'OK
···W = __41SchedCallCtr AND __41AlarmCallCtr······················ 'OK
···W = __41SchedCallCtr AND NOT __41AlarmCallCtr··············· 'OK
'···W = __41SchedCallCtr OR __41AlarmCallCtr······················· 'FAIL
'···W = __41SchedCallCtr - __41AlarmCallCtr························· 'FAIL
I have not tried·other combinations.
By the way, I believe I have made tremendous strides in making SX/B behave the way I want it to, and no longer need to revert to assembler as much, and still come out with pretty concise code. Roughly I see a 10 to 20% penalty for SX/B over assembler just now, and that is very tolerable for the improved vision I get in grasping the whole application..... sitting at $EF2 just now, but still abunch of code to add, so some more SX/B optimization to be done.
Thanks a lot for all your effort in this!······ " I'm lovin' it! "
Cheers,
Peter (pjv)
A little obscure issue here with the SX/B compiler....
From time to time it is convenient to use W as a destination variable, and that usually works well. But I just tripped accross an·instance where in ORing two variables into W, at the end of the construct it attempts to set W to itself (mov w,w), and the assembler does not like that. The assembler wants to use WReg as the source, not just W.
The following snippets demonstrate the first few that work OK, and the last two that will not.
···· __41 SchedCallCtr and __41AlarmCallCtr are aliased regular varables
···W = __41SchedCallCtr + __41AlarmCallCtr··························'OK
···W = __41SchedCallCtr * __41AlarmCallCtr··························'OK
···W = __41SchedCallCtr / __41AlarmCallCtr·························· 'OK
···W = __41SchedCallCtr AND __41AlarmCallCtr······················ 'OK
···W = __41SchedCallCtr AND NOT __41AlarmCallCtr··············· 'OK
'···W = __41SchedCallCtr OR __41AlarmCallCtr······················· 'FAIL
'···W = __41SchedCallCtr - __41AlarmCallCtr························· 'FAIL
I have not tried·other combinations.
By the way, I believe I have made tremendous strides in making SX/B behave the way I want it to, and no longer need to revert to assembler as much, and still come out with pretty concise code. Roughly I see a 10 to 20% penalty for SX/B over assembler just now, and that is very tolerable for the improved vision I get in grasping the whole application..... sitting at $EF2 just now, but still abunch of code to add, so some more SX/B optimization to be done.
Thanks a lot for all your effort in this!······ " I'm lovin' it! "
Cheers,
Peter (pjv)
Comments
I'll look into the two errant instructions.
Bean.
P.S. If you use "FOR temp = 10 TO 1 STEP -1", the "NEXT" is optimized as "DJNZ temp,@__FOR"
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
There is a fine line between arrogance and confidence. Make sure you don't cross it...
·
I have posted version 2.00.26 that should take take of the issues you discovered.
Bean.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
There is a fine line between arrogance and confidence. Make sure you don't cross it...
·
Cheers,
Peter (pjv)
I see the nice FOR/NEXT optimization works only for VAR down to 1. Could it also be made to work with VAR down to 0 ? Perhaps a pre decrement??
Thanks,
Cheers,
Peter (pjv)