BASIC ROLL command?

If you have feature requests, this is the place to post them. Please note your idea may already be something we have already discussed and decided against, or something we are working on privately, and we cannot be held responsible for any similarities in such instance. Whilst we cannot respond to every suggestion, your idea will be read and responded to where possible. Thank you for your input!
kelli217
Posts: 513
Joined: Sun Jul 05, 2020 11:27 pm

Re: BASIC ROLL command?

Post by kelli217 »

Yeah, here's another tidbit for you. The 80-character line length limitation is from the screen editor, not the BASIC parser. Lots of people have built long lines by using 'abbreviations.'

Perhaps you're familiar with the use of '?' to represent PRINT... or, if you're familiar with TRS-80 BASIC, the use of the apostrophe (') to represent REM.

What you may not know about is that many other BASIC keywords have abbreviations in CBM BASIC as well. The trick is to find the fewest non-ambiguous characters that identify a BASIC keyword, and hold down Shift while typing the last letter.

For example, DATA can be abbreviated as D♠ (in upper/lower PETSCII mode, this will look like dA). And since technically, the PRINT# keyword is a different command, you can't use ?# for it, but you can use P followed by Shift-R, and this abbreviates the entire thing; you don't even need the # sign. You get a six-character keyword for only two characters entered.

The practical limitation for a BASIC line length is 250 entities (whether characters in literals or keyword tokens). I don't know if BASLOAD checks for that maximum. But yeah, it should work as long as you stay at or under that maximum, though as you've noted, you're going to have trouble editing that once it's been tokenized.
MarkTheStrange
Posts: 17
Joined: Sat Nov 26, 2022 6:24 pm

Re: BASIC ROLL command?

Post by MarkTheStrange »

The abbreviation is not always what you expect; it's based on the order the keywords appear in the table in ROM, first match wins. So, for instance, iN is INPUT#, not INPUT. In fact, so are inP, inpU, and inpuT; there is no way to abbreviate INPUT at all.

But yes, BASIC will handle a line of 250 bytes: after adding 2 bytes for the pointer to the next line, 2 for the line number, and 1 for the zero byte end-of-line terminator, you get 255.
DragWx
Posts: 309
Joined: Tue Mar 07, 2023 9:07 pm

Re: BASIC ROLL command?

Post by DragWx »

Just popping in to confirm, RND(.) is slightly faster than RND(π), but I don't know how much of that is due to RND(0) differing from RND(1), and how much is due to the parsing speed of dot vs pi. Whatever the case is, this is the net result.

Edit: Parsing a dot is negligibly slower than parsing pi (like, not even 1% slower), but RND(0) itself is about 47% faster than RND(1). Sometimes I forget the tool to benchmark BASIC is BASIC. :P

Edit 2: For some reason, A*RND() is slightly faster than RND()*A.
Post Reply