Discussion about the ZBasic language including the System Library. If you're not sure where to post your message, do it here. However, do not make test posts here; that's the purpose of the Sandbox.
FFMan wrote:if i play about with the order of the functions [...]
What I have found is that a register is getting trashed by the OpenPWM() call that should be being preserved. Consequently, the behavior will vary depending on how the compiler allocates register usage and in some cases it will be completely benign.
Now that I know what is happening I just need to track down why.
dkinzer wrote:What I have found is that a register is getting trashed by the OpenPWM() call that should be being preserved.
I believe that I have found the cause of the problem and have fixed it. The problem potentially affects the AVR mega-based ZX devices that have only one 16-bit timer.
You can download an experimental version of the mega328P ZBasic library using the URL below. In that .zip file, the file libmega328P.a should be copied to the zlib/avr/lib subdirectory of the ZBasic installation directory (renaming the existing file first if desired).