Hello, Guest the thread was called3.8k times and contains 72 replays

last post from sundance at the

BASIC 65.EX - A BASIC with procedures and local variables

  • The way BASIC 65 has become in the meantime, I find it really fast and comfortable to use for the MEGA65. :thumbup:

    However, with all innovations and extensions of the BASIC I still missed possibilities to be able to proceed with the programming a little more structured than with the notorious "Commodore BASIC spaghetti code".

    From this the idea matured, I try to build this into the ROM in some way. Because I first tried if it will works at all and how and why, I made a fork from ROM version 920300 (from January 22nd 2022) and from here on I started an independent development of BASIC 65, also independent from the official MEGA65-ROM.

    So everything from ROM 920300 on, is no longer from the MEGA team, but is grown on my crap. So nothing with "an official MEGA65 release" or so. No, it's only "Snoopy made". :)

    In the ROM is unfortunately hardly more memory space, in order to accommodate something. So it is not so easy to squeeze a handling for procedures onto this "filled BASIC". :syshack:

    I tried it the last few days and with a few restrictions it works fairly good now.

    And to make it visible at the start of the extended ROM (and because I like it), I made the font (FONT B) and the design based on the Commodore 8000 series with their BASIC 4.0.

    If you prefer the blue-white design with the standard character set of the MEGA65, you just have to press the F6 key (or F8, if you want it to be "green" again).

    As a name to distinguish it from the BASIC 65, I couldn't think of anything better than "BASIC 65.EX", where the EX stands for "Extras".

    And these extras all refer to the new commands that allow programming with procedures and local ("fast", numeric) variables.

    That would be in alphabetical order DEFPROC, ENDPROC, LOCAL, RLEVEL and RPROC.

    A small PDF describing the new commands is available here


    and in German here


    For legal reasons I can't just offer the complete ROM for download, because it is based on the original C65 ROM from Commodore.

    On my page


    you can easily get a patched ROM and download it from there. For this you need an original C65 ROM in version 911001. Please make sure that the file has either the extension ".bin" or ".rom" and upload it to the patch page.

    If you have uploaded the 911001 ROM (Attention: It is already checked thoroughly if it is the right ROM!), then the file will be patched and you will be offered the final product for download. Then rename the file (currently: "220211.bin") to "MEGA65.ROM" and load this ROM into the MEGA65, Nexys board or xmega65 emulator.

    You can download a D81 image with short example programs here:


    I will surely add some examples and correct some errors.

    Here is an example (is also on the disk) "Recursive Tree", which shows graphically the possibilities of recursive use of the procedures.

    If you want, you can also just watch the short clip:


    If you want to try it out, have fun! :)

  • EDIT: Didn't realize at first that this was not in the German part of the forum, sorry for that.

    Short summary: "Thank you Snoopy" & a question about how it works.

    Hi Snoopy,

    das ist fantastisch. Vor allem lokale Variable habe ich mir schon oft gewünscht, das vereinfacht die Erstellung kompexer Programme enorm und ermöglicht endlich Rekursion, ohne dass man sich mit Hilfe von Arrays einen eigenen Stack bauen muss. "Prozeduren" hat man ja im Prinzip schon mit GOSUB/RETURN gehabt, nur halt nicht so komfortabel.

    Eine Frage: Wo liegt der Stack für die Prozeduraufrufe und die lokalen Variable? Der Standard-Stack der CPU ist für sowas ja zu klein. Ist dieser Stack limitiert (abgesehen von der maximalen Aufruftiefe von 255), oder wächst er dynamisch mit?

    Dann habe ich eine Sache in Deiner Beschreibung von "proc" nicht verstanden:

    "Argument ist entweder ein numerischer Ausdruck oder eine reelle Variable mit nur einem Buchstaben (A bis Z) als Variablenname (eine sogenannte schnelle Variable)."

    Der Ausdruck beim Prozeduraufruf wird doch ohnehin ausgewertet und als numerischer Wert an die in der Prozedur deklarierte lokale Argument-Variable übergeben, oder nicht? Welchen Unterschied macht es dann, ob man eine Vatiable mit nur einem Buchstabe übergibt? Eigentlich sind doch auch Variable, egal mit wie vielen Buchstaben, numerische Ausdrücke (ist halt ein Sonderfall des numerischen Ausrucks, genau so wie ein numerisches Literal).

  • Auf die Schnelle nur mal das klarstellen ... (bin heute unterwegs) ...

    Dann habe ich eine Sache in Deiner Beschreibung von "proc" nicht verstanden:

    "Argument ist entweder ein numerischer Ausdruck oder eine reelle Variable mit nur einem Buchstaben (A bis Z) als Variablenname (eine sogenannte schnelle Variable)."

    Das verstehe ich auch nicht. :D

    Das ist noch ein Fehler und Überbleibsel von "Copy & Paste", das mir trotz zweimaligem Lesen nicht aufgefallen ist.

    Da gehört viel eher hin, dass es ein numerischer Ausdruck sein muss, da Strings leider (noch) nicht als Parameter gehen. Da habe ich noch den Ehrgeiz, das umzusetzen, aber das wird im wahresten Sinne des Wortes verdammt eng (im ROM). ;)

    Edit: Danke für den Hinweis, ich habe gerade die beiden PDFs korrigiert, um "Verwirrungen" zu ersparen. :)

  • Hi Snoopy

    Das ist eine großartig Sache. Das erinnert mich an meine Q-Basic Zeiten, da gabe es auch solche tolle Befehle wie SUB Name [(Parameter)] - End SUB /

    FUNCTION Name [(Argumente)] - END FUNCTION. Sowie SHARED Name (Variablen global deklarieren), STATIC Name (Lokale Variablen als statisch deklarieren)

  • I think it is nonsense and not good. The rom should only be made by the mega 65 team. If every amateur tinkers with it, it will end up with nothing pro. This should only make the professionals of the team. Just my 2 cents!


    I have some good news for you right away: The use of the ROM is absolutely voluntary. You can ignore it completely or not even take notice of it. As written, it is not even an official ROM, I just "play around for fun". So you can relax and look forward to the MEGA65 in a completely professional way. ;)

  • So why are you releasing the ROM?

    So why are you here?

    I ordered a Mega 65 and am now waiting for it to arrive. This is a super computer with high quality standards that the team has created. And this fits so a self-made rom of a newbie now not at all. This also casts a bad light on the quality of the mega 65. There should only be the official rom from the team, which has really high quality.

  • ... otherwise you would be on the team too.

    Are you someone from the team? Or do we know each other and I've stepped on your toes? I don't understand what you want. ?(

    If you don't like the ROM, then just don't use it and that's it. :nixwiss:

    The problem is, if especially in the beginning too many not so good things are published, then it casts a bad image on the mega 65. As a non team member write a few basic programs or something little stuff like that, but the rom should be the work of the team. That here is also delivered a standard that the mega 65 has earned.

  • IMHO, a problem would arise if no things were developed and released at all. Especially in the beginning. Whether things are bad or good depends on personal preferences. I appreciate it very much when people spend their precious time to improve existing things and enable further development or create new things. That's what makes the home computer hobby really interesting. The earlier the better seems to make sense in this case. There are already some preliminary and experimental ROMs, e.g. at https://files.mega65.org/html/main.php - and other software, too, of course. Some good some not so good. But it's better than not having anything from third parties at all.

  • So why are you releasing the ROM? Obviously you are not good enough at programming, otherwise you would be on the team too. I will definitely only use the official ROM. Then I know what is good.

    Please be respectful of other's contributions. Also, unless you have tried to modify a Commodore ROM to do different things, I would recommend reflection before suggesting that this is an easy task. Also, as a community-based project, the core team is very small, and is focussed on getting the actual machine out there. Just because someone is not in that group says nothing about their skills (or lack thereof).


  • Always stick to the motto .... have fun. Find your limits and learn to grow beyond them. try new. That's the only way we can move forward.

    And at the end of the day you can always come back home to our team's stable rom/core (if you want) ;)

    have fun, it's your time. make something out of it.

    And thanks to Snoopy . The colour combination of green and black is awesome...so stylish ;)

  • Always stick to the motto .... have fun.

    You can have fun programming smaller things that you can oversee. But things like a rom should only be done by professionals from the team. That's how I see it: The rom is the heart of the mega 65 and it has to work 100%. Nobody wants to pay 900 US$ for the mega and then use crippled roms that beginners have assembled 'for fun'. I think that hurts the project, because you might think the meg 65 is just a tinkering thing for almost 1000 US$.