Programming the C64 with Visual Studio Code
retrogamecoders.com
retrogamecoders.com
Funnily enough I'd been thinking that it's about time I tried (again, as an older person) to write a game or a demo for the old 64.
It's absolutely amazing what people are able to get out of these 40+ year old machines now, and I love that there's still a vibrant scene.
In addition to the tools specified in the article, I would also recommend "retro debugger", it's an amazing tool for single stepping through code and seeing what's going on, even letting you follow the raster down the screen to see what code is executing on given scaliness.
Also, there are some really good youtubers out there helping to demystify how various games/demos work.. Martin Piper comes to mind as a good example.
Kids these days[0] will never know the "pleasure" of spending hours typing in some cheesy BASIC game only to have to track down any number of syntax errors!
[0] Get off my lawn!
your lawn may stay.
I have similar experiences and sentiments myself. One difference is I was into Apple and Atari computers, but that does not seem to matter all that much.
As a younger person, I did demos and explored the tech plenty without actually building finished applications and or games.
Learned a ton! And had major league fun. Great times filled with bits of understanding I draw on all the time.
And YES! Good grief, the pixels are dancing in ways nobody would have predicted back then.
When I hop on the machines today I find them simpler than I remember and fun to program.
Dragon's Lair. DRAGON'S fucking LAIR. On TI-99/4A. The original laserdisc FMV version, albeit heavily bitcrushed, on a 16-bit home computer from 1981.
https://m.youtube.com/watch?v=Drame-4ufso&pp=ygUEa2F6ZQ%3D%3...
I guess that's less of a feature and more of a necessity? Actually, this was one of the questions on my mind when I started reading the article. If you remember how those old BASIC dialects worked, you basically decided the line numbers for each line by yourself. The common strategy was to increment by 10, then you had some space to insert additional lines if needed without having to renumber everything (including the destinations of GOTOs and GOSUBs). Subroutines got line numbers in the 1000+ range so they didn't interfere with your main program (example here: https://www.c64-wiki.com/wiki/GOSUB). Of course this system would be extremely confusing in an IDE that shows the actual line numbers of the source code by default.
But what if you had an IDE with convenient/native editing support for BASIC line numbers? It could auto-number on pressing enter, and it could have refactoring/renumbering support so that you can't miss a GOTO somewhere. But you'd always see and edit plain BASIC code. It feels like that might be fun.
After watching one particularly insane demo [1] I decided that I need to run them on my own machine for full experience. The question is what hardware is necessary to run them. After a little research it seems that something like a Kung Fu Flash cardridge and an SD card is all that I need to put on my Christmas wish list. Can anyone with more insight tell me if this is the right way to go?
If you want to get fancy you could go for something like an Ultimate II+ and a usb key, which will get you a bunch of extra functionally like network connectivity, extra SID support, pretty solid compatibility, REU emulation etc (but UII+ will also cost a lot more).
Given you've got a real 1541, maybe you could just copy files/disk images across to the real thing if KFF doesn't work for a particular program I guess?
That said, the U2+ really lives up to the name and really is the most featureful device - everying else is a compromise.
Besides as I tried as a child and all the magic is hidden behind POKE/PEEK commands, the basic itself is unlike Apple II basic or DOS basic. And with all the peek/pokes it implies going on the assembly level.
I did go on the assembly level for x86 when I was 14 and never regretted it. One of the top coder ppl that I knew started x86 assembly when he was 10-12 and only got into the Java bandwagon when he got in university, meanwhile mixing C and Asm.
I have many other reasons to believe such knowledge is not too hard for children to understand.
* way fewer registers to play with (understatement)
* You want to mul/div? lol...
* Logical Shift Left? Why do you want to do that?
that's all I've come up against after a couple of hours last night, I'm sure there are a load more "problems" I'll face.
People did use BASIC to teach to children back in the day, but IMHO python and even damn JS is much more suitable for this challenge. I really find little benefit from revisiting C64 BASIC in 2024. That was my point.
The 'special sauce' is that the assembler and emulators compiled to WASM and directly integrated into the extension (e.g. the emulator is running in a VSCode tab, everything is properly sandboxed):
https://marketplace.visualstudio.com/items?itemName=floooh.v...
...and it even works in the VSCode browser version, e.g. you can go here and press 'dot' to start into VSCode:
https://github.com/floooh/kcide-sample-kc854
It *is* really quite amazing how productive 8-bit assembly coding feels with modern tooling (e.g. when you have a tight edit-build-debug loop, and having a debugger that lets you inspect the state of the entire hardware, not just CPU registers).
Here's the accompanying blog post: https://floooh.github.io/2023/12/31/vscode-wasm-wasi.html
I grew up programming the 8-bit Atari and it was such a great time to experience. Information was scarce without internet, so magazines and word-of-mouth was so important. Once you collected enough information, you could pretty much hold a mental model of the entire machine in your head, and the only limitations were the number of cycles you had per second or the effort you were willing to put in. I firmly believe this is how I developed the mindset of stepping outside of the problem and readily looking for out-of-the-box solutions that pays dividends to this day.
Programming was a mix of BASIC and machine language routines (not even assembly as you hand-assembled to machine bytes) similar to how someone might use Python with C calls but at lower levels of both. Later on I tried compiled languages like Pascal but it ran like a dog, not tuned for the slow floppy or memory constraints of these machines. Getting a macro assembler was next-level, where you could write everything to be as fast or small as possible. Self-modifying code for wasn't only common practice, it was quite necessary for performance.
Other great pastimes were reverse-engineering games and copy protection in an arms-race. Most were pretty simple and it was always exciting to see completely new techniques or super-complicated multi-pass self-modifying or otherwise obfuscated code.
The filesystem on the floppy disks were also easily understood with sector chaining and a free sector bitmap, so you could write low-level routines like undelete or a defragger. Modifying the floppy drive with custom sector sequencing and RPM tuning could improve timings to get higher throughput and finding that you can add SRAM to buffer an entire track really sped things up. The simplest and cheapest thing was to punch a hole in floppy disks and write to the other side (of a single-sided floppy).
Having this level of understanding made you believe that you could do pretty much anything and everything (just not always fast enough) and makes you program without boundaries except the hardware. Even then it was simple enough to modify parts of the hardware like ROMs or extend it with helpers plugged into the bus or PIO (parallel I/O joystick) ports much like the GPIO on a Raspberry Pi.
The graphics system on the Atari was really something else, with 'display lists' of data that defined memory addresses and display modes (character or raster) that could be defined for each (character or raster) row, along with color palette lookup tables that you could modify to change all the colors using those values. Even the serial SIO daisy chain on the Atari was the basis of what is now how USB enumeration and command/reply works.
Shout-out to Bill Budge's Pinball Construction Set (PCS) originally for the Apple ][ and also on Atari. Of course being a kid I mostly made video games and tools for making video games like sprite editors, character/tileset editors, font editors, and level editors. PCS blew my mind and later got me into making programs that build applications, following the likes of Visual Basic (but running on OS/2 PM).
Some of my favorite bits of The 8 Bit Guy's channel involve when he explains how the NES and SNES controllers work, and to demonstrate he goes "I wrote a little program on my C64 to poll the NES controller through the user port..." and proceeds to run it and what do you know, the C64 can read NES controller input, it just needs to be taught how.
I'm still a bit miffed about him dremeling out the screws on that rare IBM prototype, but he's still done some really cool stuff.