BMC64, a bare metal C64 emulator for the Raspberry Pi

Discussion in 'Offtopic Discussions' started by rSl, Feb 7, 2019.

  1. rSl

    rSl **** COMMODORE 64 PYRA V2 **** 4GB RAM SYSTEM

    Dec 10, 2005
    just found this little gem. i'm not using my rpi actively right now, but it sounds promising...

    "a bare metal port of VICE (x64) for the Raspberry Pi called BMC64. You get true 50hz/60hz smooth scrolling (no horizontal tearing!), low input to audio/video latency and better audio/video synchronization.

    What do you mean by bare metal?

    There is no operating system! An O/S like Linux adds layers of abstraction between the application (VICE) and the privileged kernel code that has access to hardware. That adds latency in processing events. User space programs can't get notified directly from interrupts, for example. The interrupt has to be serviced by the kernel, into user space, into your program (at the mercy of the scheduler) before they can get processed. For sound production, the user space program must fill buffers to deliver to a sound driver in the kernel before it can pass it on to the hardware. With Combian/PiLizard and Chameleon installations, you are effectively installing a full blown linux distribution (1.5Gb image files!).

    With BMC64, VICE -IS- the kernel and has direct access to the hardware. As soon as you power on the device, it goes straight into the emulator. The entire kernel is ~2MB."

    announcement and code here
    FBnil, pmprog, Eight Bit and 2 others like this.
  2. LineOf7s

    LineOf7s Active Member

    May 23, 2006
    Brisbane, Australia
    Thanks for that. I've got a spare 16GB card lying around I might have to try this with the next time I'm feeling all C64-y. :)
    rSl likes this.
  3. levi

    levi Still fresh, damnit!

    Oct 6, 2008
    Somewhere off the coast of the EU
    Very interesting. Technically speaking, I posit that there is still an OS; just the OS is VICE and the C64 OS, because you can't run the C64 OS written in 6502 machine code on an ARM host, despite the history between those two chips. Plus stuff like video rastering and driving the speaker was presumably done using motorola chips on the C64, while this has to implement that in software. But that's the benefit of using VICE to do all of that, I guess, cos it handles all of that stuff already. You just need to write enough code to either shim enough stuff to implement a framebuffer for vice to render against and stuff to pretend to be a USB keyboard module, or alternatively, tweak vice until it handles all that in the one big codebase.

    But yeah, not running a multiuser, multiprocessing, multithreading system when FUSE probably doesn't need any of that should help simplify timing problems, which is the kind of thing that announcement is talking about in the main. It does kind of mean you have to burn an SD card for a 2MB kernel/emulator plus your set of C64 tapes. Maybe you could do something with uboot to install it alongside a linux kernel and filesystem.

    Also, I'll just mention you can get almost all of those theoretical benefits by running RISC OS on your Pi and running VICE on that. I've no idea off the top of my head what the current situation is with a RISC OS port of VICE, but it was certainly done in the past. And I don't know how that performs compared to this, but it does mean you're not implementing multithreading, and the multitasking is entirely cooperative, so as long as your code doesn't go out of its way to implement it, it just stops happening until you quit the emulator. There's still a slight potential lag due to having to fill audio buffers, because the audio system on RISC OS is implemented by modules which latch on to timer interrupts, but that applied to all RISC OS software, and I never noticed problematic audio lags even on a 8MHz ARM2 chip. I'm pretty sure all of RISC OS plus VICE would come in at less than 10MB also.
    rSl and ClockworkCoder like this.

Share This Page