Gameboy Advance SID player

Discussion of development of software for any "obsolete" computer or video game system. See the WSdev wiki and ObscureDev wiki for more information on certain platforms.
Post Reply
mic_
Posts: 922
Joined: Thu Oct 05, 2006 6:29 am

Gameboy Advance SID player

Post by mic_ »

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.
tepples
Posts: 22708
Joined: Sun Sep 19, 2004 11:12 pm
Location: NE Indiana, USA (NTSC)
Contact:

Re: Gameboy Advance SID player

Post by tepples »

Would the 6502-minus-decimal-mode emulator from PocketNES work as well? Or do SIDs actually use decimal mode?
Revenant
Posts: 462
Joined: Sat Apr 25, 2015 1:47 pm
Location: FL

Re: Gameboy Advance SID player

Post by Revenant »

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)
mic_
Posts: 922
Joined: Thu Oct 05, 2006 6:29 am

Re: Gameboy Advance SID player

Post by mic_ »

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.
psycopathicteen
Posts: 3140
Joined: Wed May 19, 2010 6:12 pm

Re: Gameboy Advance SID player

Post by psycopathicteen »

Does this use antialiasing?
mic_
Posts: 922
Joined: Thu Oct 05, 2006 6:29 am

Re: Gameboy Advance SID player

Post by mic_ »

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.
mic_
Posts: 922
Joined: Thu Oct 05, 2006 6:29 am

Re: Gameboy Advance SID player

Post by mic_ »

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).
lidnariq
Posts: 11432
Joined: Sun Apr 13, 2008 11:12 am

Re: Gameboy Advance SID player

Post by lidnariq »

Surely there's some range between 768cy and 840cy per sample?
mic_
Posts: 922
Joined: Thu Oct 05, 2006 6:29 am

Re: Gameboy Advance SID player

Post by mic_ »

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-)
mic_
Posts: 922
Joined: Thu Oct 05, 2006 6:29 am

Re: Gameboy Advance SID player

Post by mic_ »

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.
mic_
Posts: 922
Joined: Thu Oct 05, 2006 6:29 am

Re: Gameboy Advance SID player

Post by mic_ »

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