The Lost Ways of Programming: Commodore 64 Basic
tomasp.net
tomasp.net
The other great reason so many of us 40-somethings got our start on the BASIC-wielding micros was that our universe was pretty small and the simple things we could make our machines do were still fancy. These days it seems that you won't interest kids with anything short of a 40fps multiplayer battle royale game with millions of polygons on screen. Random number guessing games are lame, Dad.
The early web was a lot like the early micros -- you had to make your own entertainment as you quickly ran out of things to do, and the things you were able to make were comparable to the things built by well-founded teams. The opportunity to add something new and useful to the web is largely past, and any window is even smaller if you're not a venture-backed team.
Old man out. <mic drop>
I still remember the elation I felt when I finally got my hands on a machine that could actually run a C compiler and had “high-resolution” graphics, not to mention an operating system that was documented. It felt like changing from a horse cart to a racing car. Today's computers are science-fiction space ships compared to that.
Another old man, out.
Today I agree with you.
After re-entering the world of 8bit and 16bit Commodores again, I finally utilized these. Indeed you could do quite a few tricks with them, and they are quite powerful.
There is beauty in the ease of use of these languages. And to be honest, there is a lot of hardship in languages like assembler.
The whole IDE idea for Java, Kotlin, etc. reminds me more of BASIC than C. Especially that BASIC is somewhat forgiving if you make mistakes, aka bugs, I appreciate. If you make mistakes in assembler on Amiga 500/1200, for example, you most often have to reset the machine. If you forgot to save your work before testing, you would suffer even more. And this is not the coolest of all workflows. Even on emulators like WinUAE, where you need timing to hit the debug key.
Assembler is complicated (word operations accessing an odd memory address is hard to find) and only useful in very constraint areas like elder computers.
BASIC is simple, and therefore fast.
With computers doing the heavy lifting nowadays, I keep the speed part to the computers while focusing on fast iterations. Except for the Amiga, where I think that BASIC and assembler can coexist nowadays for me. Should have utilized BASIC back then for simple things.
Break/modify/continue was the norm. It somehow worked much better than e.g. the JavaScript console on a modern browser even though reading a description of it wouldn’t give any indication of that.
Furtheremore, the small joy for programming can always be around the corner. Take for instasnce https://tixy.land/ , its a small creative code environment. Or take https://d3js.org/ as a bigger ecosystem which made animations and svg really fun and easy with javascript.
>>> x=42
>>> x
42
This already works in the standard python REPL, no need for ipython. You can literally just omit the print call/statement: >>> print("the answer to life is %d" % x, "not 0")
the answer to life is 42 not 0
>>> "the answer to life is %d" % x, "not 0"
('the answer to life is 42', 'not 0')(Doesn’t bother me in the editor, only in the repl)
A "text editor and command line" workflow requires a notion of files which just wasn't a thing in those early machines (except as part of custom disk-mamagement commands). What they had was a sort of line editor as part of the UI itself - if you typed a line number at the prompt, that line would be replaced in memory. Of course this worked really well with early BASIC where control flow is expressed entirely via those line numbers. Some primitive visual editing was also allowed - you could LIST some lines of code, then change a line on the screen and press the enter key - the ROM would then read the complete line of code from the screen and update it in the actual listing. It could get confusing at times, but mostly it worked quite well.
I'd never made this connection before but it seems both obvious and profound in retrospect. Thanks.
Drawing a circle on the screen is still pretty cool for kids. Not like super cool, but qbasic is a lot more accessible than anything more modern (other than maybe scratch, but that's weird)
I think these days the interesting building blocks may have to be more "intelligent".
Learning assembly was the natural way out.
Of course the Amiga got other interesting languages, like AmigaE (whose author is probably better known for FlatBuffers these days, but AmigaE was a usability revelation at the time)
I think the Smalltalk environments with the object browsers were (and are) the ultimate fiddling environments.
I'll be honest, I had more fun making making ASCII art that would endlessly scroll & loop thanks to a "GOTO 10" at the end of my creation.
If I'm even more honest, I find myself wishing for a GOTO command I could use in my bash scripts once in a blue moon. (I know they are a bad/horrible/lame crutch, but my brain seems to blank out any other options and just says to me: a GOTO would work perfect here.)
If it wasn't for a C64 and BASIC, I wouldn't have the career and love of technology that I still do [Checks calendar, HOLY FUCK] 36 years later.
C64 Basic does not have functions. This makes Basic programs tend to spaghetti and unreadable code, especially considering the constant memory constraints of those platforms. I grew up on these systems, and every time I think back on it I wish something like Forth would have taken its place - i.e. something with a clean and scalable pattern for abstraction. Basic, on the other hand, doesn't do abstractions. It barely has data types and what it calls “functions” are an even more limited form of Python's style of lambdas; every subset of code which can actually do something looks like “GOSUB 11600” when you call it. No naming, no abstractions, nothing.
(This is in some ways even worse than assembler, which usually has labeled goto’s.)
Reportedly, BBC Basic on the BBC Micro has proper named functions! I believe that basing this project on that Basic would have been vastly more productive and taught people the usefulness of abstracting things as you go, building ever higher abstractions, etc. But I suspect that the C64 (and its recognizable blue color scheme, which the whole page uses) brings more nostalgia-fueled clicks and shares.
I also don't agree with the notion that a more immediate programming environment will cause more people to understand programming/computer science. The notion that there exist machines that you have the power and responsibility to arbitrarily program yourself is the biggest hurdle. I, like many on this board, regard the previous as a profound natural truth. Most people just don't care, it's unrealistic and even a bit paternalistic to assume they will change their preferences if we give them different tools.
It was not hard, though not very user friendly.
Of course those computers also had worthwhile graphics and sound capabilities, but typically those were machine-specific and programmed by dealing with the memory-mapped hardware directly, even in BASIC. (There were special instructions PEEK(addr) and POKE addr, val for this purpose.) Similarly, other instructions (SYS, USR()) were used for calling custom machine-language routines either from ROM or user-loaded code - which could be plenty useful since BASIC itself, being interpreted, was relatively slow.
By the time I took "typing" freshman year in high school I could type 80wpm. No issues. I received an F in typing and couldn't understand why. When I asked the teacher I was told I was typing wrong and had to use home row. Even though my typing was fast with few mistakes, still received an F. The teacher couldn't understand I taught myself to type using a Commodore 64. He maintained there is only one way to type and I explained he was wrong.
Parents and principal got involved. The negotiated result was a B in the class, I had to apologize to the teacher and had study hall for the rest of the semester.
Everything from Compute or Computes Gazette was awesome. You'd type it all in and sometimes it didn't work ... you could wait until the next month when fixes were printed or you could debug and solve it yourself.
This started to end with the release of SpeedScript, which was the first MLX release from the magazine. Since it was machine language you didn't enter the program lines, but numbers.
https://en.wikipedia.org/wiki/SpeedScript
Amazing times.
It's not like the C64 or Basic were earth shattering marvels of design either so the fact that the c64-inspired but ~5 orders of magnitude more powerful raspberry Pi 4 compares very unfavourable in terms of startup time and probably quite a few other latency metrics is pretty depressing.
While countless computers have come and gone in the ~40 years since, I still have that PET in my basement.
2561 IF P>0 THEN P=0
2562 IF P<20 THEN P=20
which should be 2561 IF P<0 THEN P=0
2562 IF P>20 THEN P=20I never had a C64, but did have a ZX Spectrum, and I have no doubt that it is very much responsible for my interest in programming from a young age, particularly the BASIC prompt being something you had to interact with. I remember getting books of programs out of the library and spending hours typing them in, my mum would help out sometimes haha!
You are absolutely right that my POKE is not like the real one - because for that, you actually need to emulate quite accurately the C64 memory. So, anything related to POKE is not accurate - and this misses the experience you get as a hacker discovering tricks you can do.
However, my point was more about the interaction that combines text editor and REPL into one - and I think for that, it works well enough.
I would write basic programs with pen and paper in long car rides.
10 PRINT "TODD RULES"
20 GOTO 10
But I wouldn't agree with a statement that things are worse today than they used to be.
JS with something like codepen.io is an excellent zero-install, write-whatever environment kids and adults can both enjoy.