Slashdot Mirror


Scripting In Commodore BASIC For Windows & Linux

SomeoneGotMyNick writes "Someone more nostalgic than I am, and with a lot of time on their hands, had created a scripting language based on Commodore BASIC for Mac OS X. They recently finished a version that works on Windows and Linux. You can pass the text of a BASIC program as a parameter to the program. I found it odd that it took 1.8 MB of source code to compile to an interpreter that used to fit in 8K of ROM space. If this ever becomes popular, perhaps we'll see Obfuscated CBM BASIC contests." In a simliar vein, in the comments someone points out what is essentially an open source AmigaOS Classic.

24 of 213 comments (clear)

  1. The important quesiton is... by Thelasko · · Score: 3, Funny

    When will somebody port Radar Rat Race to Windows or Linux?

    --
    One of our competitors trademarked the term "hypothesis". From now on, we will call them "boneheaded ideas".
    1. Re:The important quesiton is... by Thelasko · · Score: 4, Funny

      I should have known somebody was going to take that comment seriously. Mention porting a crappy game from 25 years ago, and somebody on Slashdot will do/find it.

      --
      One of our competitors trademarked the term "hypothesis". From now on, we will call them "boneheaded ideas".
  2. Why it's 1.8MB by Anonymous Coward · · Score: 5, Insightful

    It turns out that this is just a disassembly of the interpreter translated into C. The file is so large because it has lots of really long computer-generated symbols.

    It's a shame that this is not a reimplementation of BASIC in C.

    dom

  3. There's also Freebasic. by GrpA · · Score: 5, Informative

    I guess basic is basic unless it's on a machine you're familiar with... I find Freebasic ( www.freebasic.net ) useful, probably because I came from the same era and did all my programming back then too, although I used a Spectrum and I'd never want to have to use that sort of keyboard again.

    Freebasic is a fairly recent compiler that makes pretty neat code and has all the common C calls available to it too as well as being able to process native Qbasic programs (if you migrated from the C64 type basic to the PC later) without many of the limitations and nearly complete compatability.

    It also allows cross-scripting between Mac, PC and Linux with the same program which I find useful too.

    www.freebasic.net

    GrpA.

    ps. Basic may not be dead, but you still get funny looks when people see you programming in it. I think some consider it even more ancient and antiquated than cobol (which it's not).

    --
    Enjoy science fiction? "Turing Evolved" - AI, Mecha, Androids and rail-gun battles. What more could you want?
  4. Re:TI Basic by pilgrim23 · · Score: 3, Informative

    plugh! or was it xyzzy? :)
    there are several Apple II emulators that allow programming in Apple Basic or even Merlin Assembler (65816) for both Mac and Windows. Sweet16 is the best of OS X (a port of Bernie ][ the Rescue from BeOS; originally on Mac Classic), XGS, KEGS and many others are also out there...

    CALL -151

    --
    - Minutus cantorum, minutus balorum, minutus carborata descendum pantorum.
  5. Commodore BASIC by hpa · · Score: 4, Insightful

    I have to say, Commodore BASIC was one of the worst BASIC interpreters available in the "home computer" market. It's pretty clear the C64 was really a game console with a keyboard, so it could be (very successfully, and legitimately so) sold as a computer. If you actually wanted the C64 to do anything interesting, you had the choice of assembly, or BASIC that looked like assembly but ran like crap. As far as I can tell, the C64 BASIC didn't use any of the techniques used by other BASICs from the same era to not run like a total dog.

    Don't get me wrong, the C64 was a great machine. It just wasn't a great machine for BASIC programming.

    1. Re:Commodore BASIC by decipher_saint · · Score: 3, Interesting

      Compared to...?

      I'm actually quite curious what the differences would be that would make it a bad interpreter.

      C64 was my first exposure to programming (I was 8 when I got my hot little hands on it), and not having tried anything else from that particular era of home computing I don't have a yardstick to measure that sort of thing.

      So please, tell me more :-)

      --
      crazy dynamite monkey
    2. Re:Commodore BASIC by hpa · · Score: 5, Informative

      A few things that made Commodore BASIC slow compared to some of the BASICs of the time:

      1. A lot of parsing was done at runtime, rather than at entry time or program startup time. This meant that a lot of work got done over and over rather than once per execution, and also encouraged practices that made programs hard to read, like omitting comments and whitespace.
      2. No support for integer-only arithmetic.
      3. Very few high-level constructs. This didn't just turn programs into a mess of POKE statements, but frequently meant that a lot of them were needed -- all of which involved two floating-point to integer conversions to set a single byte.

      Most BASICs at the time would at least tokenize at entry time, and many even converted programs to P-code for execution. It was still much slower than true assembly, but it wasn't anywhere near as bad as the CBM basic. Similarly, most (but again, not all) BASICs of the time supported integer-only arithmetic at least as an option.

      I have to admit to being a bit spoiled at the time, since I first learned to program on the Swedish ABC80 computer, which had a very fast BASIC interpreter. Its follower, ABC800, even had a decent collection of high-level programming constructs in its BASIC. Too bad neither had acceptable graphics, nor a reasonable price point for home use (they ended up being sold mostly into schools and small offices.)

    3. Re:Commodore BASIC by ACMENEWSLLC · · Score: 3, Interesting

      I learned BASIC on an Apple and then moved to the C16 then to a C128 with C64 embedded. I really enjoyed BASIC on the Commodore platform. I loved POKE and PEEK. The with my Super Snapshot card I could get into a pretty good machine language decompiler. From there I could create programs in the $c000 range, store them to a floppy, and sys them. I loved monitoring the raster ($d018 or somewhere close) and changing it's color when it's at various positions to create screenshots better than what the C64 normally allowed.

      I never have got as deep with the x86 platform.

      The thing I've found with most emulators is that this trickery just doesn't work right. A lot of it depended on the set Mhz rate of the hardware.

      I find it odd as many fanboys of the C64 as there are, why not embed one onto a USB dongle. The other end with a RS232C cord?
          Something like this http://www.vesalia.de/e_c64dtv%5B5732%5D.htm?slc=us ported for us programmer types.
         

    4. Re:Commodore BASIC by BitterOak · · Score: 4, Informative

      No support for integer-only arithmetic.

      Actually, that isn't true. You could specify integer variables by suffixing them with a percent sign (eg. i%=1). But most people were lazy and omitted the percent sign, so their programs ended up doing a lot of floating point math unnecessarily.

      --
      If I can be modded down for being a troll, can I be modded up for being an orc, or a balrog?
  6. Re:TI Basic by jojisan · · Score: 3, Interesting

    Was that a stock 99-4A or did you have the extended memory cartridge?
    I really do miss call sprite...

    --
    <sig> I wish I had a </sig>
  7. 1.8 MB of source for 8K of ROM by sucker_muts · · Score: 4, Interesting

    I found it odd that it took 1.8 MB of source code to compile to an interpreter that used to fit in 8K of ROM space

    Don't forget that the commodore cpu was 8 bit and current cpu's are 32 or 64 bit: Most of the commands were 8 bit and their equivalents are bigger nowadays. That explains the 8KB of ROM

    And they did not need fancy memory protection stuff, they hacked straight into the hardware. No dll's, so's to use or API's to follow. Even if it is a lot assembly code, there are a lot more bytes in assembly source than in binary executables.

    Context, people, context! ;-)

    --
    Dependency hell? => /bin/there/done/that
  8. Re:TI Basic by mfh · · Score: 5, Informative

    Was that a stock 99-4A or did you have the extended memory cartridge?

    I had the 10 ton silver expansion box! 32k baby!!! It was the BEST! :) With the Speech Synthesizer to boot! Doc Watson makes me cry when I think about how much that thing cost me... right out of pocket too from my paper route!!

    This particular code made use of CALL SPRITE, but also had the most advanced calls available. Man that brings back memories...

    CALL COLOR, CALL CHAR, CALL SPRITE, CALL PATTERN, CALL MAGNIFY, CALL MOTION, CALL POSITION, CALL LOCATE, CALL DISTANCE, CALL COINC, and CALL DELSPRITE.

    The cartridge was Extended Basic, which was totally elite at the time. :P

    We were all designing color output, while the poor VIC-20 guys were still monochrome.

    I still remember the text adventure, where if you type look up, a piano falls on your head. I think it was called Asylum or something? Man that is going way back to the summer of 1983, if memory serves.

    --
    The dangers of knowledge trigger emotional distress in human beings.
  9. Re:TI Basic by aardwolf64 · · Score: 5, Funny

    I had to get my dad to program the dungeon text adventures, so it wouldn't spoil everything for me. There's just something about typing everything that could happen to you that ruins the game.

  10. But the real question is.... by Simonetta · · Score: 5, Insightful

    But the real question is....Why would anybody do this?? Port Commodore64 BASIC to a PC?

        I used to have a Commodore64 and learned 6502 Assembler on it. When I got a PC (a 286) I felt nostalgic for the C64 and bought a cheap one. I used it about ten minutes and realized what a mistake it was. Fortunately I was able to sell it right away.

        Never look back. There is is nothing that was written for Commodore 64 that isn't 1000 times better on modern PCs. Nothing. Don't give me any BS about the wonderful SID chip and its KOOL mickey-mouse MOD files. They suck, really. Don't tell me about that fantastic game that you used to play on the C64 and have never been able to recreate the excitement on a PC. It's because you were a kid discovering video-games, not the Commode64.

        Are you going to tell me that you miss spending four minutes to load a 25K file from the excretable 1541 disk drive? Or spending 40 minutes to download a 25K file on a 300 baud modem from a long-distance BBS when you're paying the phone bill? Or the stupid PEEKs and POKEs. Do you miss typing in hundreds of numbers from Compute's Gazette because the program is written in super-fast 6502 1.2MHz machine code?

        The only good thing about the C64 was the keyboard. And once you start talking to your 3GigaHertz PC and having your words appear on the screen as you speak, you don't miss the keyboard. Regardless of how good it is.

        Commodore 64's rule!! But, really they suck. Never look back on trash.

    1. Re:But the real question is.... by spaceyhackerlady · · Score: 4, Insightful

      But the real question is....Why would anybody do this?? Port Commodore64 BASIC to a PC?

      Three reasons come to mind:

      1. Because it's there.

      2. Because you can.

      3. Because it's cool. :-)

      ...laura

  11. Almost tempted by ducomputergeek · · Score: 4, Funny

    I have an old book on how to build your own telescope from the 1980's that included how to hook up a C64 and use a joystick to control the telescope's movements all written in C64 Basic. I remember porting it to QBasic circa 1994/5 and using it for a telescope I had to account for planetary motion for photography. (Back before every telescope came with such features).

    That would almost be fun...wow I really am a geek....*shudders* I'm going back to my cave now.

    --
    "The problem with socialism is eventually you run out of other people's money" - Thatcher.
  12. I hit L, Shift-O to the Quote and then Dollar! by JoshDM · · Score: 3, Funny

    If you know the dir of the nerdcore rhyme, then holler!

  13. *whoosh* by frieko · · Score: 3, Insightful

    Of course this is a useless project! Almost as useless as model airplanes and magic tricks and football and all of the other wonderfully useless things people do to amuse themselves. Don't care for it? Fine, but no need to insult it.

  14. Re:READY. by Blakey+Rat · · Score: 3, Informative

    Semi-colon, buddy, tells the C-64 to not append a newline after the string. Feh, NEWB!

    You could rewrite that as:

    10 PRINT "YAY!";
    20 GOTO 20

  15. Ah sweet memories, I love /. by Phizzle · · Score: 4, Funny

    I remember coding a nuissance program in 6510 assembler on my C-64 that sat in the background and when a key was pressed it had a tiny chance not to echo it to the screen or to echo it twice. After installing it on several classroom computers off the old 1541 floppy it drove some students batty, they thought they had sticky keys. This was before real viruses :)

    --
    I will not be pushed, filed, stamped, indexed, briefed, debriefed or numbered. My life is my own.
  16. Re:TI Basic by lxs · · Score: 4, Funny

    I used to have a book with type-in adventures where they obfuscated all the strings by shifting them one character precisely to counter that problem.

    Oh and typing in five pages of numbers representing binary code was fun. There were actually checksums printed at the end of each line and a little program showed you the checksums in the corner of the screen after entering each line of code.

    Man I feel old. You young whippersnappers don't know how good you have it with your iPhones and your WiFi.

  17. Re:TI Basic by khellendros1984 · · Score: 4, Informative

    If you wanted a serious answer, it's most likely related to the ties to the graphics and sound libraries, storing sounds as waveforms rather than parameters to tone-generation hardware, and probably packaging overhead.....those are just guesses. I'm no iPod software expert.

    --
    It is pitch black. You are likely to be eaten by a grue.
  18. malicious code by RackinFrackin · · Score: 3, Funny

    SYS 64738