mist-devel / mist-board

Core sources and tools for the MIST board
444 stars 81 forks source link

C64 SID problems. #18

Open sorgelig opened 8 years ago

sorgelig commented 8 years ago

The SID code in C64 core doesn't look accurate. Sound in some tunes looks strange or messed in some cases. For example, Intro with dancing girl (again dancing girl, haha!) in Hollywood Poker Pro is very messed. And even tunes primarily considered OK, sound strange. Turrican II Title sound is too jerky...

One problem in SID code is noise generator. The second is total filter absence in code.

I've found another, unfortunately unfinished, SID FPGA project in fpgaarcade forum. That project is based on chip decaping according to author. I've made it work with C64 core, it also has issues, but what is working, looks correct. It seems like one channel is not working, and i didn't find the source of problem. But noise does look correct. It also has filters implementation, but according to author the filter part hasn't finished yet. I've imported noise generator to existing SID code from fpgaarcade project. Noise is better, but not enough to be acceptable.

Does anyone now other FPGA SID implementations? Or may be someone can help to fix the problems by mixing these 2 SID implementations?

Newsdee commented 8 years ago

The SID of the TC64 core sounds exactly like the real thing to my ears. While I'm not a musician the difference is pretty clear, for both SID models.

Unfortunately it isn't open-source... On Jan 14, 2016 7:00 PM, "sorgelig" notifications@github.com wrote:

The SID code in C64 core doesn't look accurate Sound in some tunes looks strange or messed in some cases For example, Intro with dancing girl (again dancing girl, haha!) in Hollywood Poker Pro is very messed And even tunes primarily considered OK, sound strange Turrican II Title sound is too jerky

One problem in SID code is noise generator The second is total filter absence in code

I've found another, unfortunately unfinished, SID FPGA project in fpgaarcade http://wwwfpgaarcadecom/punbb/viewtopicphp?id=256 forum That project is based on chip decaping according to author I've made it work with C64 core, it also has issues, but what is working, looks correct It seems like one channel is not working, and i didn't find the source of problem But noise does look correct It also has filters implementation, but according to author the filter part hasn't finished yet I've imported noise generator to existing SID code from fpgaarcade project Noise is better, but not enough to be acceptable

Does anyone now other FPGA SID implementations? Or may be someone can help to fix the problems by mixing these 2 SID implementations?

— Reply to this email directly or view it on GitHub https://github.com/mist-devel/mist-board/issues/18.

sorgelig commented 8 years ago

Not open source is useless here. And by the way, i've read on some German forum about TC64's SID, that is has many unfinished or non-working parts in code. Some tunes can sound ok, but some are not.

Did you try Hollywood Poker Pro Intro on TC64? https://www.youtube.com/watch?v=mn4pGa5nIR4

sorgelig commented 8 years ago

May be i will tell crazy thought, but what if.... make some core with high enough CPU clock and run VICE inside it? Because VICE looks very polished and mature comparing to FPGA64. And it looks like nobody works on code anymore. Perhaps can make CPU core for SID-only emulation, but reSID uses large tables and i'm afraid won't fit into FPGA RAM since FPGA64 already occupies 2/3 of available RAM.

harbaum commented 8 years ago

Does vice run fast and accurate enough on the amiga 500 or the Atari ST? That's about the fastest we have on the mist today.

It might be possible but instead of writing a whole c64 in hdl you'd write a complete system able to run the vice emulator. I'd assume that might even be more work.

harbaum commented 8 years ago

There is another c64 core which is also named fpga64: http://fpga64.blogspot.de

I once was in contact with him but haven't received in answer for over a year. That core is lacking floppy support which we now have. It would imho make much more sense to get in touch with him again.

sorgelig commented 8 years ago

In the mean time i've got more ideas. What about this one in FPGA? http://www.swinkels.tvtom.pl/swinsid/ It seems provides full replacement for SID in simple AVR chip. I've checked opencores and it has couple AVR models. Atmega8515 has only 8kb ROM and 512b RAM.

sorgelig commented 8 years ago

About that FPGA64 project: i've found the sources used in project here https://svn.pacedev.net/repos/pace/sw/src/component/sound/sid/ It uses the same SID model as MIST. Found this info from following video: https://www.youtube.com/watch?v=4bhIrPKqFII

harbaum commented 8 years ago

Ah, indeed. Too bad. But the rest seems pretty cool and may be worth a look, anyway.

robinsonb5 commented 8 years ago

On the subject of systems fast enough to run VICE, the f32c MIPS/RISCV core is interesting - in MIPS configuration the CPU is significantly smaller than the TG68 but it's ridiculously fast - it can turn in about 180DMIPS @ 100MHz.

sorgelig commented 8 years ago

Hmm. Tried to register on fpgaarcade forum but got rejection (and it seems manual admin approval). It seems not everyone allowed to be there. Just wanted to ask in SID topic about status...

rkrajnc commented 8 years ago

Be careful with code from fpgaarcade.com - AFAIKat least some code there is only allowed to be used on the fpga arcade board, so it's not really open-source, or at least not GPL - compatible.

As for running VICE on MiST, my guess is that this emulator is way too complex, so it would be really hard to run it full speed on any CPU architecture.

BTW, I have a Pentium 200 system with 133MHz SDRAM, which I guess is surely above the maximum performance one could get from a Cyclone III FPGA, I'll try to run Vice on it and see if it works normally.

sorgelig commented 8 years ago

SID code doesn't limit usage on fpgaarcade board only. No GPL mention but free to use and redistribute. Anyway, the code is also not working well. Actually both original SID code and from fpgarcade have problem with noise simulation or something relative to it. It looks like AVR simulator is the best way to go. The only problem, is source code absence of latest nano-SwinSID firmware for ATmega88. They have source code for older version which is much older. Also, AVR module is for ATmega103 and need to be tweaked for Atmega88 (because source code of firmware is absent). I'm not sure if my experience will be enough to handle this implementation.

Takasa commented 8 years ago

Hi. rkrajnc - There are some cores by other authors under different licensing. Some of the board specific libraries are under "only use here" license as they are written specifically for the replay board. All my stuff, including the cores, is fully open source. If in doubt read the license or ask a question. This will be further relaxed shortly.

sorgelig, I have no idea why you got rejected, please email and I'll fix it. The forum is getting a huge amount of spammer registrations and this was a necessary step. I posted some comments apologizing for this and asking anybody who did not receive a mail to contact me.

I intend to look at the SID filters again shortly. /Mike

rkrajnc commented 8 years ago

Mike: OK.

sorgelig: maybe it is a better idea to check the SwinSID code and see if we can fix the current SID implementation, instead of replacing it with a ATMega core and related code - it just seems simpler to do.

I can check the noise channel implementation - I guess this is a simple LFSR pseudo-random noise generator, so all that is required is figuring out what kind of polynomial is used, and the initial state.

sorgelig commented 8 years ago

@fpgaaracde Mike, glad to see you here! My mailbox name is very suspicious, right :) It's because i've made it long time ago just for registering on boards and eventually receive the spam. When i registered on github i didn't expect to participate in development, but it turned out i'm in. My mailbox is pour.garbage_at_gmail.com I've tried to mail to admin of board without success.

That's good, you will continue your SID library. Additional to Noise, there is something strange with channels. Hollywood Poker Pro(HPP) Intro looks like one channel is missing. I have your SID library integrated into C64 code. If you want, i can send you the code for testing. It seems HPP Intro uses some special tricks in music and it's good for testing.

@rkrajnc yes, it's LFSR, and the code is seems correct, but it looks like not working. In original code the beginning of HPP Intro is always noisy, in Mike's library the noise sounds not like noise. At the same time in hacker's intro before original intro i hear good drums with noise.

I've learned how to implement true RNG using LFSR with cell ring oscillator while working on Menu core. So, may be it can be used in SID.

Takasa commented 8 years ago

@Sorgelig, The LSFR noise generator, taps and mux is correct (as far as we can tell) from the layout. There are some additional complexity with feedback when multiple waveforms are turned on at the same time which isn't quite right. Something else is going wrong, almost certainly in the "analog" stage. Please send any changes you make back so I can merge into our SVN.

Which mail address did you sent to, I received nothing (which is worrying). Please register again and I'll check the logs. /Mike

On 18/01/2016 08:13, sorgelig wrote:

@fpgaaracde https://github.com/fpgaaracde Mike, glad to see you here! My mailbox name is very suspicious, right :) It's because i've made it long time ago just for registering on boards and eventually receive the spam. When i registered on github i didn't expect to participate in development, but it turned out i'm in. My mailbox is pour.garbage_at_gmail.com I've tried to mail to admin of board without success.

That's good, you will continue your SID library. Additional to Noise, there is something strange with channels. Hollywood Poker Pro(HPP) Intro looks like one channel is missing. I have your SID library integrated into C64 code. If you want, i can send you the code for testing. It seems HPP Intro uses some special tricks in music and it's good for testing.

@rkrajnc https://github.com/rkrajnc yes, it's LFSR, and the code is seems correct, but it looks like not working. In original code the beginning of HPP Intro is always noisy, in Mike's library the noise sounds not like noise. At the same time in hacker's intro before original intro i hear good drums with noise.

I've learned how to implement true RNG using LFSR with cell ring oscillator while working on Menu core. So, may be it can be used in SID.

— Reply to this email directly or view it on GitHub https://github.com/mist-devel/mist-board/issues/18#issuecomment-172447686.


This email has been checked for viruses by Avast antivirus software. https://www.avast.com/antivirus

sorgelig commented 8 years ago

@fpgaaracde I've just registered of forum finally. I've used other e-mail. My changes aren't meaningful for SID code itself. I've just changed the code so, interface works at 32MHz while internal modules like voices, filters at original 1MHz frequency. I can give you the whole C64 source code with your SID module integrated, if it can help you to debug. Or may be just to check if i did it correctly. Too bad, I cannot simply publish the source code on the github.

Takasa commented 8 years ago

Hi,

@fpgaaracde https://github.com/fpgaaracde

I've just registered of forum finally. I've used other e-mail.

Great.

My changes aren't meaningful for SID code itself. I've just changed the code so, interface works at 32MHz while internal modules like voices, filters at original 1MHz frequency. I can give you the whole C64 source code with your SID module integrated, if it can help you to debug. Or may be just to check if i did it correctly.

Too bad, I cannot simply publish the source code on the github.

You can as long as the header is in place. Take the files as is, and add a line at the top, something like

"modifed by XXX, original at svn.fpgaarcade.com"

and your changes. I'll merge back any fixes. I do this when I take GPL code into my public SVN etc, although I double check with the author.

Why wouldn't clocking the code at 32MHz with a 1M clock enable work with the original code?


This email has been checked for viruses by Avast antivirus software. https://www.avast.com/antivirus

sorgelig commented 8 years ago

Why don't you want to upload repository to github?

About clocking: for 32MHz i have to create 1MHz EN strobe. I've tried to make it but failed. So, to make task easier i've just made 2 clocks separate. Especially because of sound problems i wanted to minimize incompatibilities in clocking.

Takasa commented 8 years ago

This has been discussed on the forum. Several reasons, the main one is we have dedicated servers running SVN that we control so there is no need. The other is there is some code which is not public yet, either because we haven't clarified the license or it cannot be released (some of the ASIC stuff). Mirroring between dev and public SVN works for now for me.

On 18/01/2016 13:45, sorgelig wrote:

Why don't you want to upload repository to github?

— Reply to this email directly or view it on GitHub https://github.com/mist-devel/mist-board/issues/18#issuecomment-172518778.


This email has been checked for viruses by Avast antivirus software. https://www.avast.com/antivirus