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.
Option TargetCPU zx1280n
public const StackSize as integer = 1000
public Stack(1 to StackSize) as byte
Sub Main()
sleep 0.5
calltask Task(400.0, 1400.0, -60.0, 80.1), Stack
End Sub
sub Task (byval param1 as single, byval param2 as single, byval param3 as single, byval param4 as single)
debug.print "param1="; param1
debug.print "param2="; param2
debug.print "param3="; param3
debug.print "param4="; param4
end sub
pjc30943 wrote:Anyone have thoughts as to why this may be?
It turns out that there is a problem with the way that code is generated for task invocation with 4-byte constant parameters (e.g. UnsignedLong, Single) that would manifest when the upper two bytes of the parameter value were zero. There isn't any way to work around the problem other than to avoid letting the compiler see the constant values, i.e. by putting the parameter values in module-level variables.
I've posted an experimental version of the compiler that corrects that problem (and the one related to PulseOut). Note, particularly, that the .zip file contains an updated zxlib.h that must be placed in the zxlib subdirectory of the ZBasic installation directory.