C64 SID emulation

Topics related to the API, programming discussions & questions, coding tips, bugs, etc. should go here.
User avatar
danboid
Posts: 1935
Joined: Sun Jun 14, 2020 12:14 am

Re: C64 SID emulation

Post by danboid »

I've not tried it yet but here's the asm source to a PC Engine SID player. The zip file includes a .PCE that should run under PC engine emulators. I'm sure most of you know the PC Engine / Turbgrafx was an 8 bit console with a 7 Mhz CPU.

From its README:

- An actual Commodore-64 SID file fully running on the Turbografx!
- C-64 "RAM" is mapped to $0000-$3FFF, $8000-$9FFF (Turbo has only 8K RAM.)
- ADSR emulation at 60hz (~16ms increments)
- Duty cycle emulation for the pulsewidth waveform
- Simple SID filter emulation on all channels
- Dynamic left-right panning engine working (but disabled)
- Up to 260ms echo engine working (but limited to bass boost for this SID.)


https://www.chrismcovell.com/creations.html

https://www.chrismcovell.com/data/PCE_SID_Player.zip
User avatar
D3thAdd3r
Posts: 3221
Joined: Wed Apr 29, 2009 10:00 am
Location: Minneapolis, United States

Re: C64 SID emulation

Post by D3thAdd3r »

I say go for it. At worst you gain experience and know more about how it works. Hopefully the best happens, and reasonable compatibility is achieved even if filters are unlikely.

The more I reimagine this fun idea, the more I like the precalculated(better emulation with filters) done offline, and rendered to PCM for UzeAmp to play. It doesn't make sense for a game to try to emulate SID, when the native player is doing the same if not more(minus filters, but unlimited virtual channels within the PCM).

If someone made a dedicated SID player for Uzebox, I would rightly be blown away. But if someone made a library of the best C64 music, and added a basic compression "library file" containing multiple songs in 1 file to UzeAmp, it would also be a cool achievement.

@danboid
What is your favorite SID song? Gotta be the "Commando Title Screen" no?
User avatar
danboid
Posts: 1935
Joined: Sun Jun 14, 2020 12:14 am

Re: C64 SID emulation

Post by danboid »

I've never done any assembly and I wouldn't know where to start with a SID player. I realise it wouldn't be possible to have it as a new sound engine alongside a game if someone did pull it off but I'd be fine with that. I'll continue to update this thread with stuff that might assist someone with a SID player for when someone bites.

Rob's Commando is one of the all time highlights of chiptunes of course. Some of my other faves are the Sanxion loader, Master of Magic and the C64 soundtrack for Ghouls and Ghosts is stunning.

https://www.youtube.com/watch?v=It7yJh-NwPY

https://www.youtube.com/watch?v=wz36JWHTk-A
User avatar
danboid
Posts: 1935
Joined: Sun Jun 14, 2020 12:14 am

Re: C64 SID emulation

Post by danboid »

I've tried Chris' PCE SID player under retroarch w/ the beetle PCE core but I get the error:

Failed to open /home/dan/Downloads/SID/SOUND.srm: No such file or directory

I have emailed the author to ask him if it is emulator friendly and if he knows of any other SID players for non-C64 8 bit consoles or computers. I'd be surprised if anyone has pulled it off on something slower than a PC Engine. It'll be impressive if it does actually work.
User avatar
D3thAdd3r
Posts: 3221
Joined: Wed Apr 29, 2009 10:00 am
Location: Minneapolis, United States

Re: C64 SID emulation

Post by D3thAdd3r »

Here is a working zip with an emulator and that ROM, on Ubuntu at least. I was too lazy to compile anything, I ran this Windows version under wine and it worked perfect.

Sounds better than I imagined.
Attachments
pce.zip
(666.09 KiB) Downloaded 50 times
User avatar
danboid
Posts: 1935
Joined: Sun Jun 14, 2020 12:14 am

Re: C64 SID emulation

Post by danboid »

Thanks DA!

Yes, as you say TurboEngine runs fine under wine and I'm impressed by the quality of the SID player so lets archive the source here just in case Wayback Machine has missed it.
PCE_SID_Player.zip
(191.82 KiB) Downloaded 52 times
The author said I should try another emulator and he also noted that there is a SID player for the SNES too:

https://www.pouet.net/prod.php?which=2462

I don't see any source for the SNES SID player but it sounds like the PCE player is decent enough
User avatar
danboid
Posts: 1935
Joined: Sun Jun 14, 2020 12:14 am

Re: C64 SID emulation

Post by danboid »

I wonder how the Uzebox MCU compares to the PCE CPU? The PCE has a bit more RAM + dedicated VRAM although I think DA said he could see SPI RAM being usable for something like this.

I have emailed the author to ask what license he picked for the SID player, if any. I also asked if he was aware of the Uzebox and I noted how the Uzebox case reminds me of the PCE. I see the Uzebox case as a cross between the PC Engine and the Famicom, with an Amiga 500 power LED.
CunningFellow
Posts: 1445
Joined: Mon Feb 11, 2013 8:08 am
Location: Brisbane, Australia

Re: C64 SID emulation

Post by CunningFellow »

The PC-Engine was just an 8 bit machine. It was a super fast 6502 variant. Same CPU the C64, Apple and BBC used. It was about 4x faster than the original 6502.

So the Uzebox is a much faster and better ISA than the PC-Engine. However as you know it has to spend most its time making the TV picture.

So comes back to what everyone has said. Uzebox could piss it in as long as the visible area of the screen was reduced.
User avatar
danboid
Posts: 1935
Joined: Sun Jun 14, 2020 12:14 am

Re: C64 SID emulation

Post by danboid »

The author of the PCE SID player writes:

"Hi, I looked into the Uzebox, and it looks like it has its own CPU, right? That means to get a SID player running, you'll have to program an entire 6502 CPU emulator, in addition to a SID sound chip simulator. The PCE only works to play SID songs relatively easily because its CPU is a 6502 variant and thus can run 6502 code natively."
User avatar
D3thAdd3r
Posts: 3221
Joined: Wed Apr 29, 2009 10:00 am
Location: Minneapolis, United States

Re: C64 SID emulation

Post by D3thAdd3r »

Definitely need a 6502 core to do it "the true way", though many are available in C so it wouldn't be impossible to do. A faster AVR asm 6502 core I saw somewhere even. The alternative is to precalculate the raw timed SID commands(that the 6502 calculates/sends), and eliminate the 6502 from the real time demand. One could prebake these commands via 6502 emulation prior to starting playback even.
Post Reply