Live data from Hacker News

Linux on a Commodore 64

github.com

51–60 of 97 posts

Re: Linux on a Commodore 64

#51

This begs the question. What is the oldest hardware that can boot modern Linux but still be used as a daily driver?

Definitely not modern Linux, when I got Slackware 2.0 in 1995's Summer, I owned a Pentium 75Mhz, with 8MB RAM, Trident card capable of 1024x768 (X could only handle 800x600 on it), IDE CD-ROM and HDD.

Re: Linux on a Commodore 64

#53
post #8
post #4

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

The Commodore 64 doesn't come with a mere kernel, it comes with a mighty KERNAL https://en.wikipedia.org/wiki/KERNAL > The KERNAL was known as kernel[6] inside of Commodore since the PET days, but in 1980 Robert Russell misspelled the word as kernal in his notebooks. When Commodore technical writers Neil Harris and Andy Finkel collected Russell's notes and used them as the basis for the VIC-20 programmer's manual, th…

> Jim Butterfield

I had a 6502 machine language book of his as a kid. I figured out in my head what I thought I wanted to do with the various instructions, then wrote out on graph paper the (decimal) number for the op or it’s args, then transcribed the whole affair into memory manually via POKEs. Good times.

Re: Linux on a Commodore 64

#54
post #42

This begs the question. What is the oldest hardware that can boot modern Linux but still be used as a daily driver?

Assuming "daily driver" requires a modern web browser running modern web productivity apps I'd put the minimum at a Core 2 Duo with 4 GB memory. It wouldn't exactly be snappy but with a bit of patience you shouldn't be limited by the hardware. Throw in a GPU with hardware video decoding and you might even be able to watch YouTube in above-potato quality.

I've got a core 2 duo with 2GB RAM that I used for around 6 hours yesterday to write an application.

Only slightly noticeable waiting times when I accessed some sites, but it worked and the application works too.

Re: Linux on a Commodore 64

#55

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."

Oh wow! This bootstrapping method reminds me of yet another Linux-on-an-8-bit-micro project ( https://dmitry.gr/?r=05.Projects&proj=07.%20Linux%20on%208bi... ), which used an 8-bit AVR with an ARMv5 emulator. But, this takes the cake in terms of geek coolness.

That's exactly what it reminded me of too; there's been plenty of HN discussion about it: https://news.ycombinator.com/item?id=19762928

Re: Linux on a Commodore 64

#56
post #8

Earlier quoted context omitted.

The Commodore 64 doesn't come with a mere kernel, it comes with a mighty KERNAL https://en.wikipedia.org/wiki/KERNAL > The KERNAL was known as kernel[6] inside of Commodore since the PET days, but in 1980 Robert Russell misspelled the word as kernal in his notebooks. When Commodore technical writers Neil Harris and Andy Finkel collected Russell's notes and used them as the basis for the VIC-20 programmer's manual, th…

The mighty KERNAL is how us mere mortals can JSR FFD2. (I think that's right)

> JSR [$]FFD2. (I think that's right)

Yes, that is the "print char in A and inc screen pos" in the lookup table for the actual subroutine.

Re: Linux on a Commodore 64

#58
post #9

Once you add more RAM to a Commodore 64, is it still a Commodore 64?

Expanding from Johnwbyrd's nearby:

-- Commodore sold a Ram Expansion Unit named "1764" to bring the C64 to 256kb of RAM;

-- it was possible to use the REU for the C128 named "1750" to bring the C64 to 512kb of RAM;

-- and it is possible to expand on that to have a 2MB REU for the C64 - see https://www.neperos.com/article/rlut8ce90fbb7701

You can have two megabytes on the C64, pretty "legally".

Re: Linux on a Commodore 64

#59
post #27

Earlier quoted context omitted.

Says you. llvm-mos generates surprisingly efficient 6502 code given its age and maturity. Don't take my word for it, try some experiments with it on godbolt.

Sure. Here's a couple of functions to iterate over an array of "Ball" objects, as you might do in a Breakout-style game that has a multi-ball powerup. I didn't do anything to make it particularly 6502-amenable; it's how I'd write it for a modern machine, probably. Even compiled with -O2: as expected, the code is slow and enormous - a single addition compiles to something like 30 instructions. [0] https://godbolt.org/…

Seems like your problem is more with the venerable 6502 itself rather than the compiler. Most of that assembly code is spent calculating the offsets inside the Ball struct, which must be done at 16 bits of resolution in every case. The compiler's using the indirect indexed (zero page address with Y offset) 6502 addressing mode to get at all the fields in your struct. It has placed all the variables in zero page, so no instruction is more than two bytes long; additionally, the code in question is entirely linear, with no JSRs or other subroutines. Note in particular how it efficiently uses DEY/INY pairs of one byte instructions to get at low and high bytes of 16-bit memory. Hand-written assembly might be speedier, but not by much and still deal with all the corner cases that your generated code does. "While writing Apple BASIC for a 6502 microprocessor I repeatedly encountered a variant of Murphy's Law. Briefly stated, any routine operating on 16 bit data will require at least twice the code that it should." -Steve Wozniak

Re: Linux on a Commodore 64

#60
post #44
post #41

Earlier quoted context omitted.

Why would it let smoke out? I doubt a C64 has any power management. So whether it idles or boots Linux via a couple of emulation layers, the thermal load will be exactly the same.

I know there can be issues with thermal saturation on a heatsink design-- it was expected not just to generate N watts of heat, but to only do so for M hours. Can you expect to leave a real 64 on for days or weeks and it will stay up? I wonder if stores that had them as demo units when it was a relevant product, for example, power-cycled them regularly. I know from experience if you block the bottom intake vents on a…

Can you expect to leave a real 64 on for days or weeks and it will stay up?

Yes. These early computers found their way into various embedded control applications too, and I suspect there's quite a few C64s still in operation that way; they would've been replaced long ago if they weren't stable. An article occasionally appears when someone discovers this:

https://news.ycombinator.com/item?id=12604414

Post reply on HN