from Hacker News

Linux on a Commodore 64

by johnwbyrd on 8/26/23, 11:36 PM with 93 comments

  • by johnwbyrd on 8/26/23, 11:36 PM

    Onno Kortman has taken semu, a minimal RISC-V emulator, and cross-compiled it with llvm-mos, an LLVM port to the MOS 6502 processor, in order to run Linux on the Commodore 64. Kortman writes: "The screenshots took VICE a couple hours in 'warp mode' to generate. So, as is, a real C64 should be able to boot Linux within a week or so."
  • by Roark66 on 8/27/23, 7:30 AM

    Very nice, but my first thought was "surely this will not fit in 64k of ram!". And it doesn't. It requires a 16MB REU!

    To explain for the uninitiated how rare this bit of hardware is. The REU available for the c64 back in the day were 256kB and 512kB. These are most commonly built replicas as there are schematics available for them. Sometime in the late 90s there was also an "expansion" for c64 that contained a completely new CPU (superCPU - 65816) that was code compatible with the original and I believe this device could accommodate up to 16mb.

    Later reimplementations based purely on fpga popped up including a REU with 16mb. The original SuperCPU schematic was lost to time. Allegedly fpga based expansions are available to buy for few hundred EUR now, but I don't know anyone that attempted to buy one or has one.

    So, although it is a neat trick(still a cool tech achievement) , saying it runs on c64 is akin to saying I got doom3 running on a 386, but my 386 is actually a pci card in a modern pc...

    If I can't pull my c64 with hardware available back in the day (or hardware one could realistically built back in the day) I'm not sure saying "runs on c64" is correct.

    Coming back to the subject of a REU, why has no one published a schematic for one yet? There are cheap SRAM chips floating on ebay. It should be trivial to put one together. Unfortunately it isn't, because the original (Super Cpu) had two components we need a beefy fpga to emulate. The supercpu itself and it's dma controller which was a custom asic I believe.

    Perhaps as cheap(ER) fpgas or uC with fpga-like functionality become available someone will create an open source "super cpu". As of yet, everyone I ever heard using these, uses emulation. Nothing wrong with that, but I get the most out of my "retro hobby" by running original hardware. Emulation is very useful for dev, but for general use it's a bit "meh" for me.

  • by jhallenworld on 8/27/23, 2:40 AM

    Not Linux related, but I've been trying trying recent (at least to me..) C-64 accessories:

    I've tried the "Kung Fu Flash"- it's a software defined cartridge that is cheap- just a single STM32 and can do pretty much everything. I bought this because I'm trying to duplicate the developer experience I see on "8-bit show and tell"- it can emulate the "super snapshot", but not the REU. It's a really nice way to quickly try a lot of C-64 software and games.

    https://8bithardware.wixsite.com/website/post/kung-fu-flash

    https://github.com/KimJorgensen/KungFuFlash

    I also have an SD2IEC: what I've learned is that it would have been useful to get a variant with an extra DIN socket. It's nice but I was never a fan of C-64's DOS and this reinforces it. To mount a D64 disk image you have to: OPEN1,8,15,"CD:MYIMAGE.D64":CLOSE1... yuck..

    JiffyDOS (replacement ROM for the C-64) improves this (it's faster and includes a permanent DOS wedge), I bought one- it's on the way. I'm curious to try it with the real 1541 drive.

    What got me started on this recently is the "Penultimate +2" cartridge for the VIC-20:

    https://www.youtube.com/watch?v=eNGyneXHKJQ

    In this case, I basically bought a VIC-20 just to try out the cartridge.

  • by wang_li on 8/27/23, 12:51 AM

    A demonstration of Turing equivalency. Any Turing complete computer can do what any other Turing complete computer can do if you don’t care about time.
  • by Decabytes on 8/27/23, 1:03 AM

    This begs the question. What is the oldest hardware that can boot modern Linux but still be used as a daily driver?
  • by mgkimsal on 8/27/23, 12:26 AM

    Is this different from Lunix?

    https://en.wikipedia.org/wiki/LUnix

  • by sedatk on 8/27/23, 3:15 AM

    This isn't Linux running on C64 per se. This is C64 emulating a RISC-V environment on which Linux runs.

    Still impressive of course, but semantics matter :)

  • by layer8 on 8/27/23, 9:35 AM

    I wonder, if instead if requiring REU, it could work by using a few dozen floppy discs as RAM, prompting the user to swap discs as needed.

    I’d be interested in watching a time-lapse video of that on real hardware, if someone has a couple of months/years to spare. ;)

  • by chungy on 8/27/23, 12:17 AM

    Once you add more RAM to a Commodore 64, is it still a Commodore 64?
  • by ryukoposting on 8/27/23, 2:00 AM

    I recently came into possession of a fully-functioning TRS-80 Model 4, and I fantasize regularly about putting some vaguely Unix-esque thing on it. The fantasy continues.
  • by peter_d_sherman on 8/27/23, 6:19 AM

    Minimal FORTHs (https://en.wikipedia.org/wiki/Forth_(programming_language)) can run on an unexpanded VIC-20 (5K) or even early TRS-80 Model 1 (4K) -- with room and functionality to spare...

    On the VIC-20, you even get a few colors!

  • by brazzy on 8/27/23, 7:41 AM

    That 16MiB memory requirement makes this rather disappointing, given that you can run Linux on machines with only 4 MiB of RAM: https://tldp.org/HOWTO/4mb-Laptops.html#toc3
  • by userbinator on 8/27/23, 6:59 AM

    Now someone needs to do the same with a ZX spectrum ;-)

    As others have mentioned, a 6502 is very poorly suited to C-style code, but a Z80 should be somewhat better with that.

  • by vlasky on 8/27/23, 4:32 AM

    How long does a kernel recompile take?
  • by doctor_radium on 8/27/23, 4:38 AM

    But will it impact the sales of GEOS?
  • by aappleby on 8/27/23, 5:39 PM

    Gah, this reminds me that I need to finish my "Risc-v on a Gameboy" lolproject.
  • by snvzz on 8/27/23, 4:34 AM

    RISC-V is inevitable.
  • by erwincoumans on 8/27/23, 1:07 AM

    What's the BogoMips?
  • by sys_64738 on 8/27/23, 1:13 AM

    Run Neofetch!
  • by dusted on 8/26/23, 11:50 PM

    So, I like Linux and I love my C64, but.. Linux are for computers too primitive to come with their own kernel and.... the C64 comes with a kernel and shell right from the factory :P