Rob Finch wrote:
Hi, where is the best place to start debugging this problem ? (It's a cpu problem I think, but I need to trace it down to the exact line of code.)
Ready
?10.0*10.0
39.0625
Thanks,
Rob
With any problem like this you need to find out what is going wrong and in this case there are three areas where it can all go pear shaped.
In the conversion from a string to a value.
In the conversion from a value to a string.
In the math routines.
The easiest way to find out is to use a machine code monitor and do something like this ..
NEW
A=10
Now drop into the monitor and look for where A is held in memory. It should be at the start of variables space ($0303 usually in this case) and you should see bytes like this..
$41,$00,$84,$20,$00,$00
The $41,$00 is the variable name and the $84,$20,$00,$00 is the packed floating value for 10. If this is correct then you know the string to value is working.
If this was correct the next thing to do is go back into BASIC (warm start) and do something like this ..
B=10
B=B*A
Now drop into the monitor and look for where B is held in memory. It should be immediately after A and you should see bytes like this..
$42,$00,$87,$48,$00,$00
This is B and the packed floating value for 100. If this is correct but doing ...
PRINT B
... gives a silly value then the value to string routine is broke.
Once you determine which bit is broke you can narrow it down to a specific bit of code by entering test values using a monitor and going back into BASIC to see what happens.
With 100'0s of lines of code it's always difficult to say exactly where something is wrong, best you can do is say this routine or that routine and narrow it down from there.
Cheers,
Lee.