It is currently Sat Oct 21, 2017 10:52 am

All times are UTC - 7 hours





Post new topic Reply to topic  [ 11 posts ] 
Author Message
PostPosted: Wed Oct 12, 2016 12:55 pm 
Offline

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


Top
 Profile  
 
PostPosted: Wed Oct 12, 2016 3:24 pm 
Offline

Joined: Sun Sep 19, 2004 11:12 pm
Posts: 19114
Location: NE Indiana, USA (NTSC)
Would the 6502-minus-decimal-mode emulator from PocketNES work as well? Or do SIDs actually use decimal mode?


Top
 Profile  
 
PostPosted: Wed Oct 12, 2016 4:35 pm 
Offline

Joined: Sat Apr 25, 2015 1:47 pm
Posts: 328
Location: FL
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)


Top
 Profile  
 
PostPosted: Wed Oct 12, 2016 10:44 pm 
Offline

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


Top
 Profile  
 
PostPosted: Thu Oct 13, 2016 6:30 pm 
Offline

Joined: Wed May 19, 2010 6:12 pm
Posts: 2295
Does this use antialiasing?


Top
 Profile  
 
PostPosted: Thu Oct 13, 2016 10:48 pm 
Offline

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


Top
 Profile  
 
PostPosted: Fri Oct 14, 2016 2:56 pm 
Offline

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


Top
 Profile  
 
PostPosted: Fri Oct 14, 2016 2:58 pm 
Offline

Joined: Sun Apr 13, 2008 11:12 am
Posts: 6289
Location: Seattle
Surely there's some range between 768cy and 840cy per sample?


Top
 Profile  
 
PostPosted: Fri Oct 14, 2016 4:01 pm 
Offline

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


Top
 Profile  
 
PostPosted: Sat Oct 15, 2016 3:49 am 
Offline

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


Top
 Profile  
 
PostPosted: Sat Oct 15, 2016 11:19 am 
Offline

Joined: Thu Oct 05, 2006 6:29 am
Posts: 911
Here's a new ROM where I've fixed the bugs I mentioned in my previous post, and which generates samples at 32768 Hz.


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 11 posts ] 

All times are UTC - 7 hours


Who is online

Users browsing this forum: No registered users and 3 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB® Forum Software © phpBB Group