BBC Basic returns on multiple platforms, open sourced
bbcbasic.co.uk
bbcbasic.co.uk
- instant-on - you turned on the power switch at the back of the BBC Micro, got the double beep, and in less than a second were dropped into a REPL / shell with the language
- integrated assembler - you could inline assembly language really easily
- great documentation - before the web, documentation meant books - of which there were many - but also crucially in the BBC Micro's case also many television shows from the BBC.
- direct access to hardware - I realise this isn't BBC Basic itself really, but being able to PEEK and POKE (well, use ? and ! operators) to memory-mapped hardware addresses was great fun, and a great way to learn about how things worked.
The nostalgia for me around the language is strong, but without the hardware platform I'm not sure I'd want to go back to it.
Sometimes replaced with a smoke screen at this age: https://www.youtube.com/watch?v=TU55-7dWMi0
I must admit, I feel somewhat similarly to you. I want to prod at the hardware and write some assembly code. Whereas if I wanted to work with SDL there are better ways for me to do that.
With that being said, BBC Basic was a great entry point into programming for a lot of people and it's perhaps the case that it could still be so, so I do appreciate the fact this project exists.
Line numbers are arbitrary, you can just use GOTO to jump to some out-of-line code then GOTO back at the end. It gets a bit spaghetti'ish if you do it lot, though.
The school I went to only had a cpuple of computers, so I wrote code longhand on A4 lined paper. When I needed to insert lines, I wrote them on a slip of paper that I placed at the appropriate place on the page and stapled on the right-hand edge.
We've certainly come a long way.
10 PRINT "This computer is overheated."
20 PRINT "WARNING: Computer about to EXPLODE!..."
30 GO TO 10
RUN
Newbies walking up saw the active screen, got wide-eyed and walked away quickly. One even called security, as I watched from a distance. Good times!Another thing that one got: a printed circuit diagram of the machine.
As for today: One can get get an entire annotated disassembly for Elite, including the version that used the Second Processor: https://www.bbcelite.com
Those BBC TV shows had the unusual feature of broadcasting software over the end credits. Just had to tape the screeching and play it back into the computer.
I actually tried downloading programes from the Dutch radio station back in those days - and it worked.
That was your queue to literally physically stick the box over that square on the screen and then a few minutes later during the end credits that square would turn into what would look like to the human eye just plain old static but to the sensor in the box stuck over it, it was reading it as a datastream that the software would interpret and save.
To be honestly it wasn't terribly reliable, I think we got it to work maybe once or twice in the few times they did it but was an interesting experiment by the BBC back in the 80s!
Can you explain this? Do you mean that BASIC programs were encoded as sound in some way, and then could be uploaded into the computer and run?
The tape would contain bleeps and blurps which would be decoded into bytes by the computer. EG this is the sound produced by an Amstrad cpc464 loading a game: https://www.youtube.com/watch?v=OvChkOHgDIo
This meant that to copy software you didn't even need a computer, just a double cassette deck.
And that by recording the credits of this BBC show to tape and playing that back into the computer you'd load some program. That's actually a brilliant idea, I wonder what kind of software they broadcasted.
Sounds (pun not intended but noticed) like steganography.
Software has even been distributed on vinyl records and flexi singles!
You could connect a domestic cassette recorder up to a BBC Micro and use to save and load software onto normal cassettes!
There were favoured devices that would give better results and better cassettes for data storage and so on.
Its all ancient history and folklore now :-)
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
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
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.
The combination of BASIC with the basic ability to have inline assembly was very convenient - just use a BASIC for loop for two-pass assembly, use CHAIN to split source into multiple files, etc.
I had a ponder on the attractions of the 8-bit era a few days ago ...
https://thechipletter.substack.com/p/the-virtues-of-the-8-bi...
Closest I've found to a modern version is the Colour Maximite
- Instant-on - You hit F12 and in less than a second you've got an IDE with a REPL
- Integrated assembler - While I don't think you can inline it, WASM is really easily used: https://developer.mozilla.org/en-US/docs/WebAssembly/Loading...
- Great documentation: https://developer.mozilla.org/en-US/
- Way too much access to hardware: I wish browsers had less access to hardware due to privacy and security, and I don't know how low level the APIs get, but it's something you can play around with as a random person with a web browser, so that's neat.
Yes, as easily as this:
some BASIC statements here
[ some assembly statements here ]
some BASIC statements here
IOW, you just had to enclose your assembly language statements in square brackets. That's it.
Of course, you would need to know what memory addresses to operate on, in a real-life program, as opposed to a demo, so that you could share data in some way between the BASIC code and the assembly code, otherwise the program might not be able to do anything useful.
I don’t know about the multi-pass assembler feature that others have mentioned in this thread.
Using 1 would suppress errors, which would mean you wouldn't know if your code was bad.
You could use 0 and 3 or, if you don't want a listing, 0 and 2.
Search this page for 'first pass', for a more complete explanation: https://central.kaserver5.org/Kasoft/Typeset/BBC/Ch43.html
But I'll check that page out anyway.
Thanks again.
My first computer was a PDP-8 single board that I had to program in octal (but I wrote an assembler on my company’s Dec-10, so slightly civilized). Later I bought serial number 71 Apple II and loved the built in basic. Older HN readers might have run across my open source Land of the Dwarf adventure game, and I wrote the shitty little chess program Apple distributed on their demo cassette in Woz’s Basic. So, BBC Basic just made me feel nostalgic.
It looks like it has preserved the spirit of BBC Micro development on modern platforms, though.
The use of INKEY$(-256) to determine underlying platform is amusing.
As his page about it states:
"BBC BASIC (86) Plus is an implementation of BBC BASIC for PC compatibles running MS-DOS™; it has been designed to be as compatible as possible with Version 4 of the 6502 BBC BASIC resident in the BBC Micro Master series."
(https://www.bbcbasic.co.uk/bbcbasic/bbcdos.html)
That should then give you something close to the form I used on my Model A back around '83.
https://web.archive.org/web/20231129084247/https://www.bbcba...
Edit: Here's the open source on GitHub:
JavaScript: Cool language, but I was not excited about all of my work happening in a web browser. I wanted to make imperative programs, but most JavaScript tutorials were focused on enabling little DOM manipulations that were not very exciting to me. Plus, the heavy focus on Async programming went over my head. If NodeJS was around when I was first dabbling with JavaScript I probably would have stuck around with it more.
Python: Probably the best thing to introduce to a kid these days, but I used a shared family Windows computer with restricted users and setting up environments and package managers was always a pain.
I ended up spending a lot of time with Scratch, mostly for the collaborative online community.
Overall my trajectory was BASIC256->Scratch->C++->Python/Java/everything else
I think the trade-off is that Python has an immense ecosystem - libraries (e.g. PyGame Zero), education material, people. Plus you can point to real-world examples of people building stuff with Python - you can make actual money with it. I'd be worried that teaching BASIC puts them in a niche - one where they make progress more quickly, but struggle to get out of.
I'd think that learning BASIC then Python (or Ruby, PHP, JS, whatever) would still be a lot easier (at least for a 10 year old kid) than starting with one of the latter languages directly, due to the incidental complexity that all of those have. Most pro developers will be able to work with more than one language anyway.
This, pretty much. Of course it would be even simpler to start from a language where the only "type" is the machine word, like assembly or some varieties of FORTH. A language like BASIC adds only a slight amount of complexity, for a sizeable gain in ease of use and intuition.
I think even something like Python might’ve been too subtle for me at the time.
When I learned to code you had the manual for the computer and it contained so much information that was alien to you - but then you'd start with BASIC and learn to use that to do a few things. Then some more of the information in the manual would start to make sense and you'd start to poke values in to memory locations to achieve things you couldn't do directly in BASIC. After a while you'd start replacing the slow parts of you BASIC program with little machine code routines (worked out from information in the manual). After a while you knew you machine inside and out.
What made that all possible though was the limited scale of the computer, while modern computers are essentially the same as they were back then, they're on an entirely different scale which makes it impossible to hold it all in your head at the same time.
These day's beginners would better served by learning the logical patterns of programming, which I think are easier to see in modern scripting languages.
Kids are rarely interested in implementing data structures/algorithms efficiently. Instead, they want something more visually appealing, like graphics or 2D/3D game. Python is more "battery included" on this aspect.
Although this trend also attracts certain for-profit entities who like to release their code as "open source" to join the bandwagon, except the license used is decidedly not open source.
Part of the BBC's mandate (public funding requires public benefit, the mandate is essentially the contractual definition of the BBC's "deliverables") requires the production of educational content. As part of this, they had a programs for computer literacy in the early 80s - and commissioned a computer to go with them. So we had the BBC Micro running BBC Basic. We still had some left in school well into the 90s.
It's an interesting bit of history, because it gave a huge boost to the company that won the contract. Acorn soon after went on to develop the Acorn RISC Machine, featuring the ARM1 processor.
Sophie Wilson wrote the language, first in 6502 assembler, later in ARM assembler.
https://en.wikipedia.org/wiki/BBC_BASIC
This linked article of interviews has much greater depth.
One of the things I noticed about the new interpreter's restrictions was that framebuffer pixel accesses have become significantly slow and we're unable to do such things fast because of our dependency on GPU/Host transfers for all new rendering.
I do think there's a lot more going on than that. Here's SDL's current pixel access code:
https://github.com/libsdl-org/SDL/blob/main/src/video/SDL_su...
To do a pixel read there's at least a lock, memcpy, format conversion and an unlock.
Then, convert that into a texture and send it to the GPU once per frame. This is the only added overhead relative to the old ways. If you picked the right format for your in-memory buffer (probably ARGB-8888, perhaps with a certain row stride) then that conversion is a nop. The "correct" format depends on your hardware (which is why this isn't a typical workflow), but even a non-trivial pixel format conversion is fast at 640x480.
If you wanted to send a 3840*2160 texture to your GPU at 60Hz, that requires "only" 2GBps of bandwidth, which I think you'll find in most modern systems. This is pretty inefficient, which is why we don't do it, but it can be done.
Edit: I think this stackoverflow answer gives a good summary of how to actually do this in SDL2, but I haven't tried it: https://gamedev.stackexchange.com/a/157608
The linked docs are also worth a read: https://wiki.libsdl.org/SDL2/MigrationGuide#if-your-game-jus...
https://gist.github.com/DavidBuchanan314/2f68ff42df047a448be...
Every bit (pun intended) helps.
Any blog or book recommendations?
http://webcache.googleusercontent.com/search?q=cache:4YHOl0l...
Blog: https://blog.mousefingers.com/ Paul Malin posted a bunch of hints on how to do the demoscene-ish things we do with the bbcmicrobot (ex-twitter, now mastodon)
The stardot forums have everything: https://www.stardot.org.uk/forums/ lots of lore on how to do stuff, plus old posts with manuals and books for the BBC Micro, including the Acorn GXR ROM manual for the extended graphics routines
I've been doing BBC Microbot posts since the start of the pandemic, after not having touched a beeb since maybe 1988. When I'm doing this stuff it does feel like a lot of lore is beyond the horizon of online history, like doing graphics without matrix multiplication - so eg https://surma.dev/things/ditherpunk/ talks about bayer dithering etc algorithms that are too much code, so is https://extremelearning.com.au/a-simple-method-to-construct-..., but it at least led me to the right search terms to get to https://en.wikipedia.org/wiki/Low-discrepancy_sequence#Addit... which does let you dither in very little code https://media.hachyderm.io/media_attachments/files/111/444/4... - and that's before digging into the specifics of the machine. A lot of the better tricks I see others do on the beeb involve knowing things about its memory layout, 6502 assembler and so on, I think I'd need to spend ages reading the back issue magazines of the 80s on archive.org to get up to speed on all this - it's just not collected anywhere any more
Basic was the first language I learned so its nice to see it repackaged.
256 Megs is alot!
Modern BBC is alot bigger than what we used to have available to us in the 90s.
[1] a computer + a language + dev tools