Bare Metal Emulation on the Raspberry Pi – Commodore 64
accentual.com
accentual.com
ZX Spectrum https://zxmini.speccy.org/en/index.html
Gameboy https://github.com/angeris/CS107E-GB-Emulator
8086 / 80186 https://github.com/jhhoward/Faux86
Dragon32 https://github.com/eyalabraham/Dragon32-RPi-Bare-Metal
Those are all I know. :) I dream of a bare metal Amiga!
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=120...
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.
The submitted URL was https://www.youtube.com/watch?v=53wHr415LPU and people will probably want to look at both.
[1]: https://github.com/hoglet67/PiTubeDirect
[2]: https://en.wikipedia.org/wiki/BBC_Micro_expansion_unit#Secon...
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.
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!
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.
I wonder if bare metal emulators can achieve similar latency for software emulation.
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
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.
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.
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.
Why do you need more?
When you get into higher spec machines, esp from the 90s, FPGA starts to not be the best choice $$ per clock.
If you make a keyboard that can send signals fast-clocked over wire to PCI interface card and use polling in the driver you can go as fast as you want. A microsecond poll is not a burden for the CPU core.
It’s usually all about the latencies involved in getting graphics onto the screen after responding to the input.
Even an FPGA-based ‘emulator’ or real retro hardware with the fanciest low-latency upscaler won’t feel truly responsive if connected to an LCD TV that adds 60-100ms of latency (yes, some are really that bad, especially if not in ‘game mode’)
We didn't design modern stacks to handle lowest latencies possible. Because everything is a tradeoff.
Take a look at audio I/O on normal PC in 2000s. Although input digitizing and output de-digitizing were always fast enough, the "DSP" (moving data to userspace, processing, and out) was slow. Because in software design it was given that millisecond latencies aren't a thing, we used a lot of locks and copying around to ensure the system works correctly for average use which isn't realtime IO. However when someone desired realtime IO they enhanced the drivers and/or the audio software stack.
That approach worked because there were no issues in electronics, so to speak. With gaming you have slow USB input and slow HDMI/whatever output.
In my view that is peripheral issue and not architecture issue, although you can also say it is a platform issue. The question is not that straightforward.
Now if they just would have made multiprocessor C64s so that one could have been dedicated to that tight loop ...
But (as mentioned in reply above) good Ethernet cards have way less inherent I/O latency than USB input device<->HDMI screen chain.
So, I see the solution in a PCIx graphics card that can generate VGA signal and take PS/2 input via poll mode drivers. If you connect "real" peripherals to it you can go low-latency, if you connect HDMI/USB stuff via adapters you'll have arbitrary latency.
There are existing C65 emulators -- MAME supports it and there's the standalone Hi65: 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.
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
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.
This could be the chance for a rebirth for the machine and thus set the standard rather than trying to follow it.
A very bare-bones linux or BSD should add minimum overhead and make things much easier
So the Linux OS never boots, correct? It’s booting directly from the c64 bin so to speak? Feels very Justine Tunneyish almost..
https://github.com/randyrossi/bmc64
No Linux kernel there
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
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.
It has more flexibility in what it boots from and so on, but ThreadX and so on are still involved.
I was told that the Pi 5 is significantly different, but not the 4. Are you perhaps mixing them up?
I'm not sure I get this reference
Or you can use a bare metal compiling environment like Zig or Cosmopolitan?