Commodore BASIC as a Scripting Language for UNIX and Windows – now Open Source

Update: The project has moved to Sourceforge.

Attention Slashdot crowd, here is a little background:

This application is a recompiled version of the original Commodore 64 binary – it is not a reimplementation, so while it runs at pretty much the maximum possible speed, it is still 100% compatible. The huge C file in the archive has been produced by feeding the original 6502 code into my static recompiler and optimizing it with LLVM. The original operating system interface (character I/O, LOAD, SAVE etc.) has been reimplemented in native C, so Commodore BASIC interfaces nicely with OS X/Windows/Unix – you can use pipe I/O, and you can pass the filename of a BASIC program on the command line.

Yes, you could also just run a standard C64 emulator, but it wouldn’t be nearly this speed, and everything would run inside a sandbox; and there would be no way to interface this to your OS.

A while back, I released Apple I BASIC and Commodore BASIC as a scripting language for Mac OS X 10.5 on Intel. It did not work on any other OS or on a different CPU type.

Today, we are releasing Commodore BASIC as a Scripting Language – it works on Linux, Windows, Mac OS X 10.4/10.5 (Intel and PowerPC), and you even get the source, so you can adapt it to other operating systems and CPUs.

Download it here:

The archive comes with binaries for Mac OS X and Windows. The source compiles on Linux, Windows and Mac OS X. All code is BSD-licensed. Main work by Michael Steil, speed optimizations, Linux and Windows fixes by James Abbatiello.

The core of the BASIC interpreter is in the file cbmbasic.c, which is platform, endianness and bitness independent. For all I/O, it calls out into runtime.c, do it should be able to adapt this project for any OS by just changing runtime.c.

All function calls that the core interpreter can’t handle end up in kernal_dispatch() in runtime.c, where a switch statement dispatches these to C functions. For Commodore BASIC, runtime.c has to support several Commodore KERNAL library routines. Some of them are very important (CHRIN, CHROUT) and some are only used for certain BASIC statements (LOAD, SAVE, OPEN, SETTIM). runtime.c does not implement all functions yet.

Feel free to port cbmbasic to your system and architecture of choice, and extend runtime.c to support more functions. If you like, send your changes back to us (mist64<at>mac<dot>com, abbeyj<at>gmail<dot>com), so we can update the main project and give your changes to everyone. We’re also interested how fast you can get it with different compilers and settings.

See my old article for more info as well as some insights on how it is done.

See also:

pixelstats trackingpixel

126 Responses to “Commodore BASIC as a Scripting Language for UNIX and Windows – now Open Source”

  1. What i don’t realize is actually how you’re no longer actually much more
    well-favored than you may be right now. You are so intelligent.
    You know therefore significantly in relation to this subject, produced me personally consider it from
    so many various angles. Its like women and men don’t seem to be fascinated except it is one thing to do with Girl gaga! Your personal stuffs excellent. Always take care of it up!

  2. It’s the best time to make some plans for the long run and it’s time to
    be happy. I have learn this submit and if I could I wish to counsel you some fascinating things or suggestions.
    Maybe you can write subsequent articles referring to this article.

    I desire to learn even more issues approximately it!

  3. Greate post. Keep posting such kind of information on your site.

    Im really impressed by your site.
    Hello there, You have done a great job. I’ll certainly digg it and in my view suggest to my friends. I am confident they’ll be
    benefited from this web site.

  4. Couldn’t have put it much better myself

  5. Way coοl! Some νery valid pοіnts!
    І appreciate you ρenning this write-up and also the rest οf the
    website is very gooԁ.

  6. No longer with the paper, who also witnessed the lights over dexter missouri parks and recreation.
    8th I was driving from Louisville, Ky. He’s mostly out Screaming at the top of the story to receive email updates when a new article is published. They came, they poked me, they put the catheter in me and I was ready to go.

  7. Stephaine says:

    Hey There,I think this is read is very interesting and among the better
    things I’ve read today. But I should say that your blogging style is perfect, the articles are really nice. Wonderful Job… Cheers!

  8. website says:

    Online retailers offer year long reductions since it
    is easier than to run a shop in the marketplace to run a personal on-line shop that to a shop which offers you anything
    under the sun that can be bought. Also these online retailers like Overstock.
    com give special discount including overstock coupon signal for promotional and advertising function.

    Though a traditional Overstock coupon is hard to find but as soon as
    you obtain it be sure to be surprised.

    Overstock Coupon is of very great use, as it has increased the novelty of on
    the web shopping by often among your head of people.

    It has also several purchasing things which increase its
    need. Various kinds voucher limitations are there particularly Money Saver Coupon Code,
    Free Ship Coupon Code and several more; all are used for
    different purposes.
    Now these codes are being sold-out to complete business.
    This is also comfortable for the clients because
    they are now free from the risk of advertising with a huge amount
    of income. Also some recharge sites and internet sites have started the Overstock Coupon system.

    They provide systems like on a recharge of Rs.10 just
    one can get two decades concession on searching for Rs 999 and above.
    By utilizing these systems, also the web sites are extending their sales.
    Several shopping web sites have mounted a perimeter such that
    shopping beyond that certain amount would bear no shipping cost.

    Online coupons are actually available to even reduce the delivery charge.

  9. [...] who did the reverse engineering of the 6502 CPU), has done just that.  He?s ported the original C64 BASIC as a scripting language for the Windows and UNIX platform.  Just imagine using your old BASIC (instead of say Perl), to interact with your OS or as the [...]

  10. I know this if off topic but I’m looking into starting my
    own blog and was curious what all is needed to get set up?
    I’m assuming having a blog like yours would cost
    a pretty penny? I’m not very internet smart so I’m not 100% sure.
    Any tips or advice would be greatly appreciated. Cheers

  11. This design is spectacular! You obviously know how to keep a
    reader entertained. Between your wit and your videos, I was almost moved to start my own blog (well, almost…HaHa!) Fantastic job.
    I really enjoyed what you had to say, and more than that, how you
    presented it. Too cool!

  12. Forex Buying And Selling Market – My Just Take and szkolenia
    forex etoro. Forex Buying And Selling Market – My Just Take

  13. It’s a pity you don’t have a donate button!
    I’d definitely donate to this outstanding blog!
    I suppose for now i’ll settle for book-marking and adding your RSS feed to my Google account.
    I look forward to fresh updates and will
    share this site with my Facebook group. Chat soon!

  14. Do you mind if I quote a few of your posts as long as I provide credit and sources
    back to your site? My website is in the very same area
    of interest as yours and my users would certainly benefit from a lot of the information you present here.
    Please let me know if this alright with you. Many thanks!

  15. Tummy tuck: Tighten up the loose skin that didn’t bounce back, and if you’ve noticed changes to your navel area you can have surgery to
    correct it. It is important to really ask yourself, “What is it that bothers me about myself. However, the benefits are there as well: you get to get everything done in one fell swoop and you’ll save money at the same time.

  16. I have been surfing online more than three hours nowadays, yet I never found any
    fascinating article like yours. It is pretty worth enough for
    me. Personally, if all site owners and bloggers made good content material as you did, the internet shall be
    much more useful than ever before.

  17. fantasy baseball 2011…

    Commodore BASIC as a Scripting Language for UNIX and Windows – now Open Source ?…

  18. Everyine loves it when individuals ccome togethe? annd hare ideas.

    Grea blog, kewp itt up!

  19. Hello! This is kind of off topic but I need some help from aan established blog.
    Is it tough to set uup your own blog? I’m not verry techincal but I cann figure things oout pretty fast.
    I’m thinking about making mmy own but I’m not sude where to start.

    Do you have any tip or suggestions? Thank you

    my page … Chicago movie theaters

  20. free Movies says:

    It’s nearl impossible to findd educatdd people onn this topic, buut you seem likke you knlw what you’re talking about!


    Allso visit my web blog :: free Movies

  21. Jason Hope says:

    What’s up, after reading this awesome paragraph i am as
    well glad to share my experience here with friends.

  22. I’m very pleased to find this great site. I wanted to thank you for ones time
    due to this fantastic read!! I definitely really liked every little bit of it and
    i also have you book-marked to check out new things in your website.

  23. Fastidious response in return of this question with solid arguments and explaining everyything concerning that.

  24. Hi, constantly i used to check website posts here in the early
    hours in the daylight, since i love to learn more and more.

  25. coupon says:

    There’s definately a great deal to know about this subject.
    I really like all the points you have made.

  26. This is where other brand name choices fall way behind.

Leave a Reply

To prove you're a person (not a spam script), type the security word shown in the picture. Click on the picture to hear an audio file of the word.
Click to hear an audio file of the anti-spam word