[hatari-devel] I'm lucky ;) K.prg is working

npomarede at corp.free.fr npomarede at corp.free.fr
Tue Feb 23 18:21:20 CET 2010


On Tue, 23 Feb 2010, Laurent Sallafranque wrote:

> I've returned to the original code, and I've tried this :
>
>   if (regs.spcflags) {
>       do_specialties();
> //        return;
>   }
>
>
> It doesn't work. (And I think I can't use "F12" or close Hatari's window, it 
> doesn't react anymore).

That's why I said I would have a look this evening, this part of the code 
is very sensitive :)

>
> I've kept this patch and I've then activated : "Patch Timer D" and rebooted.
>
> K.PRG works, but sound is sometimes crashing completely and becomes correct 
> again after 1-2 seconds.
>

> I think there's another problem : some cpu instruction can take up to 258 
> cycles (perhaps more).
> Many takes more than 50 cycles.
>
> But at 44Khz, the sound interrupt needs 80 cycles.
> That's probably why sound becomes noisy sometimes (There's a lost of 2 
> samples in the worst case).

Even on a real ST, the sound interrupt can't interrupt an instruction 
while it's being executed, the interrupt will be delayed after the current 
cpu intruction.

So this can't be the reason why the sound would be good on a real falcon 
and not in hatari, except if some instructions don't have the correct 
cycles count under hatari when compared to a real falcon.

That's why I suggested you to print the OpcodeFamily to see what is this 
instruction that takes so many cycles (I think it's 1 instruction + 1 
exception in fact)

I don't understand your number to transform 44kHz into 80 cycles. What is
the formula ?


>
> Example with a GT2 player :
> 25 Mhz : 81 Cycles      decimal : 31495
> 32 Mhz : 64 Cycles      decimal : 6710
>
> Regards,
>
> Laurent
>
>
>
>
>
> Laurent Sallafranque a écrit :
>> Perhaps just removing the return ?
>> 
>> Laurent
>> 
>> 
>> npomarede at corp.free.fr a écrit :
>> 
>>> On Tue, 23 Feb 2010, Laurent Sallafranque wrote:
>>>
>>> 
>>>> OK, I'll try all these tests tonight.
>>>> But just a last question :
>>>> 
>>>> Why shouldn't we execute some DSP code if there was an exception or 
>>>> interrupt ?
>>>> (the return after do_specialties ())
>>>> 
>>> You're right, I didn't pay attention to this, but this is obviously wrong 
>>> to return without running the dsp part.
>>> 
>>> But moving dsp code block is not completly correct, because at that point 
>>> (before do_specialites) "cycles" doesn't take into account the number of 
>>> cycles generated by the exception.
>>> 
>>> I will try to post a patch this evening that solves both cases.
>>> 
>>> Nicolas
>>> 
>>>
>>> 
>> 
>> _______________________________________________
>> hatari-devel mailing list
>> hatari-devel at lists.berlios.de
>> https://lists.berlios.de/mailman/listinfo/hatari-devel
>> 
>>
>> 
>
>


More information about the hatari-devel mailing list