Live data from Hacker News

BBC Basic returns on multiple platforms, open sourced

bbcbasic.co.uk

41–50 of 120 posts

Re: BBC Basic returns on multiple platforms, open sourced

#41
post #15

Looking at the difference page, it's not BBC BASIC as one might remember it. But that's not possible outwith actual BBC Micro hardware, complete with Kenneth Kendall's voice in ROM. And I suspect that Kenneth Kendall cannot be open sourced. (-: 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.

It’s a reimplementation in C by Richard Russell. If you want a version by Sophie Wilson (who created BBC BASIC) there’s one in RISC OS written in ARM assembler.

Re: BBC Basic returns on multiple platforms, open sourced

#43
post #3

If you're teaching 10 year old kids to code, is there an advantage to using something like this over Python or JavaScript?

I'd say no, at least not on modern computers.

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.

Re: BBC Basic returns on multiple platforms, open sourced

#44
post #3

If you're teaching 10 year old kids to code, is there an advantage to using something like this over Python or JavaScript?

Just a speculation (I never teach coding to 10 year old kids, anyway): most likely no.

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.

Re: BBC Basic returns on multiple platforms, open sourced

#45
post #4

The killer features of BBC Basic for me were: - 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 M…

> 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

Re: BBC Basic returns on multiple platforms, open sourced

#47

Earlier quoted context omitted.

Before getting my hands on a BBC Micro I'd done all my teenage programming on an Apple II - so the killer feature of BBC Basic for me was that it had a renumber command. No more having to re-type code because I'd used-up all the line numbers between line 110 and 120. A little thing but it felt like magic.

> No more having to re-type code because I'd used-up all the line numbers between line 110 and 120. 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.

Even back in ~1985 I'd have felt bad about such a practice. And I had only the very vaguest notions about "structured programming".

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.

Re: BBC Basic returns on multiple platforms, open sourced

#48
post #40
post #38

Earlier quoted context omitted.

You can still do framebuffer pixel access pretty fast if you want to, the main issue is just that the average framebuffer today has exponentially more pixels.

If that app ran in a 640x480 mode, memory accesses would be just as fast as the VGA applications 25 years ago, correct? 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.

SDL is simply not optimised for this use-case, but that doesn't mean it can't be done. If you're writing single-threaded code (which I assume BBC Basic is!), you can cut out the locking and directly poke a 640x480x3 array in memory. This part is extremely fast, as fast as your memory subsystem can go.

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...

Re: BBC Basic returns on multiple platforms, open sourced

#49
post #28

It's good to see old software being released as open-source with no-strings-attached OSI approved open source licenses. 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.

This is not old software being open sourced. It's a cross-platform re-implementation of BBC BASIC, and it's been around for years.

Re: BBC Basic returns on multiple platforms, open sourced

#50
post #4

The killer features of BBC Basic for me were: - 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 M…

The integrated assembler was very good. I worked for Acorn in the early 80s (was co-author of Acorn ISO Pascal), and we used our own H/W and S/W for all software development. ISO Pascal came in two 16K ROMS, one holding the compiler (in VM code), and one everything else (virtual machine, screen editor, Pascal libraries etc) which was all written in assembler using BBC Basic.

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.

Post reply on HN