It is currently Fri Nov 24, 2017 2:00 am

All times are UTC - 7 hours



Forum rules


Related:



Post new topic Reply to topic  [ 4 posts ] 
Author Message
PostPosted: Sun Jan 26, 2014 8:00 pm 
Offline
User avatar

Joined: Sat Jun 27, 2009 11:05 pm
Posts: 713
Location: New Mexico, USA
In apudsp.txt it states the following:
Code:
 V1. Load the current value of the VxSRCN register, if necessary.
 V2. Load the sample pointer (using previously loaded DIR and VxSRCN) if
      necessary.


And in Blargg's snes_spc SPC_DSP.cpp we have:
Code:
inline VOICE_CLOCK( V1 )
{
   m.t_dir_addr = m.t_dir * 0x100 + m.t_srcn * 4;
   m.t_srcn = VREG(v->regs,srcn);
}
inline VOICE_CLOCK( V2 )
{
   // Read sample pointer (ignored if not needed)
   uint8_t const* entry = &m.ram [m.t_dir_addr];

   ...<snip>...

}

I don't understand why Blargg's code calculates the value of t_dir_addr with the pre-updated value of t_srcn. The apudsp.txt doc says "using previously loaded DIR and VxSRCN". I'm not sure about DIR, but the previously loaded value of VxSRCN was the value loaded in voice processing step V1. But that is not the value used in the code.


Top
 Profile  
 
PostPosted: Sun Jan 26, 2014 8:41 pm 
Offline
User avatar

Joined: Mon Sep 27, 2004 8:33 am
Posts: 3715
Location: Central Texas, USA
Anomie's doc is likely incorrect then. He probably just failed to clarify this in the comment about using the previously loaded value. At some point I'll be posting all my DSP tests, some of which test this aspect.

EDIT: I just tried switching the order of those two lines (putting m.t_srcn = VREG(v->regs,srcn); first) and the DSP fails many of the tests.


Top
 Profile  
 
PostPosted: Sun Feb 02, 2014 2:49 am 
Offline
User avatar

Joined: Sat Jun 27, 2009 11:05 pm
Posts: 713
Location: New Mexico, USA
Forgot to reply and say thanks. This was very helpful. I've updated my personal copy of apudsp.txt to reflect this...along with the bazillion other notes I've added. :-P


Top
 Profile  
 
PostPosted: Wed Feb 04, 2015 12:55 am 
Offline
User avatar

Joined: Sat Jun 27, 2009 11:05 pm
Posts: 713
Location: New Mexico, USA
This is a big bump (almost exactly a year to the day actually), but I think it's worth it for anyone else who might need help understanding Anomie's apudsp.txt.

There is a response by Blargg in the thread below that directly relates to this question and explains things really well.

viewtopic.php?f=12&t=12331&p=140559


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

All times are UTC - 7 hours


Who is online

Users browsing this forum: No registered users and 5 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