#ifndef COMPILE_H
#include "COMPILE.H"
#endif
#ifdef MEDIA746_A36M_A31E_A31M_A33M_A35E_A35M
BOOLEAN G3120_B_;
struct Interrupt G3211_s_CopperInterrupt;


int16_t F1135_CopperInterrupt_CPSX(
)
{
        asm {
                movem.l d1-d7/a0-a6,-(sp)
                movea.l (a1),a5
        }
#ifdef MEDIA626_A31E_A31M_A33M_A35E_A35M
#ifndef NOCOPYPROTECTION
        if (G3210_WaitForCopperInterrupt_CPSX) {
                G3210_WaitForCopperInterrupt_CPSX--;
        }
#endif
#endif
        if (G3207_B_AllowPaletteAndMessageAreaUpdatesInVerticalBlank) {
                if (G3120_B_) {
                        G3120_B_ = C0_FALSE;
                        asm {
                                move.w  #C1_TRUE,G3121_B_UpdateMiddleScreenPaletteInNextVerticalBlank(a5)
                        }
                } else {
                        if (!G3126_B_ViewportIsBeingBlittedToScreen) {
                                F1038_UpdateMousePointer();
                        }
                }
        }
        asm {
                movem.l (sp)+,d1-d7/a0-a6
        }
        return 0;
}

void F1133_AddCopperInterrupt(
)
{
        G3211_s_CopperInterrupt.is_Node.ln_Type = NT_INTERRUPT;
        G3211_s_CopperInterrupt.is_Node.ln_Pri = 127;
        G3211_s_CopperInterrupt.is_Node.ln_Name = NULL;
        G3211_s_CopperInterrupt.is_Data = &G3153_puc_A5Backup;
        G3211_s_CopperInterrupt.is_Code = F1135_CopperInterrupt_CPSX;
        AddIntServer(INTB_COPER, &G3211_s_CopperInterrupt);
}

void F1134_RemoveCopperInterrupt(
)
{
        RemIntServer(INTB_COPER, &G3211_s_CopperInterrupt);
}
#endif
