Hi Andreas, Your example just below seems wrong. According to the  motorola doc, P must be a positive value. Did you take this into account in your last patch ? I'll do more tests before eventually posting it, as the current patch seems to work with all the case I tested and with Doug's tests. Did you find a case that don't work ? regards Laurent Le 24/10/2015 00:50, Andreas Grabher a écrit : ```If Nn is -8 and modulo is less than 8 (--> k <= 4, P >= 1) it will decrement r_reg by 8 (r_reg += -8 is same as r_reg -= 8): e.g. Nn = -8, M = 3: --> k = 2 --> blocksize = 2^k = 4 P = Nn / 2^k = -8 / 2^2 = -2 Rn += P * blocksize = -2 * 4 = -8 (jump 2 blocks down) Of course i might be totally wrong. The description in the data sheet is very confusing. I absolutely agree that this needs to be tested. In the meantime i slightly improved the patch to better suit the coding conventions of the DSP part. It seems it consequently avoids using the modulo operator. So my new patch works without it and is also slightly faster. ``` ``` Am 24.10.2015 um 00:25 schrieb laurent.sallafranque@xxxxxxx: ``` ```Hi I haven't got the time to test but at first look i think the patch is wrong. What If i set -8 into Nn ? I Know How to fix this but it Will be in 3 days Regards ----- Mail d'origine ----- De: Douglas Little À: hatari-devel@xxxxxxxxxxxxxxxxxxx Envoyé: Fri, 23 Oct 2015 20:22:12 +0200 (CEST) Objet: Re: [hatari-devel] DSP addressing bug Hi, I'm not very familiar with that part of Hatari so I'm not sure just by looking at the diff (at least not without more study). Laurent will know better. I will say that the exceptional case occurs when Nn is exactly a multiple of the 2^k ringbuffer bound. If it is less, it performs modulo addressing. If greater, the results seem to be undefined i.e. not necessarily modulo. This happens for (Rn)+Nn, (Rn)-Nn *and also (Rn+Nn) i.e. offset only, with no update to addr register.* Best, D On 23 October 2015 at 19:07, Andreas Grabher wrote: ``` ```Laurent and Doug, what do you think about the appended patch? I'm not sure about it, but it might work. Maybe worth to test it? Regards, Andreas Am 23.10.2015 um 13:52 schrieb laurent.sallafranque@xxxxxxx: ``` ```Hi Doug, ``` ```Quick question Laurent - does the patch also work for (Rn)-Nn ``` ```addressing? ``` ```It should ;) But I think I understand precisely the problem now (in hatari, -Nn is ``` ```passed as a negative argument to the function when the addressing mode is (Rn)-Nn, I'll have to rewrite it by adding a sign variable and keeping Nn unchanged). ``` ```Don't expec this fix before tuesday or wednesday (we'll have family at ``` ```home in the next days). ``` ```At least, I see how to fix it definitively now. Regards Laurent ----- Mail original ----- De: "Douglas Little" À: hatari-devel@xxxxxxxxxxxxxxxxxxx Envoyé: Vendredi 23 Octobre 2015 12:20:16 Objet: Re: [hatari-devel] DSP addressing bug Quick question Laurent - does the patch also work for (Rn)-Nn addressing? If I keep my workaround just for this case and remove it for the (Rn)+Nn ``` ```cases the remaining problem seems to go away... ``` ```D On 23 October 2015 at 11:11, Douglas Little < doug694@xxxxxxxxxxxxxx > ``` ```wrote: ``` ``` Yep definitely something is slightly different on real HW. I'm getting ``` ```selectively black pixels in Hatari where they look correct on HW. Previously I was getting a completely destroyed image. ``` ```It's going to take effort to figure out what's going on but I still see ``` ```some kind of problem. I'll try to narrow it down a bit. ``` ``` D. On 23 October 2015 at 10:54, Douglas Little < doug694@xxxxxxxxxxxxxx > ``` ```wrote: ``` ``` Perhaps I spoke too soon. There is something funny still happening - but ``` ```I'll need to do more checks to make sure it's not my fault. I'll update soon when i have more info.... ``` ```Doug. On 23 October 2015 at 10:13, Douglas Little < doug694@xxxxxxxxxxxxxx > ``` ```wrote: ``` ``` It works for me - everything looks good! Thanks :) I'll report if I run into any problems with it but I don't think so. D. On 22 October 2015 at 22:10, Laurent Sallafranque < ``` ```laurent.sallafranque@xxxxxxx > wrote: ``` ``` I've already tested : EKO_systems : still working to the end TERE RA'I ;) : still working to the end Sololuminezcent : still working to the end underscore demo seems to crash now but it also crash with the n-1 ``` ```version of hatari (ie without my patch). ``` ```There's a regression with this demo, it was at least working to the 4rth ``` ```screen before. ``` ```I continue some tests but the patch seems OK to me. Regards Laurent Le 22/10/2015 23:02, Nicolas Pomarède a écrit : Le 22/10/2015 22:57, Douglas Little a écrit : Woo, that was quick. Thanks! If the patch has made it into the repo, I can just collect tomorrow's nightly build and see if that works for me. Sounds like it probably will. Otherwise I'll try a local build tomorrow. Hi, unfortunately, it seems builds at http://antarctica.no/~hatari/ are not ``` ```regularly updated anymore (and it even returns a HTTP 503 error at the moment :( ) ``` ```Nicolas ``` ``` ``` ``` ```