ralphb Posted January 2, 2022 Share Posted January 2, 2022 (edited) I'm totally flashed by the fact that the following TI BASIC program runs fine and outputs 1 and 0. 10 A=1 20 B=NOT(A) 30 PRINT A;B Same for AND and OR (with two arguments). Those functions also work for IF. Looking at the TI BASIC Reference manual, I find no mention of these boolean functions. Also, the reference suggests using * for AND and + for OR, like I did back in the day. Do I suffer from amnesia, or is this also news to some people? EDIT: Tried on real iron, without peripherals. Edited January 2, 2022 by ralphb 1 Quote Link to comment Share on other sites More sharing options...
mister35mm Posted January 2, 2022 Share Posted January 2, 2022 Using logic functions to reduce 41 lines to SEVEN. 2 1 Quote Link to comment Share on other sites More sharing options...
SteveB Posted January 2, 2022 Share Posted January 2, 2022 I can't really follow here... Are you talking about TI Console BASIC or Extended BASIC? The tokens have been introduced only in XB according to Ninerpedia: And "A=NOT(0)" is not inverting the logical value of B, but declares an array with default dimension 10 and accesses the 0 index value, which is defaultet to 0. I did use logical "boolean" statements a lot in TI BASIC, but in a way "x=x+(k=83)-(k=69)", as true was computed to -1, which is actually funny, as -1 is signed integer >FFFF, all bits set to 1 ... but the TI BASIC does not have 16bit Integers... Cheers, Steve 6 1 Quote Link to comment Share on other sites More sharing options...
ralphb Posted January 2, 2022 Author Share Posted January 2, 2022 9 minutes ago, SteveB said: And "A=NOT(0)" is not inverting the logical value of B, but declares an array with default dimension 10 and accesses the 0 index value, which is defaultet to 0. Oh, that makes sense! My bad, I didn't think of that, and chose my examples very poorly. ? But I also didn't know you can create arrays en passant without a DIM. Anyway, sanity restored. Quote Link to comment Share on other sites More sharing options...
SteveB Posted January 2, 2022 Share Posted January 2, 2022 I learned the DIM thing the hard way ... I spent hours hunting down a typo ... instead of calling a function I was accessing an implicit array ... only when I got a BAD SUBSCRIPT in one test-case I slowly got a clue ... 3 Quote Link to comment Share on other sites More sharing options...
RXB Posted January 2, 2022 Share Posted January 2, 2022 4 hours ago, ralphb said: I'm totally flashed by the fact that the following TI BASIC program runs fine and outputs 1 and 0. 10 A=1 20 B=NOT(A) 30 PRINT A;B Same for AND and OR (with two arguments). Those functions also work for IF. Looking at the TI BASIC Reference manual, I find no mention of these boolean functions. Also, the reference suggests using * for AND and + for OR, like I did back in the day. Do I suffer from amnesia, or is this also news to some people? EDIT: Tried on real iron, without peripherals. GPL programmer here and have my own modified XB too. Your program A is a variable and so is B but as you used NOT as an array NOT(array number) it thinks NOT is also a VARIABLE too. (NOT is not a command subprogram in TI Basic, it is in XB) Thus NOT(A) variable is 0 as it has no value assigned to it yet in TI Basic. That is why in TI Basic PRINT A;B is A=1 and B=0 But in XB you get PRINT A=1 and B=-2 as NOT is a command subprogram in XB. Quote Link to comment Share on other sites More sharing options...
+OLD CS1 Posted January 2, 2022 Share Posted January 2, 2022 Semantic, but AND, OR, and NOT are operators, and not functions. If there is a dialect of BASIC which implements them as a function, I imagine they had to be shoe-horned in as such. @RXB hey, is that maybe why creating a MOD operator is not going well in RXB? Is there a difference between look-ups for functions and operators? Quote Link to comment Share on other sites More sharing options...
RXB Posted January 2, 2022 Share Posted January 2, 2022 3 minutes ago, OLD CS1 said: Semantic, but AND, OR, and NOT are operators, and not functions. If there is a dialect of BASIC which implements them as a function, I imagine they had to be shoe-horned in as such. @RXB hey, is that maybe why creating a MOD operator is not going well in RXB? Is there a difference between look-ups for functions and operators? CALL MOD(number,divisor,quotiant,remainder) works as intended in RXB 2022 and adding a token to XB is a real pain but Lee Stewart and I are working on it. And yes a CALL is much more easy to implement as it uses the same look up as DSR for devices in GPL. And a TOKEN like NOT, AND OR on other hand are a pain as you need a to add it to token table in GPL and ROMs. Then the fun part is to add it to the NUD TABLE in Assembly and GPL so it can PRE SCAN for it before the program is run. This requires an entire rewrite of the ROMs as not that much hassle to add to GPL. There are 3 different spots in XB ROMs that need to be absolute addressed in order to add tokens, oddly TI did not allow for adding them unless a total REWRITE. That would be a major reason for only 100 and 110 version of XB ever released. XB3 tried but he sacrificed more than it was worth. 2 1 Quote Link to comment Share on other sites More sharing options...
apersson850 Posted January 10, 2022 Share Posted January 10, 2022 On 1/2/2022 at 4:07 PM, SteveB said: I did use logical "boolean" statements a lot in TI BASIC, but in a way "x=x+(k=83)-(k=69)", as true was computed to -1, which is actually funny, as -1 is signed integer >FFFF, all bits set to 1 ... but the TI BASIC does not have 16bit Integers... No, but you can still store integer values in BASIC's floating point variables. And if you do use boolean arithmetic on these values (with operators like AND, OR and NOT in Extended BASIC), then it will operate on the 16-bit integer parts of the value in the variable. 2 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.