21 ms·
The lost ways of programming: Commodore 64 BASIC (2020)
- dusted 4y agoScreen does not start at 0 so your poke won't place anyhing on screen (actually, address 0 is the PORT register on the 6510 iirc). POKE X CHR$(209) is not valid syntax, POKE takes a memory address (in decimal) a COMMA and the value (0-FF) in decimal. Also.. CHR$ converts an ascii value to a character.. you don't want that here.. Also.. the character color has not been set under the ball, so it won't show up on most of the screen-area.. Screen memory starts at 1024, color memory at 55296 so to show your ball, you'll do POKE 1024,209 POKE 55296,1 Also, you should use 81 and not 209, since the machine is in uppercase mode, and 209 is the inverted circle in that mode. Why spend the time to write an article with examples that do not actually work?
- deleted 4y ago[deleted]
- hulitu 4y agoWhy so harsh with the poor guy ? He just followed best practices from the industry and let the customer test it.
- soegaard 4y agoYou skipped the foot notes? > The emulator implemented here only supports POKE for accessing screen memory. To keep things simpler, it starts at offset 0 rather than at offset 1024 as in the real Commodore 64. When you access an invalid address, e.g. by waiting until the ball runs off the screen, the operation fails and the program execution will stop. He doesn't need a full emulator to show the principle.
- dusted 4y agoI actually did skip those, I never made it that far. I was using the page in C64 reader mode (due to the colors making it impossible for me to see anything) and so I never realized that the image to the right was actually an emulator, I thought it was just a screenshot. My fault ^_^ Still though, in my opinion it'd then be better to skin the thing as something other than a C64 so as not to avoid the confuzion for no reason.
- egypturnash 4y agoThis is a really weird little simulation of a faux-64. The virtual machine is not in uppercase mode, typing stuff into it goes in as lowercase and doesn't get properly parsed. (This might be a Safari bug). As far as I recall there was no DELETE keyword, which this thing uses instead of NEW. Different revisions of the C64 ROM did different things with regards to clearing the color memory when clearing the screen, my early c64 would set it all to white, while later revisions would (I think) set it to whatever the current character color was. I guess this is trying to simplify things somewhat to make its points about the power of booting up straight to a BASIC prompt, but it sure does annoy anyone who spent time hacking on a real c64!
- pjmlp 4y ago> I'm not trying to create an accurate Commodore 64 simulator though. The point is to show a few things that we can learn from for future programming systems. Apparently you haven't bothered to read the manual. I agree with the author, one thing great about these systems was having BASIC as a kind of systems programming language, with high level niceties, and a REPL. Something that younger generations taught in the ways of C have no idea how it went.
- strainer 4y agoIt is no small feat that what is essentially pre-debugged C64 Basic psuedo-code, is yet dynamically illustrated quite nicely by bespoke javascript rather than a pulled-in browser c64 emulation module. Besides the unusual errors in the displayed code, the lesson seems to flow nicely and I think may be great when "actualised" to actual c64 Basic. I only missed not being able to scroll the screen with arrow or space keys, mobile and mouse wielding readers may not notice that issue.
- theflyingelvis 4y agoWorks for me
- tgv 4y agoI agree with the sentiment, at least partially. Using a high-level library in JS to display a complex graph is nice when you build a production system, but for learning the direct, almost tangible control is so important. It enables our intellect to build high-level concepts on low-level ones, and allows us to slowly understand how hidden functionality complicates high-level design before actually having to deal with it.
- bayofpigs 4y ago
- nobleach 4y agoWhen I was around 12 years old, a group of 3 friends decided we wanted to create computer games on the 64 (and later 128). We started to learn about sprites and how to do rudimentary animations. Nearly every day after school we'd share some new thing we had learned the night before. We'd pool our knowledge. It was such an incredible time. Do you know what phrase I NEVER heard during those days? "What, you didn't know that?" I loved that collaborative feeling. If my friend was having a hard time understanding something, I just figured out a different way to explain it. It's such a far cry from the nonsense I see in the various software dev communities today. Perhaps it's because none of us felt like there was a competition between us.
- deleted 4y ago[deleted]
- UI_at_80x24 4y agoThis is exactly it one thousand times over. The C64 was a gateway drug and everybody that was 'into it' really was a kindred spirit. C64 BASIC has ingrained 1 evil in me. "goto" Atleast once a month I'll be working on some script and I'm stuck but a little voice in the back of my head will say: "a goto would fix this part you are stuck on!" And damn if that doesn't reverberate into the past. I went the hardware route. I bought additional hardware for my C64. First the 1541 (5.25" floppy drive), then the 1581 (3.5" floppy drive), then a 300/1200 baud modem, then a 2400baud modem. I've been hardware hooked ever since. I'm now a sysadmin working with *nix servers. I tried programming. I really did. I meticulously copied one of the sample programs out of the back of the C64 manual. It never worked.
- nobleach 4y agoDefinitely a gateway drug. I had an Apple ][+ around that time too. The manuals for that were incredible. Luckily, my dad's startup had tons of old hardware for it. Printers, Koala Pad, plenty of disk drives, modem, EPROM programmer, 80 Column Card with C/PM and Pascal.... even though it was about 10 years old, it was great. But the C64 always seemed far more approachable. That brown box with the clacky keys... And I was too young to know about Djkstra's "Goto Considered Harmful". It probably could have made me a far better engineer if I had picked up better habits sooner.
- zergu 4y agoMy first programming or rather "programming" cause I mosty used it to save text on cassettes. Good times.
- commandlinefan 4y agoGrowing up with one of these, I really thought that a career in computer programming was going to be more or less like getting stuff to work on a C64. Shame it isn't.
- hadjian 4y agoCouldn‘t agree more with the author and in fact, I started to code on the C64 with my son around three years ago, for exactly that reason. There are educational coding environments, but you will never understand the underlying computer model, just by playing with them. And no setup whatsoever. Python was supposed to be that simple, but we’re past that, obviously.
- throw7 4y agoThis is how I first learned programming, but on the C128. It came with wonderful manuals which included a Commodore BASIC manual. I also was subscribed to Commodore magazine which had pages of PEEKS/POKES I'd blindly type in. Didn't learn a single thing from that, but the toy games they ran were cool. :)
- franze 4y agoLearned coding on a c64 as a 6y old. it broke when it was 14. parents were happy that I do not waste so much time anymore on the computer. so no computers for me any more. I think they never understood what I was actually doing. Coded some nice games and also a "use your joystick as a music instrument". also party and girls became much more interesting at that point in my life. with 19 I needed a job - as I became a father myself. Applied for a dot come job. Started coding again. Found out that not much has changed. Code was still code and with enough trial and error, lots of reading and thinking about a problem you could figure everything out. So thx C64, you thought me a lot.
- chrisjc 4y ago> parents were happy that I do not waste so much time anymore on the computer. so no computers for me any more. I think they never understood what I was actually doing. As a parent I now wonder about the ways that I might do something similar to my kid. Or perhaps more importantly, what is the c64 of my kid's generation that I can buy for her?
- ako 4y agoMy son recently showed me something he was creating for Minecraft, turns out he's using MongoDB and Redis...
- ryukafalz 4y ago> Or perhaps more importantly, what is the c64 of my kid's generation that I can buy for her? Raspberry Pi. The Pi 400 is especially close, with the same keyboard form factor and all. It’s not as immediately programmable as the 8-bit micros were (hard to beat booting up right into a BASIC prompt for that), but Linux is still more tinkerable than most other devices you’ll encounter and the default Pi distro has a bunch of educational stuff preinstalled. Using an old desktop that my dad had installed Linux onto had a huge impact on me in my formative years. I credit that for at least part of my career success.
- deleted 4y ago[deleted]
- ctrlmeta 4y agoThe early PCs and BASIC provided such a simple and effective computing environment where any newbie could start reading the online manuals (known today as built-in manuals) that came with BASIC interpreter and start writing some simple code immediately into the integrated editor that also came with BASIC! I think the loss of a simple, integrated and interactive programming environment like BASIC has been a tragedy. Is there anything like BASIC today that any child, secretary, or grandmother can pick up and learn with as little hassle as possible?
- pjmlp 4y agoNot sure how easier such target audience would find these alternatives, https://www.microsoft.com/en-us/makecode https://www.microsoft.com/en-us/makecode https://smallbasic-publicwebsite.azurewebsites.net/ https://smallbasic-publicwebsite.azurewebsites.net/ (partially dead)
- the_af 4y agoI used to think that Python was the answer to this. Not dealing with dependency hell or any other "enterprisey" features, just plain Python with maybe a graphics lib for outputting graphics to the screen. It requires almost no rituals to get something going. But of course, you have to boot into your OS first, open a text editor or IDE, etc -- it doesn't replicate the "instant on" appliance feel of the C64. I loved my C64 and BASIC was my first programming language... but boy was it limited. It wasn't a good BASIC for the standards of its time. It was hard to program games with it, and in order to do any graphics you had to PEEK and POKE, which can hardly be considered "programming in BASIC" or user-friendly...
- chkas 4y ago> Is there anything like BASIC today that any child, secretary, or grandmother can pick up and learn with as little hassle as possible? I tried to develop something like that: https://easylang.online/ide https://easylang.online/ide
- w4ffl35 4y agothey can and in my opinion still should learn on BASIC or QBASIC
- tiborsaas 4y agoDaniel Schiffman just started a video series about coding in Apple ][ BASIC on a vintage machine: https://www.youtube.com/watch?v=UNkHditYGls https://www.youtube.com/watch?v=UNkHditYGls https://www.youtube.com/watch?v=7r83N3c2kPw https://www.youtube.com/watch?v=7r83N3c2kPw
- acomjean 4y agoI've seen them, they're quite fun. The intro montage is quite funny. The fact he has the beagle bros tips poster is magic. https://beagle.applearchives.com/the_posters/ https://beagle.applearchives.com/the_posters/ Its funny how you remember some things. like how to fill the screen a single color. 10 hgr 20 hcolor=2 30 hplot 0,0, 40 call 62454
- tiborsaas 4y agoI've never heard about Beagle bros, it's hilarious :)
- hbn 4y agoI've been loving this series and I hope he continues it. Being relatively young (25) and not living through the times of these classic computers, I knew the basic (heh) ideas behind programming for them, where the whole thing is essentially a REPL and you write line numbers to add to the program. But I never saw demos farther than printing a line and then doing a goto to print it infinitely. I didn't understand the actual workflow/iteration process programming for these machines, writing something more advanced where you're figuring things out as you go. I have to say my conclusion is I'm glad that in modern times we have the ability to go back and insert as many lines as we want in between any other lines :)
- swayvil 4y agoMe too. Learned programming on c64. Wrote a D&D character generator. Worked pretty good. Messed with sound a bunch. Apocalyptic chords. Hacked up freeware games. Made lots of generative art Poked random stuff till the machine crashed prettily
- AnimalMuppet 4y agoOn a TRS-80 Model 1, "POKE 16403, 47" was messing with the video controller. Created some really weird screens. Had to reboot to recover.
- cratermoon 4y agoPEEK and POKE, my old friends.
- yodsanklai 4y agoThis blue screen brings so much nostalgia. It was such a limited computer, but as a kid, it felt like it has unlimited potential with many secrets yet to be discovered.
- newlpast 4y ago
- dhosek 4y agoIt’s kind of interesting to remember that those 8-bit computers essentially booted up in a BASIC REPL. Starting an input line with an number was adding to your code, otherwise, whatever you typed would be executed immediately. I remember being confused about how Pascal worked because how did you input a program without line numbers? The whole concept of a programming editor was alien to me.
- ArekDymalski 4y agoO yeah, i've hit exactly the same obstacle :)
- wikitopian 4y agoWe might have lost the ability to solve problems and create solutions with approachable yet powerful programming environments. But think about all the abstractions, frameworks, platforms, paradigms, and design patterns we now get to learn!
- dgabriel 4y agoThis is exactly how I learned to program. My brothers only liked playing the games, but I preferred making my own (generally based on source code listings in the back of BYTE magazine).
- weeksie 4y agoMemories of being 10 and writing a C64 program to generate D&D character stats and generally dumb stuff like handling dice roles and random encounters. Felt like magic.
- jll29 4y agoYou may know SYS 64738, but who knew SYS 42222?
- FrameworkFred 4y agoLove the points made in this article and the way it was presented with an inline emulator. If it weren't for "War Games" and the vic-20 (and later the c64), I would've ended up on a very different path.
- kgwxd 4y agoI never did any C64 programming when I was a kid. Hearing the Commander X16 might be ready for manufacturing soon, and it being C64 BASIC compatible (except POKEs), I decided to go through some old guides for the C64 but used the X16 emulator to do them. My absolute favorite was a course originally on VHS "Commodore 64 Introduction to Programming" I found on YouTube, there's 2 levels[0][1]. [0]https://www.youtube.com/watch?v=h3bDa5z_B1M https://www.youtube.com/watch?v=h3bDa5z_B1M [1]https://www.youtube.com/watch?v=iJDYoVgrtOs https://www.youtube.com/watch?v=iJDYoVgrtOs
- deleted 4y ago[deleted]
- myth_drannon 4y agoJust love the minimalism and simplicity of BASIC. I tried to program in Scratch and Scratch Junior with my 7 years old and it's just overwhelming for me as an adult software developer not to mention a child. Click here, move here, this container and that, not to mentions the browser/mouse issues. I don't understand why it's so popular, maybe it's because that's the only application they teach kids in schools? I'm thinking about just booting up my old 486 PC and show MS Basic.
- MarkLowenstein 4y agoGreat point. People still confuse primary colors and click-and-drag with easy learning. But here's how everyone understood a computer would work, before they saw anything else: GREETINGS PROFESSOR FALKEN. Hello. HOW ARE YOU FEELING TODAY?
- sbf501 4y agoI wrote almost exactly this on C64 in the early 80's. The problem was that you couldn't see the ball moving very well because the pokes happened so rapidly compared to the rest of the code that it was a quick blink of the ball. It didn't look as clean and tidy as it does in this emulator. Also, my 12 year old brain wasn't smart enough to think of double buffering, or to draw the new position before erasing the old.
- beders 4y agoGood times. I owned an Amstrad CPC 464 - a Z80-based competitor to the C-64. It had Locomotive Basic which was quite a bit more advanced than C-64 BASIC. It had instructions like AFTER delay, timer GOSUB line or EVERY time, timer, GOSUB line for example. Giving you a sense of multi-threading all the way back in 1984! I spent quite a bit of time translating C-64 BASIC code into Locomotive. Learning on an 8-bit computer, diving into Z80 assembly and understanding how the thing works on a very low level is a useful skill to have.
- vardump 4y ago> It had Locomotive Basic which was quite a bit more advanced than C-64 BASIC. Haha, that's a really low bar! Commodore really cheaped out with C64 BASIC. I wonder if that also was ultimately advantageous for C64, forcing kids to learn 6502/6510 machine language early to get anything interesting done. Thus a lot of kids could create their own games and whatnot in assembler, with way higher performance than what was possible with BASIC at the time.
- klondike_klive 4y agoC9 RET is still burned into my brain for that very reason.
- reaperducer 4y agoPeople today really underestimate BASIC. If you look at computer magazines from the 1970's, it was massive. If you put out a new computer in the mid-70's, you had to include two things: an assembler, and BASIC. Floppy disk? Optional. 16K of RAM? Optional. If you didn't have BASIC, your new machine was doomed. Small, mid- and even some larger-sized businesses ran in BASIC. If you didn't need a mainframe, your business was running on assembler or BASIC. I can understand why Microsoft made so much money back then, porting BASIC to every platform from calculators to minis.
- Stamp01 4y agoI just picked up my first C64 last weekend at the midwest vintage computer festival. It needs a little work because it's one of the revisions with the weak video output, but otherwise it's in great condition. I can't wait to start playing around. Seems like a great sandbox to finally get comfortable with assembly. I think I'll try diagnosing the issue this weekend if I can muster up the energy.
- actionfromafar 4y agoIf the transformer is heavy, make sure to replace it soon, it can fry the C64.
- Stamp01 4y agoAs in the transformer brick in the power cable? I picked up a NuBrick while I was there, so I should be okay.
- Pixelbrick 4y ago+1 Measure the voltages on the connector. There's a pinout diagram further down on this page: https://retrogamestart.com/answers/replace-c64-power-supply-voltage-failure-will-kill-your-c64 https://retrogamestart.com/answers/replace-c64-power-supply-... I've seen a bad power supply kill one of the two CIAs, the color ram & damage the SID on a C64C
- Jun8 4y agoHey I was there, too. For those in the area this is an event you cannot miss and this year it was packed. I went there with my 15 year-old, he spends a ton of time on Xbox so it was great to see him enjoy playing with a PET, Sinclair Spectrum and the C64. So it’s not all old timers who love these old machines, the new generation can enjoy them, too. Given that it’s a mystery why some company just build and sell a C64 / Amiga/ Sinclair clone for a reasonable price. Next batch of YC anyone?
- MarkLowenstein 4y agoThis C64 simulator is proof that there is a legitimate need for the Caps Lock key.
- hbn 4y agoThis is the first time I've regretted mapping my caps-lock to Ctrl
- jimt1234 4y agoOne thing I recall from learning C64 BASIC when I was in 6th grade was that, back then, any sort of documentation was difficult to get your hands on. I was given one BASIC programming book as a birthday gift, and it was made clear to me that was all I was gonna get. Technical books were expensive back then, at least for my family they were.
- chclau 4y agoThat it why it was so much a joy to buy magazines. Those magazines with their program listings, the adds, the letters. I remember to this day when I was with my girlfriend for a long time typing long listing of POKEs to hear music from the magnificent SID.
- jimt1234 4y agoNot sure why, but I didn't really know about the magazines back then. All my knowledge came from friends and reverse-engineering others' code (de-blitz!)
- deleted 4y ago[deleted]
- Cerium 4y agoSome of my first programming experience was on a TI-84. I didn't have any documentation for it, so I spent hours looking at the function listing and guessing what arguments that function might take. It worked, I was able to write the programs I wanted.
- svachalek 4y agoIt was, but if you could start building a collection, it didn't take that much to basically have documentation for Everything. All the ROM routines, timings, pin diagrams, BASIC features, etc, etc. Maybe a dozen books, maybe even half that? I don't remember. But at some point you pretty much had everything you'd ever possibly want to know. That was really the last computer I ever had that feeling with. Everything since is just layers and layers of complexity that changes faster than you'll ever get a handle on it and truly understand the whole machine inside out.
- atotic 4y agoSeeing PEEK and POKE two pages into the article made me laugh. I always treated those like black magic, mysterious lines that I got out of a magazine that did cool stuff. I loved the Simons Basic cartridge, that gave me a lot of the PEEK/POKE power wrapped up in new Basic keywords. Sprites were so cool!
- MasterYoda 4y agoThe only thing I knew and needed as a kid was... LOAD “$”,8,1 list run Commondore was good old times :)
- JoeAltmaier 4y agoI remember trying to write something ambitious on a Commodore 64. When faced with BASIC I tried to come up with some way of organizing my design. I really tried. But there was so little there I couldn't get traction and gave up. Thank god for our tools and abstractions today.
- spatten 4y agoIn C64 Basic, "$" declares that a variable is a string, like this: ``` A$ = "Hello World ``` So you say this as "A-string equals Hello World" I still pronounce "$" as string however many years later
- FullyFunctional 4y agoThis is beautifully done. I'll see if I can coax my kids into trying it. However, this gives a lot of credit to Commodore for something that was completely standard at the time on all 8-bit computers (and then some). The real credit belongs to Dartmouth BASIC [1]. Especially when considering the original context (very very limited machines), the genius of the BASIC model (not so much the language) is something to appreciate. Interestingly, John G. Kemeny, one of the two behind it, used to work for Richard Feynman and is one of the "martians" [2] [1] https://en.wikipedia.org/wiki/Dartmouth_BASIC https://en.wikipedia.org/wiki/Dartmouth_BASIC [2] https://en.wikipedia.org/wiki/The_Martians_(scientists) https://en.wikipedia.org/wiki/The_Martians_(scientists)
- y42 4y agoThis makes me sad on a regular base. The C64 was my first computer when I was like 16ish. I spend nights and weeks learning programming with Basic and did some really cool things like a text editor (of course besides playing games like Gianna Sisters or North and South). But I was young and didn't see how important that was for my development. So I never took care of archiving or even backups, ultimatily I just got rid of the discs while moving or cleaning up. I don't even remember. No this old "Brotkasten" is catching dust in the drawer. Nowadays I really miss my early work and take a lot more care when it comes to backups and archiving my work. //EDIT No wait, my first computer was some kind of weird robotron my father brought home some day. This thing really fascinated me, I wasn't able to do much on it, because there was no documentation and of course I had no internet. But I really loved the green letters on the black screen.
- tomcam 4y agoThrilling. I am old but not normally prone to nostalgia. This site gets across the instant gratification one felt with the C64. I started with a Vic20 and soon chafed at the 3.2K (or so) RAM limitation. Obtaining the C64 was a quantum shift. As others have pointed out, the instructional materials were abundant and often good. Tomas Petricek's lovely site is also a model of interactive instruction. When he explains PRINT "HELLO WORLD" he says "To a modern programmer, it is amazing how little it takes to get from booting the machine to printing hello world. " When I wrote my first compiler in the 80s I made sure you could run a program that simple. I am somewhat surprised that only Python and arguably Javascript give you that kind of immediacy. With all the advances in languages it constantly surprises me that there's no universally available language that lets you start out so quickly.
- muziq 4y ago
- lizardactivist 4y agoIIRC, Pirates on the C64 is written mostly in BASIC, with a few machine language routines squeezed in for performance.
- hnthrowaway0328 4y agoI think nowadays the equivalent is to buy an inexpensive handheld PyGame console and write one's own games using Python. It at least teaches a more useful language and shields the internals from the user. As a bonus users get a hang of general game programming process by using a library. I'm thinking about buying one for my best friend's son and teach him PyGame programming. For myself I prefer something more bare metal, such as asm or C game programming. I think there is probably a NON-CARTRIDGE handheld somewhere to quench my thirst but need to find it.
- assetlabel 4y agoHere's a lost way of programming: I heard of someone who typed control characters on the C64 screen that matched 6510 assembly and then ran them from out of the video buffer.