Hacker News new | ask | show | jobs
by dspillett 926 days ago
> The nostalgia for me around the language is strong

Same here. I cut my programming teeth on BBC Basic and later 6502 assembly, initially on an Electron, then the Model Bs at school, and we later had a Master 128 at home.

The integrated multi-pass assembler was a godsend for someone who got to the point of wanting to play around at a lower level, but before getting to that stage the language had other things that set it far apart from other micros of the era:

• Better structured programming constructs: proper procedures and functions where some other 8-bit BASIC implementations had nothing beyond GOTO/GOSUB. With a little hoop jump you could completely do away with line numbers.

• Long variable names, where some implementations only allowed two, or even just one, character. This allowed code to be a little more self-documenting. IIRC it only considered the first 40 characters⁰ despite not erroring when there were more though, so if you used anything longer one variable could silently clobber another.

----

[0] but who was using such long names in the limited memory¹ of an 8-bit home micro?!

[1] I did actually write something a bit akin to modern JS minimisers, to make things fit in the smaller model A² machines: it removed REM statements and did a fairly naive scan-then-search-and-replace to replace long names with shorter ones

[2] these had only 16KB rather than 32, which after taking out screen memory and other standard allocations were taken out didn't leave a lot of room for your code to live in

1 comments

The name lookup routine is "Find name in catalogue" here: https://archive.org/details/BBCMicroCompendium/page/314/mode...

There's no obvious length check. I guess the actual limit will be 255 or 254 characters, maybe minus a bit if the info block has any extra data.

EDIT: previous discussion: https://news.ycombinator.com/item?id=19246063

Hmm. I wonder where I get the 40-character-limit memory so strongly from…

Line length was limited by a byte-length counter and IIRC included the line number and maybe EOL, so would be something like 253 or 252. Do the maximum usable variable name length will be a couple of bytes less than that as you'll need a couple of characters to do something with is (LongLongLong...Long=1 and so forth).

EDIT: oh, interesting. The only references I can find to a variable name limit of 40 characters are referring to the PC BASIC implementations by MS: GWBasic, QuickBasic, and QBasic. I did do work in those too.