6 ms·
Bare Metal Emulation on the Raspberry Pi – Commodore 64
- omnibrain 3y agoIf you don't need a video showing the hardware and discussing all the details, you can find the emulator here: https://accentual.com/bmc64/ https://accentual.com/bmc64/
- dang 3y agoThat's probably a better (or at least more canonical) URL for the project than youtube, so I've put it at the top. Thanks! The submitted URL was https://www.youtube.com/watch?v=53wHr415LPU https://www.youtube.com/watch?v=53wHr415LPU and people will probably want to look at both.
- indigodaddy 3y agoThere is a back and forth in the YT comments where one commenter insists that Linux OS is still running under the hood… So the Linux OS never boots, correct? It’s booting directly from the c64 bin so to speak? Feels very Justine Tunneyish almost..
- xcv123 3y agoCorrect. It is booting from the BMC64 image.
- indigodaddy 3y agoAnd it doesn’t look like there is any Linux or supporting Linux elements embedded into that image I don’t think? (From what I saw in the page dang posted/updated)
- cmrdporcupine 3y agoCorrect, there is no linux.
- xcv123 3y agoIt is open source: https://github.com/randyrossi/bmc64 https://github.com/randyrossi/bmc64 No Linux kernel there https://github.com/randyrossi/bmc64/blob/master/kernel.cpp https://github.com/randyrossi/bmc64/blob/master/kernel.cpp
- indigodaddy 3y agoThat is pretty friggin awesome. And even more awesome that you can just copy over whatever d64s to the image that I assume are easily accessible in the c64 environment once booted. I was considering trying something like Combian64 but this seems way tighter. Edit ah too bad actually was looking for something that would work with my pi400 but I guess bmc64 only works up to pi3. If anyone could port bmc64 to pi4 or make it work that would be amazing (unfortunately not I as I don’t have the technical know-how)
- rusk 3y agoUnfortunate the Pi 4 is more like a PC with a few layers of turtles between the user and the hardware. Up until then the pi were more like a microcontroller with a UI layer atop. You could peel that back and get at the raw goodies. The newer pi is vastly more complex and requires all these dark processes and proprietary firmware blobs beneath the OS to make it go.
- indigodaddy 3y agoAh interesting thanks for the info and context
- lproven 3y ago> Up until then the pi were more like a microcontroller with a UI layer atop. This is not my area of expertise but from my understanding and reading, I would dispute that, strongly. The Pi 1, 2 & 3 all run the ThreadX RTOS on the GPU as their "firmware" and the Arm core(s) are started by ThreadX: https://en.wikipedia.org/wiki/ThreadX https://en.wikipedia.org/wiki/ThreadX Now ThreadX is owned by Microsoft but it wasn't when the Pi was designed and built. I love your turtles allusion but the Pi never was a simple or clean (or FOSS) design. The Pi Pico is, relatively speaking, but it's not really a Pi.
- lsaferite 3y ago> Feels very Justine Tunneyish almost.. I'm not sure I get this reference
- indigodaddy 3y agohttps://github.com/jart/blink https://github.com/jart/blink
- cmrdporcupine 3y agoThis is my good friend Randy's project. I don't believe he's working on it anymore, as his main project right now is his FPGA re-implementation of the VIC-II chip. http://accentual.com/vicii-kawari/ http://accentual.com/vicii-kawari/ I like to think of BMC64 as a "unikernel" C64 emulator. Effectively it's VICE forked to run on the Circle library. The theoretical advantages are a) fast boot times b) low input device and display latency.
- ryandrake 3y agoVery cool project! I've been getting more and more interested in "bare metal" projects, and one day am just going to dive right in. There's something weirdly unsatisfying about building a Raspberry Pi appliance that boots to Linux just to do a Thing, when it could just boot to the Thing.
- rusk 3y agoSounds like you want ESP! Check out ESPhome and Tasmota
- guenthert 3y ago> There's something weirdly unsatisfying about building a Raspberry Pi appliance that boots to Linux just to do a Thing, when it could just boot to the Thing. Well, I think here the distinction between Linux the kernel and Linux the OS (may RMS forgive me) is important. I agree that booting a Linux OS to run a single application seems overkill and adds little other than maintenance burden and boot time. The Linux kernel however, particularly when stripped to the minimum needed, boots fast (<1s is possible), shields from the complications of the hardware which aren't of interest and allows some portability (even the various PI models are quite different under the hood). I'd think attempting to replace the Linux kernel just adds burden for little or no gain.
- Cieric 3y agoIf you were to do it all from scratch I could agree, but there are projects to allow baremetal code to interact with the different hardware on the Pi (works on a bunch of different models.) https://github.com/rsta2/circle https://github.com/rsta2/circle
- LeoPanthera 3y agoSee also, PiTubeDirect[1], which runs on a Raspberry Pi which you have plugged into the second processor port of a BBC Micro[2], and turns the Pi into emulator for a number of different processors, notably an arbitrarily fast 6502, a Z80, or an 80286. [1]: https://github.com/hoglet67/PiTubeDirect https://github.com/hoglet67/PiTubeDirect [2]: https://en.wikipedia.org/wiki/BBC_Micro_expansion_unit#Second_Processors https://en.wikipedia.org/wiki/BBC_Micro_expansion_unit#Secon...
- actionfromafar 3y agoHey… it could run ARM code.
- LeoPanthera 3y agoIt can, it does.
- actionfromafar 3y agoI mean, these Z80 cards used the host computer as IO. Instead of emulating a CPU on the raspi, one could run native raspi code and use the host computer for IO... basically make the ancient host computer a graphics and sound card for a modern CPU.
- NikkiA 3y agoIt can and does, there is the facility to upload native rasp-pi code and have it execute natively, not even pretending to be an ARM1.
- jug 3y agoIn a similar vein for those looking for more: ZX Spectrum https://zxmini.speccy.org/en/index.html https://zxmini.speccy.org/en/index.html Gameboy https://github.com/angeris/CS107E-GB-Emulator https://github.com/angeris/CS107E-GB-Emulator 8086 / 80186 https://github.com/jhhoward/Faux86 https://github.com/jhhoward/Faux86 Dragon32 https://github.com/eyalabraham/Dragon32-RPi-Bare-Metal https://github.com/eyalabraham/Dragon32-RPi-Bare-Metal Those are all I know. :) I dream of a bare metal Amiga!
- atcalan 3y agoNo love for TI or trash 80?
- lproven 3y agoI used the TI-994A. It was rubbish. Horribly constrained by a design that was cost-cut into uselessness. But you know what, do a bare-metal Pi emulation of the Geneve 9640, which is what the TI99 could and should have grown up into, and I will start paying attention. https://www.old-computers.com/museum/computer.asp?st=1&c=1208 https://www.old-computers.com/museum/computer.asp?st=1&c=120...
- pjmlp 3y agoThe ultimate bare metal Amiga, https://retrogamecoders.com/mister-fpga-amiga/ https://retrogamecoders.com/mister-fpga-amiga/
- rusk 3y agoWas just going to say … you’d need some sort of FPGA style arrangement
- indigodaddy 3y agoMaybe PiMiga will hold you over..
- DrNosferatu 3y agoDoes it use a bare metal API like Circle? Are there other APIs like this for other platforms? Or you can use a bare metal compiling environment like Zig or Cosmopolitan?
- mtnygard 3y agoIt uses Circle.
- DCKing 3y agoOne of the key advantages of FPGA retro game emulation is its low overhead processing input and audio. This is because the FPGA emulates hardware directly and doesn't have to go through OS abstraction layers built to accomodate multitasking. I wonder if bare metal emulators can achieve similar latency for software emulation.
- cmrdporcupine 3y agoyes and no. no or little OS abstraction, but still there's layers in the way, and it's still sequential in places where an FPGA could be parallel, etc. a Pi etc has a huge advantage in raw clock speed. FPGAs are pretty slow. at least the ones that you and i can afford
- DCKing 3y agoWhat layers do you mean that would remain? I wouldn't expect the experience to be identical nor quite as accurate [1], but if audio and input latency could be made indistinguishable between a Raspberry Pi and a Mister FPGA that would already be quite a significant feat :) [1] FPGA emulation is not intrinsically more accurate, but most Mister cores are considered to be more accurate than popular Retropie cores.
- cmrdporcupine 3y agoFramebuffer is one such layer. The output from the emulator goes into a framebuffer before being rendered. It's not going to "race the beam" the same way a FGPA'd VIC-II would. Same with USB input stack, though I guess MiST/Mister has that too. Same with SID emulation, which would render into audio buffer samples of certain size (and therefore latency), whereas a hardware or FPGA SID could drive the DAC directly.
- rusk 3y agoThis is an interesting dichotomy: analogue vs digital - but I think there’s a third leg to it which is DSP. When your floor is a 1 MHz 6502 and you have a DSP running at many many multiples of that, you can mimic analogue circuits almost perfectly, with identical latency, but better reliability, serviceability, and cheaper parts. The key thing to remember here is that the 2040 is more like a DSP emulating the signals than a regular pi emulating the system. Something as simple as a c64 it should be possible to emulate with DSP indistinguishable from discrete circuits. The key latencies you describe (frame buffer, audio) aren’t really an issue in the DSP scenario. Also, non linear components like the SID are going to be harder to reimplement in discrete circuits and in fact I’d expect DSP would do better. DSP wins every time in all domains. Problem is you need to have a much more fine-grained knowledge of the physical underpinnings of the system, not just the system itself.
- mlongval 3y agoThis is a really nice project. I built one on a RPi 3b+ a couple years ago when the project started. I got to chat with Randi Rossi about attaching a C64 keyboard to it via his adapter. He is a really cool and talented guy. Very down to earth (for such a genius). It’s too bad that there isn’t someone else who could take up the project. I have a dream of seeing his Kawarii extensions to the VicII implemented in the emulator. Wow what a blast that would be!
- cmrdporcupine 3y agoI've known and worked with and been friends with Randy since 1999 and agree with your assessment: cool, down to earth, and talented. But also very modest, so he'd probably be flustered by these comments here so I will make a point of not making him aware of them ;-) Anyways, I think you could probably make a go of the Kawari extensions in emulation yourself. And to be clear, the changes you'd want would be in VICE, not BMC64 -- which is just a fork of VICE. I have read the VICE source before and it's fairly straightforward what's going on there. And in fact, I recall part of Randy's test harness for Kawari has been to run the same program through both VICE and Kawari and compare output. So by implementing in VICE you'd be helping extend the test harness.
- raverbashing 3y agoThe 'bare metal' part is interesting, but I'd assume dealing with things like video or audio directly on the HW, especially in modern hardware is a PITA A very bare-bones linux or BSD should add minimum overhead and make things much easier
- renewedrebecca 3y agoThe Circle library handles all of that... Remember, this is just for Raspberry Pi hardware, so it's not like they have to support that many different types of hardware.
- ghusbands 3y agoBetween two and four frames of lag even on composite, and five or six frames of audio lag. Is that the best we can expect from a Raspberry Pi?
- lproven 3y agoMaybe it's just me but I'd be much more interested to see a bare-metal C65 emulator. The C65 was a far more interesting computer than the C64 or the C128 IMHO, and if all you want to do is play games then the C65 can run C64 stuff in its C64 mode anyway. There are existing C65 emulators -- MAME supports it and there's the standalone Hi65: https://devilmaster.altervista.org/hi65.html https://devilmaster.altervista.org/hi65.html There seem to have been discussions about incorporating C65 into VICE, which BMC64 is based on, but it doesn't seem to have happened yet. That would be, for me, much cooler and more fun to experiment with.
- scruss 3y agoThing about the C65 is … what do you emulate? Since it only ever got to prototype stages, the original C65s that are out there run a bewildering array of slightly buggy systems. All have quite different capabilities. Was it supposed to have a UI? We'll never know, and you won't get a unified answer from the ex-Commodore folks
- lproven 3y agoThis is apparently a FAQ when it comes to C65 emulation, and as such, the developer of Hi65 has answered it in quite a few places already. There aren't _that_ many -- few leaked, so it's not a big array of kit. The latest ROM would be preferable, and possibly fixing any outstanding bugs in it. Another alternative is simply to emulate the Mega65. https://mega65.org/ https://mega65.org/ This could be the chance for a rebirth for the machine and thus set the standard rather than trying to follow it.