Update resid-fp to 2.12.0 from libsidplayfp

This commit is contained in:
Jasmine Iwanek
2024-11-27 01:18:06 -05:00
parent de0cd423b9
commit 1e99bf87b2
46 changed files with 1634 additions and 1424 deletions

View File

@@ -18,8 +18,36 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#define INTEGRATOR8580_CPP
#include "Integrator8580.h"
// This is needed when compiling with --disable-inline
namespace reSIDfp
{
int Integrator8580::solve(int vi) const
{
// Make sure we're not in subthreshold mode
assert(vx < nVgt);
// DAC voltages
const unsigned int Vgst = nVgt - vx;
const unsigned int Vgdt = (vi < nVgt) ? nVgt - vi : 0; // triode/saturation mode
const unsigned int Vgst_2 = Vgst * Vgst;
const unsigned int Vgdt_2 = Vgdt * Vgdt;
// DAC current, scaled by (1/m)*2^13*m*2^16*m*2^16*2^-15 = m*2^30
const int n_I_dac = n_dac * (static_cast<int>(Vgst_2 - Vgdt_2) >> 15);
// Change in capacitor charge.
vc += n_I_dac;
// vx = g(vc)
const int tmp = (vc >> 15) + (1 << 15);
assert(tmp < (1 << 16));
vx = fmc.getOpampRev(tmp);
// Return vo.
return vx - (vc >> 14);
}
} // namespace reSIDfp