gs80065xe Posted December 7, 2020 Share Posted December 7, 2020 I’m converting an Atari Basic display list dump program to FastBasic. But the display list starts at the edge of the 16bit integer maximum limit. So many of the addresses are overflowing When using variables. I’ve tried using float variables. But peek and dpeek doesn’t accept them. I get a parser error. Is there a way to only use positive integer variables with values 0 to 65535? Quote Link to comment Share on other sites More sharing options...
vitoco Posted December 8, 2020 Share Posted December 8, 2020 Variables with values higher than 32767 are PRINTed as negative numbers, but they are still OK for a POKE. Address -1 is still 65535, and address -32768 is 32768. You should not get a syntax error for using an address between -32768 and 65535, where the range from -32768 to -1 is the same as the range from 32768 to 65535. 1 Quote Link to comment Share on other sites More sharing options...
gs80065xe Posted December 8, 2020 Author Share Posted December 8, 2020 Thanks. That’s the behavior I observed. Since it only affects printing then I guess it’s OK. I’ve been spoiled by modern tech. No used to these tight constraints. Quote Link to comment Share on other sites More sharing options...
dmsc Posted December 12, 2020 Share Posted December 12, 2020 Hi! On 12/7/2020 at 10:22 PM, gs80065xe said: Thanks. That’s the behavior I observed. Since it only affects printing then I guess it’s OK. I’ve been spoiled by modern tech. No used to these tight constraints. FastBasic uses standard two's complement numbers for the integer values, so they can be treated as signed (from -32768 to 32767) or unsigned (from 0 to 65536). This means: - As memory addresses (on PEEK, POKE, etc) they work as unsigned, as standard Atari convention and also as signed, so you can use "PEEK(-11766)" or "A=USR(-7049)"; - Addition, subtraction and multiplication works in both cases; - Division and printing take the sign into account, and can't be used with numbers > 32767; - Greater-than and less-than comparisons also use the sign, so you need to be very careful with FOR loops, if you need and ending > 32767 you need to use WHILE or REPEAT loops and compare with "=". Have Fun! Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.