nesdev.com
http://forums.nesdev.com/

Gameboy Advance SID player
http://forums.nesdev.com/viewtopic.php?f=23&t=14930
Page 1 of 1

Author:  mic_ [ Wed Oct 12, 2016 12:55 pm ]
Post subject:  Gameboy Advance SID player

YouTube video

I felt like doing some ARM assembly coding, so I decided to write a SID player for the GBA.
Porting the 6510 emulator I wrote for the SuperH-2 was pretty easy since it uses a lot of macros and the ARM and SuperH-2 have the same number of registers, but for the 6581 I had to start from scratch. It took a while to sort out all the bugs (the most serious ones anyway - it's still buggy), but now I've reached the point where it kind of works.

Author:  tepples [ Wed Oct 12, 2016 3:24 pm ]
Post subject:  Re: Gameboy Advance SID player

Would the 6502-minus-decimal-mode emulator from PocketNES work as well? Or do SIDs actually use decimal mode?

Author:  Revenant [ Wed Oct 12, 2016 4:35 pm ]
Post subject:  Re: Gameboy Advance SID player

Sounds pretty good so far! Definitely a big improvement over the GBA SID player(s?) I heard back when GBA homebrew was still a brand new thing.

(Do I win anything for recognizing the tune? :P)

Author:  mic_ [ Wed Oct 12, 2016 10:44 pm ]
Post subject:  Re: Gameboy Advance SID player

Quote:
Would the 6502-minus-decimal-mode emulator from PocketNES work as well?

It would probably work. The question is if it would gain me anything. Unless PocketNES' 6502 emulator does dynamic recompilation (and does it well) I don't really see how it could be much faster than what I've already got.
Another aspect of it is that, if my measurements are to be trusted, the 6510 emulation only takes up about 6% of the GBA's CPU time. The 6581 (SID) emulation is what consumes the bulk of the time.

Revenant: you win a virtual tip of the hat.

Author:  psycopathicteen [ Thu Oct 13, 2016 6:30 pm ]
Post subject:  Re: Gameboy Advance SID player

Does this use antialiasing?

Author:  mic_ [ Thu Oct 13, 2016 10:48 pm ]
Post subject:  Re: Gameboy Advance SID player

Nope, samples are generated at 19973 Hz without any filtering. Though, AFAIK the GBA itself resamples the audio to 32768 Hz before outputting it, and I don't know the details of how it does the resampling.

Author:  mic_ [ Fri Oct 14, 2016 2:56 pm ]
Post subject:  Re: Gameboy Advance SID player

Alright, I've got an actual ROM release of my SID player now: download

And here's a video of it running on my Gameboy Player + Gamecube.

I've been working on optimizing the 6581 emulation, and tried upping the sample rate 21845 Hz, but I started getting buffer underflows in some songs so I decided to keep the old sample rate (the average processing time is fairly low, it's the worst-case times that are causing the problems).

Author:  lidnariq [ Fri Oct 14, 2016 2:58 pm ]
Post subject:  Re: Gameboy Advance SID player

Surely there's some range between 768cy and 840cy per sample?

Author:  mic_ [ Fri Oct 14, 2016 4:01 pm ]
Post subject:  Re: Gameboy Advance SID player

Yeah. After looking at it some more I don't think it's a performance issue though. I did some measurements on the lastest code by reading the VCOUNT register, and the worst-case numbers I got was a total of ~51% of the GBA's CPU time spent on emulating the 6510 and 6581.

I tried increasing the sample rate all the way up to 32768 Hz, and it runs just fine 8-)

Author:  mic_ [ Sat Oct 15, 2016 3:49 am ]
Post subject:  Re: Gameboy Advance SID player

The source code is now available on github. I noticed that the Nag Champa tune crashes after a while (oops), so I guess I still have a bug somewhere that I'm going to have to look into.

Author:  mic_ [ Sat Oct 15, 2016 11:19 am ]
Post subject:  Re: Gameboy Advance SID player

Here's a new ROM where I've fixed the bugs I mentioned in my previous post, and which generates samples at 32768 Hz.

Page 1 of 1 All times are UTC - 7 hours
Powered by phpBB® Forum Software © phpBB Group
http://www.phpbb.com/