Hello, Guest the thread was called11k times and contains 210 replays

last post from FeralChild at the

BBC BASIC for the MEGA65?

  • The BBC Basic is just another fascinating Basic from the 80s.

    Not less and not more.

    No, I'm afraid I completely disagree with that.


    For a start, it's not "just another" version of BASIC from the 80s; it's THE BEST version of BASIC from the 80s; some might say the best version of BASIC ever, in fact.


    It's also probably the most widespread version of BASIC ever to appear, in terms of the number of processors and systems it got ported to. There are multiple versions of it for the BBC series, including the Z80 and ARM second processors. There was an official release of it for the Cambridge Z88 portable machine. There were many releases of it for other machines, including the Sinclair Spectrum, Amstrad CPC range and Tatung Einstein. There's even a CP/M version of BBC BASIC for any 'business' machine with CP/M 2.2 or later. In terms of modern systems, there's a well-supported version of BBC BASIC for Windows, and options also available for the Mac (including a new one that I'm aware of a former Acorn developer working on at present). And I believe there's even some sort of development system (haven't looked into it yet) that lets you write Android apps in BBC BASIC, which sounds mega-useful if you're an Android user. So if you write a program in BBC BASIC and want to run it on another system, there's a very good chance that you'll be able to port it very easily. Regardless, with all that in mind, this is hardly just a relic from the 1980s: it's a superb modern language that people still use today, and that makes porting a piece of software from one system to another pretty easy. OK, maybe it's not generally useful for writing commercial cross-platform apps; but it's potentially very useful for hobbyists and amateurs to convert their projects from one machine to another, or adapt education material between systems or whatever. (And note the Android app scenario.) I'm sure there's still plenty of potential uses that let people achieve things without having to devote themselves to becoming professional developers.


    And this is also all said without considering the fact that BBC BASIC continued to be developed massively beyond BASIC IV. BASICs V and VI debuted on the ARM-based Acorn Archimedes and have continued to be developed ever since, right up to today. You may say: RISC OS is now only a niche OS with hardly any users and few if any meaningful applications left in the real world. And maybe there's some truth in that. But… it does still have potential, it's still being worked on and made relevant for modern hardware, and you can run it on modern hardware like the Raspberry Pi and other cheap single-board computers. So if anyone wanted to use RISC OS to create a lightning-fast Raspberry Pi-based project of some sort (the possibilities are endless…), they could very easily do so and write all the control software in BBC BASIC.


    Moreover, although BBC BASIC in its latest incarnation is restricted to RISC OS, there's absolutely no reason why it couldn't be liberated to run on some other ARM-based OS if anyone were minded to do the necessary conversion work. It's completely open source now. If someone wanted a stunningly good version of BASIC to run on some ARM-based Unix variant, why not just grab the ARM BBC BASIC sources and port it? Stranger things have happened.


    Obviously I'm smoking the pipe a bit here and getting into speculative territory… but my main point is that BBC BASIC is still alive and being actively developed (for the latest 64-bit ARM processors), and it's an outstandingly fantastic version of the language which must be unbelievably fast on current ARMs (even back in the late 1990s, its interpreted performance on a StrongARM processor could often outperform compiled C code, because the whole interpreter fit in the processor cache!). It's also open source, and thus has no practical restriction for its future use. All it needs is people to take more interest in it again.


    One has to wonder why BASIC ever fell out of fashion as an introduction to programming. If BBC BASIC had been more widely used around the world, and had the UK not misguidedly moved from Acorns to PCs in schools in the 90s, it would probably have remained dominant. I've seen several people in recent times lamenting how inferior Python is as an introduction to programming in schools (though I can't comment on that, as I've never looked into Python myself and know nothing about it). You ask: "What would make a good modern BASIC?" I'm not sure the question needs an answer, because we already have that in the latest ARM version of BBC BASIC V/VII. It's surely by far the best and most widely established version of BASIC around. The only problem with it, really, is that it hasn't been made available to other ARM-based OSs other than RISC OS. It's a great shame that it doesn't come as standard on all ARM-based systems, really.

    As to whether it's really a good language for modern computing… I think the obvious point to make about it is that it's a procedural language. Does a modern language need to be object-oriented? If so, then that's the glaring shortcoming. Maybe there's a way in which it could be extended with object-oriented concepts. I don't see why not; it's every bit as well structured as other high-level modern languages, and – what's more – it's also modular, with the ability to use libraries and overlays, and split your source across multiple files if you want to. So maybe a good modern BASIC would simply be BBC BASIC with OO extensions. I don't see any reasons why it couldn't be done… but I'm only a hobbyist, not a programmer of that level, so I really can't say. Surely, though, if ANY version of BASIC is worthy of further work to turn it into a new object-oriented version of the language, BBC BASIC is that version.

    Anyway, you'll take my point by now. BBC BASIC is the best-performing BASIC ever (as verified by many tests over the years), almost certainly the best designed, most extensive and well-structured implementation yet written, and also probably the most widespread in terms of the number of systems you can run it on. Get it on the MEGA65 and you gain access to all that world of software, including ease of conversion of programs from one system to another. Plus it's open source (at least in its still-in-development form). It's as far as I think any version of BASIC reasonably can be from being a simple outdated relic from the 1980s. BASIC in general may have lost a lot of its position of dominance in the computing world, which in some ways is regrettable – but if you do want to use BASIC (and there's still plenty of reason to), as far as I'm concerned this is the best version available by a wide margin.

  • Today three books arrived, which I had printed from the corresponding "remastered" PDF files from an online provider. This makes it easier for me to quickly look up something and also to enter my own notes with the pen. "Old fashion style" ... :)



    If you are interested in how ordering your own books, I have also created a post (in German): Click here

  • Just in case any further inspiration is needed… I've just discovered to my interest that Dean Belfield has just ported BBC BASIC to the ZX Spectrum Next!


    He started out from the Z80 version for CP/M – which, interestingly, is apparently already open source – and in just about a week has produced a fully working straight port of the language, with a number of additional commands to support the Spectrum Next's hardware. I've only just found out about this, so I haven't tried it out yet myself, but it looks quite an exciting development – even given that the Next already has its own new and very fully featured version of Sinclair BASIC that exploits its enhanced hardware.


    This is an entirely separate port from the existing version of BBC BASIC for the regular Sinclair Spectrum.


    Anyway, the link to the author's blog post about the project is here:
    Blog post about BBC BASIC for ZX Spectrum Next

    …and the Github repository containing the source code and releases is here:
    BBC BASIC for ZX Spectrum Next (Github)


    Dean Belfield announced the port on the Spectrum Next Facebook group with the following words:

    Quote

    Had a bit of a mad idea last week inspired by a conversation on Twitter. I'd already started porting R.T.Russell's excellent BBC Basic for Z80 to my homebrew breadboard computer, and wondered how easy it would be to port what I'd done already to the Next.

    It's very much a work-in-progress, yet works as a programming language as it stands now. The intention is to complete it with full Next hardware support.

    Source code and ".nex" files can be found on my GitHub.

    Enjoy!

    This rather backs up my assertions that interest in BBC BASIC is far from dead!

  • Gosh, look away for a few months and there's a billion messages to work through. Good to know there's so much interest!


    A couple of quick points:


    (a) R.T.Russell's Z80 port is open source --- I was the one who contacted him and asked him to relicense. He owns it, so he's capable of definitively doing this. http://cowlark.com/2019-06-14-bbcbasic-opensource It's pretty nice. If you're planning on doing a BBC Basic for the 6502, this may be the place to start. Even though anything which involves actual computation will need to be reworked for the 6502, the overall design will probably still be valid. It's completely compatible with Sophie Wilson's original, and even has a Z80 assembler in it.


    (b) If you can't get a definitive statement on the ownership of any piece of source code, it's cursed, and stay well clear. I've been trying to track down ownership of lots of old CP/M stuff to try and put together a proper open source CP/M port (see http://cowlark.com/cpmish). This is really frustrating because a lot of it predates the days when people understood licenses, and a lot of what source code remains is unusable because it either doesn't have a license on it (which means all permissions default to off; you can't do anything with it unless expressly given permission by the author) or else is invalid --- I see things like '(c) Public Domain' or 'Public Domain For Non-Commercial Purposes' depressingly often. Using any of this stuff is a massive legal liability. It doesn't matter that the actual copyright owners are dead or if nobody will care --- it won't pass legal oversight and any organisation with assets to lose won't touch it with a bargepole.


    Also, there is actually a extension ROM for BBC Basic II (to IV) for the BBC which provides some Basic V features. So, multiline IF, WHILE, CASE, more graphics commands, etc. But of course source has been lost, and it's probably not relevant anyway due to being an extension ROM. https://stardot.org.uk/forums/viewtopic.php?t=13283


    Also also, if you're looking for an emulator, there's a superb cycle-accurate Javascript one at https://bbc.godbolt.org/. Here's a video of a chiptune tracker I wrote for the BBC in it...

  • I would like to give a short sign of life here after a long time! :)


    I am still interested in a conversion of the BBC BASIC for the MEGA65 and also busy for some time with it. As it is so often, it does not run as straight as one has imagined it at first. From the - as so often - not too abundant free time were also "wrong ways" to cope with.


    My first attempt was to port the BBC BASIC IV, whose source code is available, 1:1 to the MEGA65. A wish, which showed up however still short time and some discussions with a few "BBC cracks" as "small nightmare". At least 20-25% of the source code would have to be changed, so that it would be theoretically executable at all. And then not a single bit is adapted to the hardware of the MEGA65. So a rather pointless plan. :/


    That was also mainly the reason, why my second plan was to port then the BBC BASIC 2 (6502), whose source code is also available. Also for this I had interesting exchange with people from the "BBC environment". I also started here first attempts of the conversion and was confronted then however also here with the fact that the hardware architecture of the C65/MEGA65 differs so quite from that of the BBC models. Just because the 6052 is "the same" doesn't mean anything for the rest of the architecture. The C65 is already a "challenge" for programming. More than once I have cursed this architecture (especially the memory handling). ;(


    But the C65/MEGA65 fits very well with the BASIC 10 from Commodore. The BASIC 10 was written on the hardware body of the C65 and fits therefore like the proverbial lid on the pot. The BBC BASIC 2 (6502) does not fit on it at all. Too much is simply different with the MEGA65 than with the BBC computer. My second plan is to be regarded therefore also rather as "failed". :(


    After a certain "frustration phase" concerning the conversion, however, the ambition seized me again and I thought to myself: "You know something about the C65 ROM and the BBC BASIC 2 ROM you have read through so to some extent with the appropriate books and also practically played around with it at the Acorn Electron. Why not try to combine this knowledge and write a BASIC for the MEGA65, which is as far as possible compatible to the BBC BASIC, but adapted to the peculiarities of the MEGA65?" :idea:


    I then used to sit down in my spare minutes and gradually unravel the BBC BASIC 2 ROM in such a way that I kept the routines that run without modification on the MEGA65 more or less as they were, and programmed those that had to be different for the MEGA65 accordingly. Always with the thought in mind to deviate from the BBC BASIC 2 ROM routines only as far as necessary. And so the days, weeks, months went by ... as said, the spare time is always "too little" anyway. :loet


    In the meantime, the interpreter routines are running reasonably well, so that I can now occupy myself more with the implementation of the individual BASIC commands. I baptized the BASIC on the name "B-BASIC". Combined somehow the "B" with the BBC BASIC, to which I want to keep maximum possible compatibility with the "B" for a second BASIC for the MEGA65.


    Most of the B-BASIC is so far "invisibly" hidden under the hood. So far, you can see rather little on the screen. The CLS command to clear the screen works and with PRINT I can print text.



    This was by far the most time consuming "Hello World!" I have programmed so far. :D


    But despite all the frustration on the way so far, it was also fun. And I learned a lot in the process. 8)


    Until the ROM with the B-BASIC can be used even halfway for programming, it will surely take more than a few weeks. In this respect I would commit myself with a statement to a release date at most to a concrete decade. :whistling:


    I just wanted to let you know that I'm still interested in it and that I'm working on it within the limits of time. Even if the thread here has been paused for a while now, the idea is still not "dead".

  • Exactly what Ubik wrote.

    That was a nice surprise, thanks for the update !

  • After a certain "frustration phase" concerning the conversion, however, the ambition seized me again and I thought to myself: "You know something about the C65 ROM and the BBC BASIC 2 ROM you have read through so to some extent with the appropriate books and also practically played around with it at the Acorn Electron. Why not try to combine this knowledge and write a BASIC for the MEGA65, which is as far as possible compatible to the BBC BASIC, but adapted to the peculiarities of the MEGA65?"

    [...]

    In the meantime, the interpreter routines are running reasonably well, so that I can now occupy myself more with the implementation of the individual BASIC commands. I baptized the BASIC on the name "B-BASIC". Combined somehow the "B" with the BBC BASIC, to which I want to keep maximum possible compatibility with the "B" for a second BASIC for the MEGA65.

    Hi Snoopy, great that you are going forward with this mammoth project.

    I have a question out of interest (keep in mind that I know nothing about BBC Basic or the Mega 65):


    As far as I understand there are BBC Basic implementations for many systems. Now you say that you can't be compatible with BBC Basic (but will try to be compatible as much as you can). Is there something fundamentally different between the Mega65 and other computers that have BBC Basic implementations, that make BBC Basic implementations possible on those but not on the Mega65? Or would you consider most of those implementations as not real BBC Basics, just "compatible as much as possible", similar to your project?

    Is there even a specification of BBC Basic? Or would you only accept a Basic that runs any program that was written for Acorn computers as BBC Basic?

  • Hi Snoopy, great that you are going forward with this mammoth project.

    I have a question out of interest (keep in mind that I know nothing about BBC Basic or the Mega 65):


    As far as I understand there are BBC Basic implementations for many systems. Now you say that you can't be compatible with BBC Basic (but will try to be compatible as much as you can). Is there something fundamentally different between the Mega65 and other computers that have BBC Basic implementations, that make BBC Basic implementations possible on those but not on the Mega65? Or would you consider most of those implementations as not real BBC Basics, just "compatible as much as possible", similar to your project?

    Is there even a specification of BBC Basic? Or would you only accept a Basic that runs any program that was written for Acorn computers as BBC Basic?

    Hello Freudentaumel, I probably expressed myself a little unhappily. I try to formulate it a little differently:


    BBC BASIC was actually programmed to be very portable back around 1980 by Wilson. Basically the BBC BASIC 2 runs on almost every 6502, if you provide a few - clearly defined - OS routines for input and output. But on a system with a maximum of 64 KB RAM!


    For the C64 there is for example such a conversion of the BBC BASIC 2, which also runs in the C64 mode of the MEGA65:



    There are also many other implementations of the BBC BASIC (also on Z80 processors etc.), which I would call >99% BBC BASIC compatible. To my knowledge there is no "official" and generally valid language specification of the BBC BASIC.


    What I meant in my post and what is important to me, is to make an implementation as close as possible to the program code of the original BBC BASIC. I would like to write not a BASIC, which behaves "only" in such a way like the BBC BASIC (which is already compatible), but a BASIC, which uses - so far possible - also the original program routines, thus actually "is" like the BBC BASIC 2.


    But with the restriction that I want to use the extensions of the MEGA65 (at least theoretically). And that means that I want to "teach" the BBC BASIC to run on a computer which has a lot more as 64 KB RAM and also has a lot more to offer than the BBC computer on which it originally ran.


    And especially I find the memory handling of the C65/MEGA65 anything but "easy to maintain". This has also annoyed and frustrated me so much that I have already thought about a voluntary root canal treatment without anesthesia at the dentist - just for relaxing! ;(


    The entire concept of the C65/MEGA65 harmonizes relatively well with the BASIC 10 (or with the more advanced BASIC 65 in the case of MEGA65). After all, it was especially written for this machine. But unfortunately not so much with a "6502 - BBC BASIC" (out of the box). For this, the hardware is then nevertheless too different to the BBC computers.


    And this is where my ambition starts, to achieve a good compromise between "maximum original code" and "reasonably well adapted to the MEGA65".


    And if all fails, I know where my dentist is ... :D

  • And especially I find the memory handling of the C65/MEGA65 anything but "easy to maintain". This has also annoyed and frustrated me so much that I have already thought about a voluntary root canal treatment without anesthesia at the dentist - just for relaxing! ;(

    LOL! :biglach:


    But seriously, good luck… it seems that you're making progress, at least!