Closed dansanderson closed 5 months ago
b65.src get_number
accepts a maximum length, which in this case is the string length. But it is not decrementing the maximum length when consuming the sign. I think it just needs a dec count
after 10$ inw txtptr
but we should test this thoroughly, as it is used for all number parsing in BASIC.
Test Environment (required) You can use MEGA65INFO to retrieve this.
Describe the bug VAL() interprets a string value as a number and returns the number. In the edge case where the string represents a negative number and the next byte in string value memory is a PETSCII digit, VAL will read the extra digit as if it were part of a number.
To Reproduce The easiest way to reproduce is to set a string variable, locate its string value memory, poke a digit at the end, then VAL(). One way to do this in BASIC:
This incorrectly prints:
-5 -56
It should print-5 -5
Notice counter case where A$ is positive, e.g.: A$="45"