Difficult to pinpoint the problem without an example of the code...
The value
-2147483648 in decimal is
$80000000 in hexadecimal. This is a special value AMOS uses to indicate a
Null value internally. If, for example, it's expecting to evaluate some expression and a function in that expression is not actually a function, it returns this value.
There's an easy to see example using the
Print statement (at least there will be until the next V2.10 release as I've fixed it now
):
When you code
Print in a program, it expects to be followed by an expression - something it can evaluate and actually print. You can then optionally keep adding expressions separated by delimiters (
commas or
semi-colons). If instead, you follow
Print with a delimiter, one of two situations will occur as in these two examples:
Print ;"Hello World" will give a
Syntax Error.
Print ,"Hello World" will print
-2147483648 Hello WorldIn the first one, AMOS is trying to evaluate
";". To do this it goes to the main AMOS Token Table and finds the
";" token:
dc.w L_Nul,L_Nul
dc.b ";"+$80,"O",-1
Both the Instruction and Function Number for the
";" token are defined as
L_Nul and these will give a
Syntax Error if the Interpreter tries to call them.
In the second one, AMOS is trying to evaluate
",". Again, it would go to the main AMOS Token Table and find the
"," token:
dc.w L_Nul,L_FnNull
dc.b ","+$80,"O",-1
This time, the Instruction Number is defined as
L_Nul and this will give a
Syntax Error if the Interpreter tries to call it. But the Function Number is defined as
L_FnNull. That function is the one that returns the
-2147483648 value. The designers of AMOS had to do this as the humble comma crops up all over the place in AMOS Basic, not just as a delimiter when
Print-ing. In all those other cases, the comma token needs to be evaluated by the common evaluation routine, but be recognised as something other than an expression. So it has to return something (
-2147483648) rather than pop out the
Syntax Error. AMOS also uses a lot of shortcuts in the code to avoid that happening anyway when it finds a comma token. So this behaviour is a bit of a safety net.
The bug is
not in the Interpreter
Print-ing the wrong thing. It's the Tokeniser (the code that turns your text program into AMOS tokenised code) that fails to reject it when you type your code into your program.
Back to the compiler! I haven't pulled it apart yet but suspect something similar is happening. If you can supply an example of the code where it's happening, it would be a great help in tracking down this bug... I'll also, of course, add it to the bugs list when I have that example (pretty please?).