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

Laurent Sallafranque laurent.sallafranque at free.fr
Thu Feb 25 10:06:29 CET 2010


Hello,

After some more tests, I arrive to this conclusion : K.prg is not 
related to a cycles timing problem but to a do_specialties() problem.

Just to help, I've added the different tests I realized with some comments.

K.PRG uses the Graoumpf tracker code to play a GT2 module (on the screen 
where we have the crash).
Graoumpf Tracker uses a special level 6 interrupt from DSP to COMBEL in 
real falcon, MFP in hatari.

Extract of MFP code :

/**
 * Check 'pending' registers to see if any MFP interrupts need servicing.
 * Request interrupt if necessary.
 * @return true if at least one MFP interrupt was allowed, else return 
false.
 */
bool MFP_CheckPendingInterrupts(void)
{
    int    InterruptPossible;

    /* Handle Falcon DSP interrupt. Note: This interrupt is not wired to
     * the MFP on a real Falcon, we just handle it with the SPCFLAG_MFP
     * to avoid taking care of another special flag in the CPU core! */
    if (bDspHostInterruptPending && regs.intmask < 6)
    {
        M68000_Exception(IoMem_ReadByte(0xffa203)*4, 
M68000_EXC_SRC_INT_DSP);
        bDspHostInterruptPending = false;
        return true;
    }


Now the tests :

TEST 1 :

I've returned to version N-1 (before latest Nicolas' patch). K.PRG 
doesn't run.

    if (regs.spcflags) {
        if (do_specialties ())
            return;
    }

    /* Run DSP 56k code if necessary */
    if (bDspEnabled) {
        DSP_Run( cycles );
    }


TEST 2 :

If I invert the 2 blocks, it runs well :

    /* Run DSP 56k code if necessary */
    if (bDspEnabled) {
        DSP_Run( cycles );
    }

    if (regs.spcflags) {
        if (do_specialties ())
            return;
    }



TEST 3 :

If I save cycles before calling (do_specialties(), K.PRG doesn't run.

    save_cycles = cycles;

    if (regs.spcflags) {
        if (do_specialties ())
            return;
    }

    /* Run DSP 56k code if necessary */
    if (bDspEnabled) {
        DSP_Run( save_cycles );
    }



TEST 4 :

I've added a printf before the return.
Code never goes to the return, except when I quit Hatari.
The problem is not here.

     if (regs.spcflags) {
        if (do_specialties ()) {
            fprintf(stderr, "RETURN \n");
            return;
        }
    }


TEST 5 :

I've added a test if cycles != save_cycles.
It never happens.

===> do_specialties() doesn't change the cycles value.

    save_cycles = cycles;

    if (regs.spcflags) {
        if (do_specialties ())
            return;
    }

    /* Run DSP 56k code if necessary */
    if (bDspEnabled) {
        if (save_cycles != cycles)
            fprintf (stderr, "Before : %d\t\t After : %d\n", cycCounter, 
cycles);

        DSP_Run( save_cycles );
    }


TEST 6 : (to get some more infos)

I've added a printf  regs.spcflags.
I get Only these values :

During falcon boot :
256
512
516
768
4

On the falcon desktop:
768 -> when I move the mouse, or after a certain time

When I launch K.prg
256
512
768
4  ---> only once

When I quit hatari:
16 --> only once.



Hope this helps to understand the problem.

Regards

Laurent






More information about the hatari-devel mailing list