Onno Kortman has taken semu (https://github.com/sysprog21/semu), a minimal RISC-V emulator, and cross-compiled it with llvm-mos (https://llvm-mos.org/wiki/Welcome), an LLVM port to the MOS 6502 processor, in order to run Linux on the Commodore 64 with REU. 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."
https://github.com/onnokort/semu-c64
Click the image for animation.
Linux now running on the 6502
Re: Linux now running on the 6502
that is really impressive!
1200% Speed of a 1MHz 6502 with a 20MHz 65816 co-processor works out to a 12MHz 6502 with a 240 MHz 65816.
just a tiny bit too much for a modern 10-20MHz 65816 based system to handle on it's own.
but calling the emulator "minimal" seems a bit... deceptive.
as besides the base ISA it also has the MUL/DIV and Atomic extensions, plus an MMU and multiple privilege levels.
there is technically no reason to have the MMU at all, as Linux doesn't technically require it (as seen by this hackaday post), which would save some performance.
but i do believe you still need the different privilege levels, though if you could get rid of those as well it would of course run even better.
and if you have the code at that point you might be able to use a compiler directly to the 65816 like Calypsi C, though i've tried to compile an older version of MINIX with it once and it had some internal errors and just gave up. so i doubt it would fare better with a Linux kernel.
oh well, the dream of having an actual OS running on a 65816 continues to be a dream
1200% Speed of a 1MHz 6502 with a 20MHz 65816 co-processor works out to a 12MHz 6502 with a 240 MHz 65816.
just a tiny bit too much for a modern 10-20MHz 65816 based system to handle on it's own.
but calling the emulator "minimal" seems a bit... deceptive.
as besides the base ISA it also has the MUL/DIV and Atomic extensions, plus an MMU and multiple privilege levels.
there is technically no reason to have the MMU at all, as Linux doesn't technically require it (as seen by this hackaday post), which would save some performance.
but i do believe you still need the different privilege levels, though if you could get rid of those as well it would of course run even better.
and if you have the code at that point you might be able to use a compiler directly to the 65816 like Calypsi C, though i've tried to compile an older version of MINIX with it once and it had some internal errors and just gave up. so i doubt it would fare better with a Linux kernel.
oh well, the dream of having an actual OS running on a 65816 continues to be a dream
Re: Linux now running on the 6502
Wonderful!
Re: Linux now running on the 6502
Proxy wrote:
oh well, the dream of having an actual OS running on a 65816 continues to be a dream
Acorn did it way back with a port of their Acorn MOS in their Communicator, then Apple did their thing on the //gs ...
... Fast forward to a year or 2 back and I have my RubyOS'816 going - which is a command-line sort of thing that supports multi-tasking running on my '816 board at 16Mhz - all written in BCPL....
Under which I wrote a RISC-V 32IM emulator (in BCPL) which runs at about 2000 RV instructions/sec, so not going to win any speed records, but if I added the bare minimal MMU support then could it run Linux? Sure - it's a little RAM limited right now though (Has about 350KB free) but in a larger memory system then yes - but as above, slowly...
So it's a good academic/fun exercise but not really usable...
Cheers,
-Gordon
--
Gordon Henderson.
See my Ruby 6502 and 65816 SBC projects here: https://projects.drogon.net/ruby/
Gordon Henderson.
See my Ruby 6502 and 65816 SBC projects here: https://projects.drogon.net/ruby/
Re: Linux now running on the 6502
drogon wrote:
What's your definition of an actual OS?
drivers would be IMO the most important part as they shift the hardware dependent parts of code away from the OS and user programs.
sadly implementing drivers is really damn difficult and while i want to try myself at making an OS with driver support, i'm still in the "writing down all my ideas and concepts to solve weird edge cases before even writing a single line of code" phase of the project, which is very difficult to break out of.
drogon wrote:
Acorn did it way back with a port of their Acorn MOS in their Communicator, then Apple did their thing on the //gs ...
i have been sort of thinking about porting something like GEOS, which seems similar enough to GS/OS, except GEOS has source code. but both are graphical OSes which would be amazing to have, but also seem more error prone compared to simple terminal based OSes.
drogon wrote:
... Fast forward to a year or 2 back and I have my RubyOS'816 going - which is a command-line sort of thing that supports multi-tasking running on my '816 board at 16Mhz - all written in BCPL....
drogon wrote:
Under which I wrote a RISC-V 32IM emulator (in BCPL) which runs at about 2000 RV instructions/sec, so not going to win any speed records, but if I added the bare minimal MMU support then could it run Linux? Sure - it's a little RAM limited right now though (Has about 350KB free) but in a larger memory system then yes - but as above, slowly...
So it's a good academic/fun exercise but not really usable...
So it's a good academic/fun exercise but not really usable...
if i had an actual C compiler for my SW32VM i could try stuff like this myself. it would likely run as slowly as a RISC-V emulator, but atleast instructions are only 16-bits wide instead of 32-bits like on RISC-V.... but i don't know if that makes up for much in terms of performance, something to test i guess.
- BigDumbDinosaur
- Posts: 9425
- Joined: 28 May 2009
- Location: Midwestern USA (JB Pritzker’s dystopia)
- Contact:
Re: Linux now running on the 6502
Proxy wrote:
oh well, the dream of having an actual OS running on a 65816 continues to be a dream
x86? We ain't got no x86. We don't NEED no stinking x86!
- commodorejohn
- Posts: 299
- Joined: 21 Jan 2016
- Location: Placerville, CA
- Contact:
Re: Linux now running on the 6502
Clearly, that was but a shared hallucination.
Re: Linux now running on the 6502
yea yea, i forgot the Apple IIgs existed :p
- BigDumbDinosaur
- Posts: 9425
- Joined: 28 May 2009
- Location: Midwestern USA (JB Pritzker’s dystopia)
- Contact:
Re: Linux now running on the 6502
Proxy wrote:
yea yea, i forgot the Apple IIgs existed :p
I suspect most of the present-day employees at Apple don’t know it existed as well. Their horizons likely only extend back to the genesis of the iPhone.
x86? We ain't got no x86. We don't NEED no stinking x86!
Re: Linux now running on the 6502
Someone has set up a livestream of Linux booting in real time on an actual C64: https://www.youtube.com/watch?v=g-36d07DfgI
EDIT: he's giving up at 12 hours. It will require approximately a week to boot Linux.
EDIT: he's giving up at 12 hours. It will require approximately a week to boot Linux.