[hatari-devel] DSP bug found (and maybe solved)

[ Thread Index | Date Index | More lists.tuxfamily.org/hatari-devel Archives ]


Hi all,


I've spent the last 2 weeks tracing Audio Fun Machine to find the bug when the equalizer is ON (sound becomes noisy).


I've isolated the bug : it's about Rn + Nn + Mn updating.
An example :
            move    #>0,r0                     ; R0 = 0
            movec    #$01,m0                ; modulo 2
            move    #$02,n0                   ; incrementor = 2

            move    #>1,a
            move    #>1,b
            move    a,x:(r0)+                 ; r0 = 1
            nop
            nop
            move    b,x:(r0)+                 ; r0 = 0  (because of the modulo)
            nop
            nop
            move    (r0)+n0                   ; R0 = 0 (should be 2)
            nop
            nop
            move    a,x:(r0)+                 ; R0 = 1 (should be 3)


I suggest the following fix in the function :
static void dsp_update_rn_modulo(uint32_t numreg, int16_t modifier)

Line 1694 :
replace
    if (abs_modifier>modulo) {
by
    if (abs_modifier>modulo-1) {


In line 1673, modulo is added +1 for buffer boundaries computing.
But I think modulo should be -1 when tested with modifier.

At least, Audio Fun Machine sound becomes good with this patch, but DSP programs should be tested for non regression.
I've tested 2 or 3 of them, but not all of them.

@eero, could you test my patch and tell me if AFM works well for you ?


Regards

Laurent





Mail converted by MHonArc 2.6.19+ http://listengine.tuxfamily.org/