#ifndef COMPILE_H
#include "COMPILE.H"
#endif
#ifdef MEDIA751_A36M_A31E_A31M_A33M_A35E_A35M_X31J_AU1E_AU2E_AU2F_AU2G_AU3E
extern FTL_LIBRARY* PRIM_08_Library_Open();

VDEO_FTL_LIBRARY* G9002_VDEObase;


VDEO_19_Operation(
)
{
        asm {
                movea.l G9002_VDEObase(a5),a0
                movea.l -0x4C(a0),a1
                jmp     (a1)
        }
}

VDEO_04_GetBitmapByteCount(
)
{
        asm {
                movea.l G9002_VDEObase(a5),a0
                movea.l -0x10(a0),a1
                jmp     (a1)
        }
}

VDEO_05_ExpandGraphicToBitmap(
)
{
        asm {
                movea.l G9002_VDEObase(a5),a0
                movea.l -0x14(a0),a1
                jmp     (a1)
        }
}

VDEO_06_BlitToScreen(
)
{
        asm {
                movea.l G9002_VDEObase(a5),a0
                movea.l -0x18(a0),a1
                jmp     (a1)
        }
}

VDEO_07_Empty(
)
{
        asm {
                movea.l G9002_VDEObase(a5),a0
                movea.l -0x1C(a0),a1
                jmp     (a1)
        }
}

VDEO_08_FillScreenBox(
)
{
        asm {
                movea.l G9002_VDEObase(a5),a0
                movea.l -0x20(a0),a1
                jmp     (a1)
        }
}


VDEO_09_HatchScreenBox(
)
{
        asm {
                movea.l G9002_VDEObase(a5),a0
#if (defined(MEDIA692_X31J) && ((EXETYPE == C05_ANIM) || (EXETYPE == C06_CEDT) || (EXETYPE == C17_USIO) || (EXETYPE == C18_VDEO)))
                movea.l -0x30(a0),a1
#else
                movea.l -0x24(a0),a1
#endif
                jmp     (a1)
        }
}

VDEO_10_InvertScreenBox(
)
{
        asm {
                movea.l G9002_VDEObase(a5),a0
                movea.l -0x28(a0),a1
                jmp     (a1)
        }
}

VDEO_11_BlitFromScreenNoTransparency(
)
{
        asm {
                movea.l G9002_VDEObase(a5),a0
                movea.l -0x2C(a0),a1
                jmp     (a1)
        }
}

VDEO_12_BlitToScreenNoTransparency(
)
{
        asm {
                movea.l G9002_VDEObase(a5),a0
                movea.l -0x30(a0),a1
                jmp     (a1)
        }
}

#if (!(defined(MEDIA692_X31J) && (EXETYPE == C03_GAME)))
VDEO_13_WaitVerticalBlank(
)
{
        asm {
                movea.l G9002_VDEObase(a5),a0
                movea.l -0x34(a0),a1
                jmp     (a1)
        }
}
#endif

VDEO_14_SetNormalColorPalette(
)
{
        asm {
                movea.l G9002_VDEObase(a5),a0
                movea.l -0x38(a0),a1
                jmp     (a1)
        }
}

VDEO_15_ApplyNormalColorPalette(
)
{
        asm {
                movea.l G9002_VDEObase(a5),a0
                movea.l -0x3C(a0),a1
                jmp     (a1)
        }
}

VDEO_16_PaletteControl(
)
{
        asm {
                movea.l G9002_VDEObase(a5),a0
                movea.l -0x40(a0),a1
                jmp     (a1)
        }
}

VDEO_17_GetColorPalette(
)
{
        asm {
                movea.l G9002_VDEObase(a5),a0
                movea.l -0x44(a0),a1
                jmp     (a1)
        }
}

VDEO_18_SetColorPalette(
)
{
        asm {
                movea.l G9002_VDEObase(a5),a0
                movea.l -0x48(a0),a1
                jmp     (a1)
        }
}

FTL_LIBRARY* F9004_OpenVDEO(P9004_i_MinimumVersion)
int16_t P9004_i_MinimumVersion;
{
#if (defined(MEDIA652_A31E_A35M_AU1E_AU2F) || (EXETYPE == C10_UNPACK) || (EXETYPE == C08_LANG) || (EXETYPE == C01_SWOOSH) || (defined(MEDIA655_A31M) && (EXETYPE == C18_VDEO)) || (defined(MEDIA692_X31J) && (EXETYPE == C04_SWITCH)) || (defined(MEDIA771_AU2G) && (EXETYPE == C04_SWITCH)))
        if (P9004_i_MinimumVersion <= 2) {
#else
        if (P9004_i_MinimumVersion <= 3) {
#endif
                G9002_VDEObase = PRIM_08_Library_Open(FTL_VDEO, (long)P9004_i_MinimumVersion);
        }
        return G9002_VDEObase;
}

long F9005_CloseVDEO(P9005_l_)
long P9005_l_;
{
        if (P9005_l_) {
                PRIM_09_Library_Close(FTL_VDEO);
        }
}
#endif
