Re: [hatari-devel] DSP addressing bug |
[ Thread Index | Date Index | More lists.tuxfamily.org/hatari-devel Archives ]
After some testing i came to the conclusion, that the appended patch should be correct. I'm not sure if the function currently in Hatari works in all cases. This is the modified function: static void dsp_update_rn_modulo(Uint32 numreg, Sint16 modifier) { Uint16 bufsize, bufmask, modulo, abs_modifier; Uint32 r_reg, lobound, hibound; r_reg = dsp_core.registers[DSP_REG_R0+numreg]|0x10000; modulo = dsp_core.registers[DSP_REG_M0+numreg]+1; bufsize = 1; while (bufsize < modulo) { bufsize <<= 1; } bufmask = bufsize - 1; lobound = r_reg - (r_reg&bufmask); hibound = lobound + modulo - 1; if (modifier<0) { abs_modifier = -modifier; } else { abs_modifier = modifier; } if (abs_modifier>modulo) { if (abs_modifier&bufmask) { fprintf(stderr,"Dsp: Modulo addressing result unpredictable\n"); } else { r_reg += modifier; } } else { r_reg += modifier; if (r_reg>hibound) { r_reg -= modulo; } else if (r_reg<lobound) { r_reg += modulo; } } dsp_core.registers[DSP_REG_R0+numreg] = r_reg & BITMASK(16); } |
Attachment:
dsp_modulo_patch.diff
Description: Binary data
Am 29.10.2015 um 20:49 schrieb Andreas Grabher <andreas.grabher@xxxxxxxxxxxx>:
|
Mail converted by MHonArc 2.6.19+ | http://listengine.tuxfamily.org/ |