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

last post from FeralChild at the

BBC BASIC for the MEGA65?

  • In terms of workload, it makes a big difference whether you try to get the existing 6502 BBC BASIC to work on the MEGA65 or whether you implement a BASIC V from scratch. In addition to the open sources for BASIC V for the Archimedes, there are also some compatible versions that are also open source (e.g. Matrix Brandy).


    But they all have the common "problem" that they are not available in the 6502 code, but for the ARM2 ... or in C.


    In order to implement this on the MEGA65, you probably need a similar or even more time than creating your own BASIC from scratch.


    And then the question arises whether a native "BBC compatible" BASIC on the MEGA65 is really worth the effort of building a new BASIC from scratch? I would speak of years of work with, if this can only be done in free time!


    There is a BASIC 10 for the MEGA65, which is also continuously improved with the new ROM. Even if it will of course never be a BBC BASIC due to the concept.


    So it takes very good reasons for someone to start porting the BASIC V to the MEGA65. This is really a lot more effort compared to porting the BBC BASIC (6502).

  • So it takes very good reasons for someone to start porting the BASIC V to the MEGA65. This is really a lot more effort compared to porting the BBC BASIC (6502).

    Yes… I was really proposing specifically the idea of:

    • First porting BASIC IV from the available 6502 sources;
    • Then, using the ARM sources to add in at least some of the useful new features of BASIC V.

    I know it'd still be a lot more work, but it might potentially be a lot less work than starting from scratch. Besides, you might not necessarily have to deal with ALL the difference; maybe just the most useful additions, like CASE … OF … WHEN … OTHERWISE … ENDCASE structures and WHILE … ENDWHILE loops. And maybe the extra binary operators etc.


    Obviously it's easy for me to sit here and propose that, without knowing the technical details. As I say, it was just an idea that might allow the project to go ahead, and an enquiry as to whether it would be even vaguely feasible. I was specifically proposing to enhance a working BASIC IV conversion with new BASIC V features on the basis that it would be much less work than converting BASIC V from scratch. But I suppose even that may not be meaningfully less work.


    As for creating a new version of BASIC from scratch… it still seems to me that that would be on another level of increased effort and reduced desirability. Aside from having to define a new version of the language yourself, there's a whole new dimension of testing involved, and ensuring every conceivable aspect works as it should – all without the benefit of any programs that have already been written in the new version of BASIC.

    As an aside, on the Spectrum Next, the new NextBASIC is a really MASSIVELY enhanced version of Sinclair BASIC: it's backwards compatible, but the new version has an enormous number of new language features and new commands to take advantage of the new facilities of the machine. It's a mammoth accomplishment by a single very talented programmer, working over several years. And he's done a terrific job, and he's an exceptionally reliable coder who produces good, solid work. Even so, there's been an endless stream of minor bugs and small oversights to contend with over the life of the project. NextBASIC continues to change and occasionally becomes slightly incompatible with existing software; it's still a bit of a moving target, even now. And that's with a relatively huge community of active Spectrum Next developers behind the project and a user base that's being strongly encouraged to write new programs in NextBASIC. The MEGA65 doesn't appear to have an equivalent body of enthusiastic, hobby programmer users behind it, ready to really push a new version of BASIC and find its bugs.


    Any 'new' (or greatly enhanced) version of BASIC is likely to have these teething troubles, and the fewer people there are to test it and push it, the more serious they will be, in a sense. That's a whole aspect you don't have if you're porting BBC BASIC. Obviously it still needs careful testing, but the language definition is long established and its behaviours known, and there are much greater testing opportunities, including the ability to see how it behaves on other platforms.

  • Then why not to finish and extend the current Open ROMs BASIC instead? We don’t have to stick to 2 characters long variable names in MEGA65 native mode, we can have a completely separate variable model there, maybe even more types of variables.


    I believe few active developers could come with a reasonable BASIC in a reasonable time. BTW. When I’ve started my work, I didn’t even remember how to compare two values in 6502 assembly :)

  • Then why not to finish and extend the current Open ROMs BASIC instead? We don’t have to stick to 2 characters long variable names in MEGA65 native mode, we can have a completely separate variable model there, maybe even more types of variables.

    If we also could have

    • named multi-line procedures,
    • named multi line functions and
    • local variables

    in there, I might really, *really* be tempted to bite the bullet and reacquaint myself with 6502 assembly... :)

  • Named functions / procedures shouldn’t be hard to implement. As for local variables, you would need a completely new variable subsystem - which would be a good idea nevertheless, as the 128KB of RAM above 0x40000 is currently unused when running BASIC.


    Just keep in mind, that floating point routines are not finished as of yet, this is probably the hardest part still left to be implemented.

  • Then why not to finish and extend the current Open ROMs BASIC instead?

    I'm by no means saying that this shouldn't be done. Any version of BASIC that comes with the machine should be complete in itself, and hopefully at least adequate for use.


    However, the appeal of BBC BASIC would be, in particular, its quality (it's really the best available implementation of BASIC by a wide margin), its widespread support on multiple platforms, and its inline assembler.

    I believe few active developers could come with a reasonable BASIC in a reasonable time. BTW. When I’ve started my work, I didn’t even remember how to compare two values in 6502 assembly :)

    I think that's right. See my other recent comment about NextBASIC on the Spectrum Next, which is a much-enhanced version of Sinclair BASIC for the Spectrum Next, A highly capable sole developer has been working on this to enhance it as a language and to add features to support the Next's capabilities. As a piece of work in itself it's pretty remarkable: he's done a great job. However, (a) it's taken him upwards of four years, and it still isn't finished yet, and (b) there have been lots of bugs and subtle oversights to discover and fix along the way – all with the support of a much bigger user community than appears to exist on the MEGA65.


    In theory, extending the existing BASIC to make it even competent compared with BBC BASIC would be a big job, and even if it were completed in reasonable time, you'd end up with something that required a great deal of use before the bugs were even found, let alone fixed. In the end, you'd probably end up with something that takes at least as much effort to implement as would porting BBC BASIC, but it'd be almost certainly be inferior (simply because BBC BASIC is so good and so mature), plus it would be entirely new, with no user software support for it and doubtless countless bugs to discover and iron out.


    This is why I find this whole situation so frustrating. I can see nothing that really stops us from doing what we want to do, except on a purely theoretical (but definitely not practical) level… and the alternatives would all produce a markedly inferior result for considerably more effort.


    Anyway. I've said what I had to say, so I'll shut up now! But I'd love to find a way forward with BBC BASIC. If there's anything further I can do to help with this, please let me know.

  • It will probably take a few years to finish the MEGA65 FPGA core too - there are still a lot of incompatibilities, features planned to implement, and so on. And with BBC BASIC this also won’t be that simple to just port it - the graphics/audio will have to be redesigned to support the MEGA65 hardware, the core will have to be adapted to support extended memory, and so on.

  • If there's anything further I can do to help with this, please let me know.

    I have another question, if you don't mind. :whistling:


    I have read these two books about the BBC BASIC ROM:


    - "BASIC ROM User Guide" (1984) from Mark Plumbley

    - "The Advanced BASIC ROM User Guide" (1984) from Colin Pharo


    They are great and full of valuable infos, but sadly "only" for BASIC 1 and BASIC 2. Most of the infos are of course helpful also for the BASIC 4.32, but I'm also interested in such a book mainly about the BASIC 4.32 ROM.


    Have you ever heard or read something about such a book by chance? Does such a book exist for BASIC 4.32 ROM? Unfortunately, I haven't had any success with my search so far. :(

  • Have you ever heard or read something about such a book by chance? Does such a book exist for BASIC 4.32 ROM? Unfortunately, I haven't had any success with my search so far. :(

    Sorry; I'm afraid I'm not aware of such a book for BASIC IV specifically.


    These ROM-analysis books were probably an early phenomenon. Once the excitement and newness of BBC BASIC on the BBC Micro had worn off, I don't suppose it would have been financially viable to create new books of this style for such minor new variants as BASIC IV. I'm not even aware of this style of book for BASIC V on the Archimedes, I'm afraid; only a few more simple tutorial-style books in how to program with the language.


    If you need details about the syntax or behaviour of later commands, you might be able to find something useful in Acorn's BASIC VI Reference Manual. Obviously there'll be a lot there that isn't relevant, but BBC BASIC continued to be backwards compatible with earlier versions, so it might fill in an occasional gap. I found a PDF here: BBC BASIC VI Reference Manual.


    Otherwise, the best suggestion I can offer is simply that you ask questions on the StarDot.org.uk forums. There are many users there with excellent technical knowledge, who would be able to answer most questions, I think. E.g. Richard Russell has been known to answer questions there about BBC BASIC (and he's certainly one of the main experts), but there are lots of other really well informed people there.

  • Apologies – it seems that the link to the BASIC VI Reference Manual in my last post is broken, and I can't find a way to edit it. So here (I hope!) is the correct link: https://www.4corn.co.uk/archiv…eference%20Manual-opt.pdf


    The PDF is very useful (as everslick notes, it has a good appendix on BBC BASIC history). It's just a shame that it's not a better quality PDF. The scan is overexposed, so all the pale grey page decorations have vanished completely and the text is relatively hard to read. Also, my own physical copy of this exact same 1992 edition also includes a four-page addendum from 1995, which isn't present in the PDF.


    Anyway, further to this PDF, you may like to know that the book has continued to be developed and is still available to buy as a hard copy, with new information that brings it up to date for the version included with RISC OS 5.2x. It's available to purchase from RISC OS Open Ltd here:

    https://www.riscosopen.org/content/sales/bbc-basic-reference


    Unfortunately there's no PDF version that I can find (free or otherwise). And BBC BASIC continues to be developed; according to the RISC OS roadmap, BBC BASIC is due to be extended to include support for 64-bit integers and dynamic memory allocation, among other new features. So the book will probably be updated again in due course…


    Anyway, if you do want definitive printed information, this book is going to be the best source available.

  • Richard Hallas : I'm always very careful in legal software stuff, so I ask you once again. It's just for getting sure. I hope that's okay for you. :whistling:

    So yes, it's true to say that BBC BASIC is not free of rights. BUT the people who own those rights (and they are known even without sight of the piece of paper that says so – there's no-one else to be accountable to!) have given us explicit permission to do what we want.

    You had with these people mail contact and you have informed them that there are considerations to port the BBC BASIC (6502) on the MEGA65? And they all did not contradict that?


    So at least in the hobby area here would not be feared of legal issues in your opinion?


    I make some progress with porting it, but sadly only very slow. Besides lack of enough sparetime - here, less the BBC BASIC (6502) is the problem, but rather the "really crazy" storage management of the C65/MEGA65. I can only explain that so that the developers have probably considered how to use this maximum awkward. :D

  • You had with these people mail contact and you have informed them that there are considerations to port the BBC BASIC (6502) on the MEGA65? And they all did not contradict that?


    So at least in the hobby area here would not be feared of legal issues in your opinion?

    Yes, I absolutely believe that the people in question are fully aware of the desire to port BBC BASIC IV to the MEGA65 and not have any kind of problem with it.


    I didn't quote Sophie Wilson's reply in full before partly because it contains a lot of detail that isn't really relevant, and it also doesn't actually say anything terribly useful in itself. But, to put your mind at rest, I'll quote it in full now.


    I had approached her, explaining what the MEGA65 is (and giving a link to the mega65.org site for further information) and that an improved version of BASIC is needed for it. I stressed both the desire to port BBC BASIC to it and the fact that the whole project is being created as open source. Here's the relevant section of my email:

    Quote from my email to Sophie Wilson
    One of the possibilities that's been raised is the idea of porting BBC BASIC to the [MEGA65]. The problem is legal rather than technical. The MEGA65 is being created as an open source project, and the team behind it is very keen that all of its components can be released freely without legal entanglements. Unfortunately, given what happened to Acorn in the end, no-one seems to know definitively who owns BBC BASIC (or its 8-bit 6502 incarnations in particular), and without clarity on this matter, the MEGA65 people don't feel they can proceed further. Their alternative would be to write a new version of BASIC from scratch; but this would obviously be both a mammoth undertaking and highly undesirable in comparison with adopting such a well established and highly regarded existing version as BBC BASIC.

    I soon received the following reply. NB It seems that Sophie slightly misunderstood my point about writing a new BASIC for the MEGA65. When I referred to "a mammoth undertaking", I meant that it would be a huge job to design a completely new version of BASIC from scratch, not least because of all the potential need for testing and bug-fixing in a newly specified language. Sophie, in her reply, seems to have assumed I mean that rewriting BBC BASIC from scratch for the new machine would be a mammoth undertaking, and contradicts me! But that minor detail is unimportant, of course. What's clear is that (a) I have explained exactly what the MEGA65 team's interest in BBC BASIC is, and (b) not only does she not raise any objections, but she offers a set of BBC BASIC benchmarks and what can be interpreted as encouragement to write a new port of the language for the machine.


    Here's Sophie's reply in full (apologies for the poor formatting of the benchmarks; that's how they arrived via email):

    NB Two small points in relation to this:


    1. Sophie refers to writing BBC BASIC II from scratch. I didn't actually refer to BASIC II; I simply referred to the 6502 version of BBC BASIC, and as we know, it's actually BASIC IV whose source has been released online. I don't think this is significant; Sophie is probably simply thinking of the version of BASIC on the BBC Micro. BASIC IV is only slightly advanced over BASIC II, and Sophie is certainly aware of its source code release on Github.


    2. Much more recently, once I'd got as far as I could with my investigations, I emailed Sophie again to bring her up to date, simply as a courtesy. As well as summarising my findings, with regard to the MEGA65 I said that without an explicit open source licence from the rights holder, the team unfortunately felt unable to proceed with the plan as envisaged, i.e. to build BBC BASIC into the MEGA65 as a core component – though it may well still prove possible to release a port as a free extra third party component for optional install. I also said that there was no need for her to respond to my email unless she had anything further to add (such as, for example, any further information that may have come to light about the copyright). I have not heard back from her in response to this email, which can only mean that (a) she has no objections to its contents and (b) she has nothing further to add with regard to the copyright situation.


    Anyway, the bottom line that I believe I was very clear in explaining what was wanted and why, and not only did Sophie not object, but she offered what information she could, together with benchmarks and what might be interpreted as encouragement to simply port the language to the new machine from scratch.


    The other party that might conceivably own 6502 BBC BASIC is RISC OS Developments Ltd; and, as I say, I've known Andrew Rawnsley, the person who now runs that company, for well over 25 years (we've worked for each other and met in person on many occasions). I think I can say with absolute certainty that he wouldn't cause any trouble for the MEGA65 project – and he doesn't have a business interest in the 6502 version of BBC BASIC in any case. Indeed, he has made it quite clear that he'd be willing to give us a licence to the ARM version of BBC BASIC if that were helpful. Again, quoting relevant parts from his fairly extensive email…

    So, there you have it. I hope this is enough to put your mind at rest. As Andrew says, there's no-one to object to your use of BBC BASIC given that Sophie appears comfortable with it, and if you need a licence to BBC BASIC V you can have one. The only area of unclarity is the matter of wanting a licence to, specifically, a version of BBC BASIC earlier than V.


    Not being a legal person, I don't know why it can't be possible to obtain a licence to BBC BASIC generally (i.e. the current version, which is both version V and version VI) and apply it to a new MEGA65 implementation that just happens to implement an incomplete version of the language that matches the BASIC IV feature spec. I can't really see any great problem with that, especially since everyone with the slightest interest in the matter has given their blessing. But then, I have no legal expertise.


    Anyway, I hope that helps.

  • Many, many thanks for your again very detailed answer and all your efforts with it and your answering of my probably annoying questions. You are a very great help in this issue! :thumbup:

    It's been a pleasure. My only regret is that it hasn't been possible to get a definitive statement about the ownership of BBC BASIC. It's frustrating to be so close and yet unable to proceed as desired!

  • Here is a short post to the current status:


    I have been in exchange with Dave, who has provided the source code of the BBC BASIC 4r32, and there are still some major problems to handle.


    As e.g. mentioned here, there are some small but potentially "crucial" differences between the 65C02 processor for which the source code is intended and the 65CE02 processor in the C65/MEGA65.


    In addition, the C65/MEGA65 still has the "chaotic" memory management, which also makes the port more difficult.


    Summary: The C65/MEGA65 seems to be pretty much the inappropriate machine to run the BBC BASIC 4r32 as a "simple copy" of the sourcecode. That probably means a few special rounds to dig me through, why and what are causing the problems. So, I'm working on it, but please do not expect a result next week. ;)