| Author |
Message |
pjc30943
Joined: 02 Dec 2005
|
|
Posted: 01 August 2008, 0:11 AM Post subject: CallTask parameter errors? |
|
|
The following code outputs
| Code: | ZBasic v2.5.5
param1=400.5366
param2=-60.06506
param3=4.168593E-08
param4=#.# |
Anyone have thoughts as to why this may be? The 1k stack is overkill, but just to eliminate any possible stack issues...
| Code: |
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 |
|
|
| Back to top |
|
 |
dkinzer Site Admin
Joined: 03 Sep 2005
Location: Portland, OR
|
|
Posted: 01 August 2008, 16:14 PM Post subject: Re: CallTask parameter errors? |
|
|
| 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. |
|
| Back to top |
|
 |
pjc30943
Joined: 02 Dec 2005
|
|
Posted: 01 August 2008, 20:14 PM Post subject: |
|
|
| This fixes the issue. Thanks Don. |
|
| Back to top |
|
 |
|