Slashdot Log In
Scripting In Commodore BASIC For Windows & Linux
Posted by
kdawson
on Tue Nov 04, 2008 04:41 PM
from the nostalgia-isn't-what-it-used-to-be dept.
from the nostalgia-isn't-what-it-used-to-be dept.
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.
Related Stories
This discussion has been archived.
No new comments can be posted.
The Fine Print: The following comments are owned by whoever posted them. We are not responsible for them in any way.
Full
Abbreviated
Hidden
Loading... please wait.
TI Basic (Score:2, Interesting)
I remember coding four pages from 99er, to make a little box go from one side of the screen to the other and change colors, while playing a midi tune. More serious business was the epic dungeon text adventures!
Now of course this would be nice to have on Linux.
Re:TI Basic (Score:4, 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
Parent
Re: (Score:3, Interesting)
Was that a stock 99-4A or did you have the extended memory cartridge?
I really do miss call sprite...
Re:TI Basic (Score:5, Informative)
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.
Parent
Re: (Score:3, Interesting)
Re:TI Basic (Score:5, Informative)
Parent
Re:TI Basic (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.
Parent
Re:TI Basic (Score:5, 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.
Parent
Re: (Score:3, Interesting)
I remember a similar demo in the TI/994A Reference Manual. It also had a program to re-define a character to make a little jumping man in an 8x16 grid. One of my first programs was to make a running man move across the screen based on the code in the reference manual.
The important quesiton is... (Score:4, Funny)
Re: (Score:3, Informative)
http://www.zzap64.co.uk/c64/c64emulators.html [zzap64.co.uk]
You're on your own for the actual game, but I promise it's out there. It's only 6k zipped.
Re:The important quesiton is... (Score:5, Funny)
Parent
Re: (Score:2)
Hey! I still have that, and my VIC-20, in my garage!
READY. (Score:3, Funny)
20 PRINT"YAY!"
30 NEXT
RUN
Re: (Score:2)
I much prefer:
10 ? "YAY!YAY!YAY!YAY!YAY!YAY!YAY!"
20 ? "AY!YAY!YAY!YAY!YAY!YAY!YAY!Y"
30 ? "Y!YAY!YAY!YAY!YAY!YAY!YAY!YA"
40 ? "!YAY!YAY!YAY!YAY!YAY!YAY!YAY"
50 GOTO 10
RUN
Re: (Score:2)
Re:READY. (Score:4, 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
Parent
Re: (Score:3, Funny)
Oh crap, I typoed the code. I'm the newb!
I can make up for it:
10 FOR X = 1 TO 16
20 PRINT "YAY!";
30 POKE 646,X
40 NEXT X
50 GOTO 10
Now we're cooking with gas.
Re: (Score:3, Insightful)
Surely
10 PRINT "YAY!"
20 GOTO 10
RUN
Why it's 1.8MB (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
There's also Freebasic. (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).
Re: (Score:2)
Re: (Score:2)
What about Nibbles.bas?
Re: (Score:2)
There is another (Score:2)
GORILLAS.BAS [telcontar.net]: Microsoft's only open source game.
Lest we forget Allegiance [microsoft.com]...
Commodore BASIC (Score:5, 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.
Re:Commodore BASIC (Score:4, 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 :-)
Parent
Re:Commodore BASIC (Score:5, Informative)
A few things that made Commodore BASIC slow compared to some of the BASICs of the time:
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 [abc80.org] 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.)
Parent
Re:Commodore BASIC (Score:5, 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.
Parent
Re: (Score:3, Informative)
Additionally, Commodore BASIC _did_ tokenize input at data entry time.
That's how the "shortcut" keywords worked -- PRINT's shortcut was P-shift-R (graphical underscore-like character), and not uncoincidentally, that was also the token for the PRINT statement.
I'm not sure the grandparent is, in fact, talking about CBM BASIC 2.0. :)
(which, don't get me wrong, sucked -- but it's not like AppleSoft BASIC was any better. Or Timex-Sinclair BASIC. Let's see. What BASIC is he referring to that has data structures a
Re:Commodore BASIC - which variant?? (Score:3, Interesting)
Being less talented than your average /.er, Commodore *64* basic reduced me to whimpers at that tender age. I pulled out all the stops and mortgaged my childhood in chores to upgrade to the Commodore 128, and that is basically the best value in an upgrade I'll ever see. Helped by the extra passage of years, on the 128 I made maze programs, a Dodge-The-Mall-Traffic Simulator as a joke, Ethnic dialects of Eliza including the Angry New Yorker, and a few quasi-utilities that were more basic concept exercises. T
Re: (Score:3, Interesting)
Actually Atari Basic was arguably worse the Basic 2.0.
Atari Basic had totally none standard String handling.
C64 Basic lacked extensions for graphics and sound but other than that it wasn't terrible.
Re:Commodore BASIC (Score:4, 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 [vesalia.de] ported for us programmer types.
Parent
Why? Just use an emulator (Score:2)
Why? You can already download a C64 emulator for your chosen platform and use REAL Commodore BASIC.
CBM Basic in itself didn't do much (Score:2, Interesting)
If you have any of those old CBM-BASIC listings from 80's computing magazines, it's full of POKE x,y statements (and sometimes the program is just a hex loader with bunch of READ...DATAs). So I'm really not so sure of the value of this experiment.
(One of the longest "commercial" CBM-BASIC programs I remember - that actually used it for lots of things - was Sid Meier's Pirates! [wikipedia.org]. (Haven't tested the newest Remake - I did like Pirates Gold!, the first remake, a lot)
1.8 MB of source for 8K of ROM (Score:5, Interesting)
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!
Re: (Score:3, Insightful)
I smell a terrible contest.... (Score:2, Interesting)
Is that, some old assembly hackers ought to be able to whip up a fairly tiny basic interpreter. It should be fun in a way and still easier than in the old days of 6502. You have more registers, some basic string instructions, and outstanding support for floating point. I doubt it could be quite as small though, as, the big thing that would bloat it up would be that instructions themselves in 32 bit. For an easier and almost weekend job of it, you could do it in 64 bit assembly for Linux only. That spar
But the real question is.... (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.
Because it's there (Score:3, Insightful)
obviously.
Re:But the real question is.... (Score:5, 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
Parent
*whoosh* (Score:4, Insightful)
Parent
Re: (Score:3, Informative)
The attraction of the home computer scene of the early 80's wasn't productivity, it was the sheer fucking joy of exploration.
Almost tempted (Score:5, 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.
Retrocomputing (Score:3, Funny)
Now my 25 year old C64 BASIC programs can run under Linux, OSX, or Windows.
If only my 1541 floppies didn't suffer from bit rot and I loaned most of my collection to friends who didn't return them and somehow lost it after they moved.
I hit L, Shift-O to the Quote and then Dollar! (Score:4, Funny)
If you know the dir of the nerdcore rhyme, then holler!
Ah sweet memories, I love /. (Score:4, Funny)
malicious code (Score:3, Funny)
SYS 64738
I'll say. (Score:3, Insightful)
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.
Especially when you consider that Farbrausch [farb-rausch.com] were able to create a near-complete c64 emulator [scene.org] for Windows in under 64K a couple of years ago.
So what does that other 1.74M go to?
Re: (Score:3, Informative)
Actually I would guess that it could be the multiplatform code that takes up so much space.
I have to hope that they don't support Poke and Peek.
C64 basic doesn't support any of the cool features like Sprites and sound.