#ifndef COMPILE_H
#include "COMPILE.H"
#endif
#ifdef MEDIA044_S10EA_S10EB_S11E_S12E_S12G_S13FA_S13FB_S20E_S21E_G14ED_G20E_G21E_A20ED_A20E_A20F_A20G_A21E_A22E_A22G_F20E_F20J_X30J_P20JA_P20JB_I34E_I34M_A36M_A31E_A31M_A33M_A35E_A35M_F31E_F31J_X31J_P31J_SU1E_AU1E_AU2E
#ifdef MEDIA007_S10EA_S10EB_S11E_S12E_S12G_S13FA_S13FB_S20E_S21E
overlay "show"
#endif
#ifdef MEDIA351_G14ED_G20E_G21E
segment "gsthings"
#endif

#ifdef MEDIA413_A20ED_A20E_A20F_A20G_A21E_A22E_A22G
int16_t G1102_ai_BlitMasks[33] = { 0xFFFF, 0x7FFF, 0x3FFF, 0x1FFF, 0x0FFF, 0x07FF, 0x03FF, 0x01FF, 0x00FF, 0x007F, 0x003F, 0x001F, 0x000F, 0x0007, 0x0003, 0x0001, 0x0000, 0x8000, 0xC000, 0xE000, 0xF000, 0xF800, 0xFC00, 0xFE00, 0xFF00, 0xFF80, 0xFFC0, 0xFFE0, 0xFFF0, 0xFFF8, 0xFFFC, 0xFFFE, 0xFFFF };
#endif
#ifdef MEDIA353_G14ED_G20E_G21E_A20ED_A20E_A20F_A20G_A21E_A22E_A22G
BOOLEAN G0578_B_UseByteBoxCoordinates = C0_FALSE;
#endif
#ifdef MEDIA351_G14ED_G20E_G21E
unsigned char* G3979_puc_;
#endif
#ifdef MEDIA752_A36M_A31E_A31M_A33M_A35E_A35M_AU1E_AU2E
#if (EXETYPE != C18_VDEO)
#include "BLITAMIG.C"
#endif

BOOLEAN G3125_B_;
#endif


/* Blit part of P0199_puc_Bitmap_Source at coordinates P0202_i_X, P0203_i_Y to P0200_puc_Bitmap_Destination at coordinates specified in P0201_pi_Box and with transparent color P0206_i_TransparentColor */
void F0132_VIDEO_Blit(
#ifdef MEDIA008_S10EA_S10EB_S11E_S12E_S12G_S13FA_S13FB_S20E_S21E_G14ED_G20E_G21E
P0199_puc_Bitmap_Source, P0200_puc_Bitmap_Destination, P0201_pi_Box, P0202_i_X, P0203_i_Y, P0204_i_SourceByteWidth, P0205_i_DestinationByteWidth, P0206_i_TransparentColor)
#endif
#ifdef MEDIA413_A20ED_A20E_A20F_A20G_A21E_A22E_A22G
P0199_pui_Bitmap_Source, P0200_pui_Bitmap_Destination, P0201_pi_Box, P0202_i_X, P0203_i_Y, P0204_i_SourceByteWidth, P0205_i_DestinationByteWidth, P0206_i_TransparentColor, P0925_i_SourceHeight, P0926_i_DestinationHeight)
#endif
#ifdef MEDIA098_S10EA_S10EB_S11E_S12E_S12G_S13FA_S13FB_S20E_S21E_G14ED_G20E_G21E_F20E_F20J_X30J_P20JA_P20JB_I34E_I34M_F31E_F31J_X31J_P31J
unsigned char*             P0199_puc_Bitmap_Source      SEPARATOR
unsigned char*             P0200_puc_Bitmap_Destination SEPARATOR
#endif
#ifdef MEDIA772_SU1E
unsigned char*             P0199_puc_Bitmap_Source      SEPARATOR
unsigned char*             P0200_puc_Bitmap_Destination SEPARATOR
#endif
#ifdef MEDIA413_A20ED_A20E_A20F_A20G_A21E_A22E_A22G
unsigned int16_t*          P0199_pui_Bitmap_Source      SEPARATOR
unsigned int16_t*          P0200_pui_Bitmap_Destination SEPARATOR
#endif
#ifdef MEDIA752_A36M_A31E_A31M_A33M_A35E_A35M_AU1E_AU2E
register unsigned int16_t* P0199_pui_Bitmap_Source      SEPARATOR
register unsigned int16_t* P0200_pui_Bitmap_Destination SEPARATOR
#endif
#ifdef MEDIA087_S10EA_S10EB_S11E_S12E_S12G_S13FA_S13FB_S20E_S21E_G14ED_G20E_G21E_A20ED_A20E_A20F_A20G_A21E_A22E_A22G_SU1E
int16_t*                   P0201_pi_Box                 SEPARATOR
#endif
#ifdef MEDIA529_F20E_F20J_X30J_P20JA_P20JB_I34E_I34M_A36M_A31E_A31M_A33M_A35E_A35M_F31E_F31J_X31J_P31J
int16_t*                   P2364_pi_XYZ                 SEPARATOR
#endif
#ifdef MEDIA763_AU1E_AU2E
int16_t*                   P2364_pi_XYZ                 SEPARATOR
#endif
#ifdef MEDIA141_S10EA_S10EB_S11E_S12E_S12G_S13FA_S13FB_S20E_S21E_A20ED_A20E_A20F_A20G_A21E_A22E_A22G_F20E_F20J_X30J_P20JA_P20JB_I34E_I34M_A36M_A31E_A31M_A33M_A35E_A35M_F31E_F31J_X31J_P31J
int16_t                    P0202_i_X                    SEPARATOR
int16_t                    P0203_i_Y                    SEPARATOR
#endif
#ifdef MEDIA774_SU1E_AU1E_AU2E
int16_t                    P0202_i_X                    SEPARATOR
int16_t                    P0203_i_Y                    SEPARATOR
#endif
#ifdef MEDIA351_G14ED_G20E_G21E
unsigned int16_t           P0202_i_X                    SEPARATOR
unsigned int16_t           P0203_i_Y                    SEPARATOR
#endif
int16_t                    P0204_i_SourceByteWidth      SEPARATOR
#ifdef MEDIA141_S10EA_S10EB_S11E_S12E_S12G_S13FA_S13FB_S20E_S21E_A20ED_A20E_A20F_A20G_A21E_A22E_A22G_F20E_F20J_X30J_P20JA_P20JB_I34E_I34M_A36M_A31E_A31M_A33M_A35E_A35M_F31E_F31J_X31J_P31J
int16_t                    P0205_i_DestinationByteWidth SEPARATOR
#endif
#ifdef MEDIA774_SU1E_AU1E_AU2E
int16_t                    P0205_i_DestinationByteWidth SEPARATOR
#endif
#ifdef MEDIA351_G14ED_G20E_G21E
unsigned int16_t           P0205_i_DestinationByteWidth SEPARATOR
#endif
#ifdef MEDIA101_S10EA_S10EB_S11E_S12E_S12G_S13FA_S13FB_S20E_S21E_G14ED_G20E_G21E_F20E_F20J_X30J_F31E_F31J_X31J_SU1E
int16_t                    P0206_i_TransparentColor     FINAL_SEPARATOR
#endif
#ifdef MEDIA413_A20ED_A20E_A20F_A20G_A21E_A22E_A22G
int16_t                    P0206_i_TransparentColor     SEPARATOR
#endif
#ifdef MEDIA465_P20JA_P20JB_I34E_I34M_A36M_A31E_A31M_A33M_A35E_A35M_P31J
#if (defined(MEDIA636_A31E_A31M_A35E) && (EXETYPE == C18_VDEO))
char                       P0206_i_TransparentColor     SEPARATOR
#else
int16_t                    P0206_i_TransparentColor     SEPARATOR
#endif
#endif
#ifdef MEDIA763_AU1E_AU2E
int16_t                    P0206_i_TransparentColor     SEPARATOR
#endif
#ifdef MEDIA425_A20ED_A20E_A20F_A20G_A21E_A22E_A22G_A36M_A31E_A31M_A33M_A35E_A35M
int16_t                    P0925_i_SourceHeight         SEPARATOR
int16_t                    P0926_i_DestinationHeight    FINAL_SEPARATOR
#endif
#ifdef MEDIA763_AU1E_AU2E
int16_t                    P0925_i_SourceHeight         SEPARATOR
int16_t                    P0926_i_DestinationHeight    FINAL_SEPARATOR
#endif
#ifdef MEDIA463_P20JA_P20JB_I34E_I34M_P31J
int16_t                    P2365_i_Flip                 FINAL_SEPARATOR
#endif
{
#ifdef MEDIA174_S10EA_S10EB_S11E_S12E_S12G_S13FA_S13FB_S20E_S21E_SU1E
        int16_t L0229_i_LinePixelCount;
        int16_t L0230_i_FirstUnitMask;
        int16_t L0231_i_LastUnitMask;


        asm {
                        movem.l D4-D7/A2-A5,-(A7)
                        movea.l P0199_puc_Bitmap_Source(A6),A0
                        movea.l P0200_puc_Bitmap_Destination(A6),A1
                        move.w  P0206_i_TransparentColor(A6),D0
                        move.w  P0205_i_DestinationByteWidth(A6),D1
                        move.w  P0204_i_SourceByteWidth(A6),D2
                        move.w  P0203_i_Y(A6),D3
                        move.w  P0202_i_X(A6),D4
#ifdef MEDIA007_S10EA_S10EB_S11E_S12E_S12G_S13FA_S13FB_S20E_S21E
                        cmpa.l  #0x00000000,A1
                        bne.s   @T0132001                               /* If P0200_puc_Bitmap_Destination = NULL then blit directly to the physical screen */
                        movem.l D0-D4/A0,-(A7)
                        move.w  #2,-(A7)                                /* XBIOS function $02: void *Physbase(void); Returns the physical start address of the video memory */
                        trap    #14
                        addq.l  #2,A7
                        movea.l D0,A1
                        movem.l (A7)+,D0-D4/A0
                @T0132001:
#endif
                        movea.l P0201_pi_Box(A6),A2
                        lea     @V0132000_Masks,A5
                        moveq   #0x0F,D5
                        and.w   D4,D5                                   /* D5 = index of first pixel to blit from first unit of source bitmap */
                        mulu.w  D2,D3                                   /* P0203_i_Y * P0204_i_SourceByteWidth */
                        adda.l  D3,A0
                        sub.w   D5,D4
                        lsr.w   #1,D4                                   /* Convert pixel count to byte count */
                        adda.w  D4,A0                                   /* Address in source bitmap of first unit to read from */
#ifdef MEDIA007_S10EA_S10EB_S11E_S12E_S12G_S13FA_S13FB_S20E_S21E
                        moveq   #0,D7
                        moveq   #0,D4
                        tst.w   G0578_B_UseByteBoxCoordinates(A4)
                        beq.s   @T0132002                               /* Branch if G0578_B_UseByteBoxCoordinates = C0_FALSE */
                        move.b  (A2)+,D4                                /* X1 */
                        move.b  (A2)+,D7                                /* X2 */
                        bra.s   @T0132003
                @T0132002:
                        move.w  (A2)+,D4                                /* X1 */
                        move.w  (A2)+,D7                                /* X2 */
                @T0132003:
                        sub.w   D4,D7                                   /* X2 - X1 */
                        addq.w  #1,D7                                   /* X2 - X1 + 1 */
                        swap    D7                                      /* Most significant word of D7 contains X2 - X1 + 1 */
                        moveq   #0,D3
                        tst.w   G0578_B_UseByteBoxCoordinates(A4)
                        beq.s   @T0132004                               /* Branch if G0578_B_UseByteBoxCoordinates = C0_FALSE */
                        move.b  (A2)+,D3                                /* Y1 */
                        move.b  (A2),D7                                 /* Y2 */
                        bra.s   @T0132005
                @T0132004:
                        move.w  (A2)+,D3                                /* Y1 */
                        move.w  (A2),D7                                 /* Y2 */
                @T0132005:
                        sub.w   D3,D7                                   /* Least significant word of D7 contains Y2 - Y1: number of lines of bitmap to blit (iteration count) */
                        swap    D7                                      /* Least significant word of D7 contains X2 - X1 + 1 */
#endif
#ifdef MEDIA772_SU1E
                        moveq   #0,D3
                        move.w  4(A2),D3
                        moveq   #0,D4
                        move.w  (A2),D4
                        move.w  6(A2),D7
                        sub.w   D3,D7
                        swap    D7
                        move.w  2(A2),D7
                        sub.w   D4,D7
                        addq.w  #1,D7
#endif
                        moveq   #0x0F,D6
                        and.w   D4,D6                                   /* D6 = index of first pixel to blit to first unit of destination bitmap */
                        mulu.w  D1,D3                                   /* Y1 * P0205_i_DestinationByteWidth */
                        adda.l  D3,A1                                   /* Address of line in destination bitmap where blit will start */
                        sub.w   D6,D4
                        lsr.w   #1,D4                                   /* Convert pixel count to byte count */
                        adda.w  D4,A1                                   /* Address in destination bitmap of first unit to write to */
                        moveq   #15,D3
                        add.w   D7,D3                                   /* D3 = (X2 - X1 + 1) + 15 */
                        add.w   D5,D3                                   /* D3 = (X2 - X1 + 1) + 15 + index of first pixel to blit from first unit of source bitmap */
                        andi.w  #0xFFF0,D3                              /* Multiple of 16 pixels */
                        lsr.w   #1,D3                                   /* D3 = byte count for a line */
                        move.w  D2,D4                                   /* P0204_i_SourceByteWidth */
                        sub.w   D3,D4                                   /* P0204_i_SourceByteWidth - byte count for a line */
                        movea.w D4,A3                                   /* Byte offset in source bitmap between 2 lines */
                        add.w   D6,D7                                   /* Index of first pixel to blit to first unit of destination bitmap + (X2 - X1 + 1)   Number of pixels to blit on a line including left padding */
                        move.w  D7,L0229_i_LinePixelCount(A6)
                        moveq   #15,D3
                        add.w   D7,D3                                   /* D3 = (X2 - X1 + 1) + 15 */
                        andi.w  #0xFFF0,D3                              /* Multiple of 16 pixels */
                        lsr.w   #1,D3                                   /* D3 = byte count */
                        sub.w   D3,D1                                   /* P0205_i_DestinationByteWidth - D3 */
                        movea.w D1,A4                                   /* Byte offset in destination bitmap between 2 lines */
                        move.w  D5,D1                                   /* Index of first pixel to blit from first unit of source bitmap */
                        neg.w   D5
                        add.w   D6,D5
                        bpl.s   @T0132006
                        addi.w  #16,D5                                  /* Required pixel shift inside units between source and destination */
                @T0132006:
                        move.w  D6,D3
                        add.w   D3,D3
                        move.w  0(A5,D3.w),L0230_i_FirstUnitMask(A6)
                        move.w  D7,D3
                        add.w   D7,D3
                        cmpi.w  #32,D3
                        bpl.s   @T0132007
                        move.w  0(A5,D3.w),D3
                        not.w   D3
                        or.w    D3,L0230_i_FirstUnitMask(A6)
                        cmp.w   D5,D6
                        bpl.s   @T0132008
                        add.w   D7,D1
                        sub.w   D6,D1
                        cmpi.w  #17,D1
                        bpl.s   @T0132008
                        subq.w  #8,A3
                        bra.s   @T0132008
                @T0132007:
                        andi.w  #0x001F,D3
                        move.w  0(A5,D3.w),D3
                        not.w   D3
                        move.w  D3,L0231_i_LastUnitMask(A6)
                @T0132008:
                        move.w  D5,D3
                        add.w   D3,D3
                        movea.w 0(A5,D3.w),A5
                        swap    D5
                        tst.w   D0
                        bpl.s   @T0132009                               /* If P0206_i_TransparentColor >= 0 */
                        lea     @T0132035_NoTransparency,A2
                        bra.s   @T0132011_BlitLine
                @T0132009:
                        add.w   D0,D0
                        move.w  D0,D3
                        add.w   D0,D0
                        add.w   D3,D0                                   /* D0 = 6 * P0206_i_TransparentColor */
                        jmp     2(PC,D0.w)                              /* Each entry in the jumptable below is 6 bytes large */
                @T0132010:
                        lea     @T0132019_TransparentColor00,A2
                        bra.s   @T0132011_BlitLine
                        lea     @T0132020_TransparentColor01,A2
                        bra.s   @T0132011_BlitLine
                        lea     @T0132021_TransparentColor02,A2
                        bra.s   @T0132011_BlitLine
                        lea     @T0132022_TransparentColor03,A2
                        bra.s   @T0132011_BlitLine
                        lea     @T0132023_TransparentColor04,A2
                        bra.s   @T0132011_BlitLine
                        lea     @T0132024_TransparentColor05,A2
                        bra.s   @T0132011_BlitLine
                        lea     @T0132025_TransparentColor06,A2
                        bra.s   @T0132011_BlitLine
                        lea     @T0132026_TransparentColor07,A2
                        bra.s   @T0132011_BlitLine
                        lea     @T0132027_TransparentColor08,A2
                        bra.s   @T0132011_BlitLine
                        lea     @T0132028_TransparentColor09,A2
                        bra.s   @T0132011_BlitLine
                        lea     @T0132029_TransparentColor10,A2
                        bra.s   @T0132011_BlitLine
                        lea     @T0132030_TransparentColor11,A2
                        bra.s   @T0132011_BlitLine
                        lea     @T0132031_TransparentColor12,A2
                        bra.s   @T0132011_BlitLine
                        lea     @T0132032_TransparentColor13,A2
                        bra.s   @T0132011_BlitLine
                        lea     @T0132033_TransparentColor14,A2
                        bra.s   @T0132011_BlitLine
                        lea     @T0132034_TransparentColor15,A2
                @T0132011_BlitLine:
                        move.w  L0230_i_FirstUnitMask(A6),D5
                        swap    D5
                        tst.w   D5
                        beq.s   @T0132013
                        move.w  A5,D4
                        cmp.w   D5,D6
                        bpl.s   @T0132012
                        move.w  (A0)+,D1
                        ror.w   D5,D1
                        and.w   D4,D1
                        swap    D1
                        move.w  (A0)+,D0
                        ror.w   D5,D0
                        and.w   D4,D0
                        swap    D0
                        move.w  (A0)+,D3
                        ror.w   D5,D3
                        and.w   D4,D3
                        swap    D3
                        move.w  (A0)+,D2
                        ror.w   D5,D2
                        and.w   D4,D2
                        swap    D2
                @T0132012:
                        swap    D6
                        move.w  (A0)+,D0
                        ror.w   D5,D0
                        move.w  D0,D6
                        swap    D1
                        and.w   D4,D1
                        not.w   D4
                        and.w   D4,D0
                        or.w    D1,D0
                        move.w  D6,D1
                        swap    D1
                        move.w  (A0)+,D1
                        ror.w   D5,D1
                        move.w  D1,D6
                        swap    D0
                        and.w   D4,D1
                        not.w   D4
                        and.w   D4,D0
                        or.w    D0,D1
                        move.w  D6,D0
                        swap    D0
                        move.w  (A0)+,D2
                        ror.w   D5,D2
                        move.w  D2,D6
                        swap    D3
                        and.w   D4,D3
                        not.w   D4
                        and.w   D4,D2
                        or.w    D3,D2
                        move.w  D6,D3
                        swap    D3
                        move.w  (A0)+,D3
                        ror.w   D5,D3
                        move.w  D3,D6
                        swap    D2
                        and.w   D4,D3
                        not.w   D4
                        and.w   D4,D2
                        or.w    D2,D3
                        move.w  D6,D2
                        swap    D2
                        swap    D6
                        swap    D5
                        jmp     (A2)
                @T0132013:
                        movem.w (A0)+,D0-D3
                        swap    D5
                        jmp     (A2)
                @T0132014:
                        not.w   D4
                        and.w   D4,D0
                        and.w   D4,D1
                        and.w   D4,D2
                        and.w   D4,D3
                        not.w   D4
                        and.w   D4,(A1)
                        or.w    D0,(A1)+
                        and.w   D4,(A1)
                        or.w    D1,(A1)+
                        and.w   D4,(A1)
                        or.w    D2,(A1)+
                        and.w   D4,(A1)
                        or.w    D3,(A1)+
                @T0132015:
                        subi.w  #16,D7                                  /* 16 pixels less to blit on the line (D7 includes left padding pixels) */
                        ble.s   @T0132018_ProceedToNextLine             /* Branch if D7 <= 0. If the line was fully blitted */
                        cmpi.w  #16,D7
                        bmi.s   @T0132017                               /* Branch if D7 < 16. If there is less than a unit of 16 pixels left to blit */
                        clr.w   D5                                      /* Use a 0x0000 mask */
                        swap    D5
                @T0132016:
                        tst.w   D5
                        beq.s   @T0132013
                        move.w  A5,D4
                        bra.w   @T0132012
                @T0132017:
                        move.w  L0231_i_LastUnitMask(A6),D5
                        swap    D5
                        cmp.w   D7,D5
                        bmi.s   @T0132016
                        swap    D0                                      /* Horizontal flip of bits in D0, D1, D2, D3 */
                        swap    D1
                        swap    D2
                        swap    D3
                        move.w  D0,D4
                        move.w  D1,D0
                        move.w  D4,D1
                        move.w  D2,D4
                        move.w  D3,D2
                        move.w  D4,D3                                   /* Horizontal flip of bits in D0, D1, D2, D3 */
                        swap    D5
                        jmp     (A2)
                @T0132018_ProceedToNextLine:
                        swap    D7                                      /* Line count */
                        subq.w  #1,D7                                   /* One less line to copy */
                        bmi     @T0132038_Return                        /* Branch if < 0, if there are no more lines of bitmap to blit */
                        swap    D7
                        move.w  L0229_i_LinePixelCount(A6),D7
                        adda.w  A3,A0                                   /* Proceed to next line of source bitmap */
                        adda.w  A4,A1                                   /* Proceed to next line of destination bitmap */
                        bra     @T0132011_BlitLine
                @T0132019_TransparentColor00:
                        move.w  D0,D4
                        or.w    D1,D4
                        or.w    D2,D4
                        or.w    D3,D4
                        not.w   D4
                        or.w    D5,D4
                        bne.s   @T0132014
                        bra     @T0132036
                @T0132020_TransparentColor01:
                        move.w  D1,D4
                        or.w    D2,D4
                        or.w    D3,D4
                        not.w   D4
                        and.w   D0,D4
                        or.w    D5,D4
                        bne     @T0132014
                        bra     @T0132036
                @T0132021_TransparentColor02:
                        move.w  D0,D4
                        or.w    D2,D4
                        or.w    D3,D4
                        not.w   D4
                        and.w   D1,D4
                        or.w    D5,D4
                        bne     @T0132014
                        bra     @T0132036
                @T0132022_TransparentColor03:
                        move.w  D2,D4
                        or.w    D3,D4
                        not.w   D4
                        and.w   D0,D4
                        and.w   D1,D4
                        or.w    D5,D4
                        bne     @T0132014
                        bra     @T0132036
                @T0132023_TransparentColor04:
                        move.w  D0,D4
                        or.w    D1,D4
                        or.w    D3,D4
                        not.w   D4
                        and.w   D2,D4
                        or.w    D5,D4
                        bne     @T0132014
                        bra     @T0132036
                @T0132024_TransparentColor05:
                        move.w  D1,D4
                        or.w    D3,D4
                        not.w   D4
                        and.w   D0,D4
                        and.w   D2,D4
                        or.w    D5,D4
                        bne     @T0132014
                        bra     @T0132036
                @T0132025_TransparentColor06:
                        move.w  D0,D4
                        or.w    D3,D4
                        not.w   D4
                        and.w   D1,D4
                        and.w   D2,D4
                        or.w    D5,D4
                        bne     @T0132014
                        bra     @T0132036
                @T0132026_TransparentColor07:
                        move.w  D3,D4
                        not.w   D4
                        and.w   D0,D4
                        and.w   D1,D4
                        and.w   D2,D4
                        or.w    D5,D4
                        bne     @T0132014
                        bra     @T0132036
                @T0132027_TransparentColor08:
                        move.w  D0,D4
                        or.w    D1,D4
                        or.w    D2,D4
                        not.w   D4
                        and.w   D3,D4
                        or.w    D5,D4
                        bne     @T0132014
                        bra     @T0132036
                @T0132028_TransparentColor09:
                        move.w  D1,D4
                        or.w    D2,D4
                        not.w   D4
                        and.w   D0,D4
                        and.w   D3,D4
                        or.w    D5,D4
                        bne     @T0132014
#ifdef MEDIA007_S10EA_S10EB_S11E_S12E_S12G_S13FA_S13FB_S20E_S21E
                        bra.s   @T0132036       /* .s required for Megamax */
#endif
#ifdef MEDIA772_SU1E
                        bra.w   @T0132036
#endif
                @T0132029_TransparentColor10:
                        move.w  D0,D4
                        or.w    D2,D4
                        not.w   D4
                        and.w   D1,D4
                        and.w   D3,D4
                        or.w    D5,D4
                        bne     @T0132014
#ifdef MEDIA007_S10EA_S10EB_S11E_S12E_S12G_S13FA_S13FB_S20E_S21E
                        bra.s   @T0132036       /* .s required for Megamax */
#endif
#ifdef MEDIA772_SU1E
                        bra.w   @T0132036
#endif
                @T0132030_TransparentColor11:
                        move.w  D2,D4
                        not.w   D4
                        and.w   D0,D4
                        and.w   D1,D4
                        and.w   D3,D4
                        or.w    D5,D4
                        bne     @T0132014
                        bra.s   @T0132036
                @T0132031_TransparentColor12:
                        move.w  D0,D4
                        or.w    D1,D4
                        not.w   D4
                        and.w   D2,D4
                        and.w   D3,D4
                        or.w    D5,D4
                        bne     @T0132014
                        bra.s   @T0132036
                @T0132032_TransparentColor13:
                        move.w  D1,D4
                        not.w   D4
                        and.w   D0,D4
                        and.w   D2,D4
                        and.w   D3,D4
                        or.w    D5,D4
                        bne     @T0132014
                        bra.s   @T0132036
                @T0132033_TransparentColor14:
                        move.w  D0,D4
                        not.w   D4
                        and.w   D1,D4
                        and.w   D2,D4
                        and.w   D3,D4
                        or.w    D5,D4
                        bne     @T0132014
                        bra.s   @T0132036
                @T0132034_TransparentColor15:
                        move.w  D0,D4
                        and.w   D1,D4
                        and.w   D2,D4
                        and.w   D3,D4
                        or.w    D5,D4
                        bne     @T0132014
                        bra.s   @T0132036
                @T0132035_NoTransparency:
                        move.w  D5,D4
                        bne     @T0132014
                @T0132036:
                        move.w  D0,(A1)+
                        move.w  D1,(A1)+
                        move.w  D2,(A1)+
                        move.w  D3,(A1)+
                        bra     @T0132015
                @V0132000_Masks:
                        dc.w    0x0000,0x8000,0xC000,0xE000
                        dc.w    0xF000,0xF800,0xFC00,0xFE00
                        dc.w    0xFF00,0xFF80,0xFFC0,0xFFE0
                        dc.w    0xFFF0,0xFFF8,0xFFFC,0xFFFE
                @T0132038_Return:
                        movem.l (A7)+,D4-D7/A2-A5
        }
#endif
#ifdef MEDIA351_G14ED_G20E_G21E
        char L6307_;
        char L6308_;
        int16_t L6320_;
        int16_t L6309_;
        int16_t L6310_;
        int16_t L6311_;
        unsigned int16_t L6312_;
        unsigned int16_t L6313_;
        int16_t L6314_;
        int16_t L6315_;
        unsigned char* L6317_;
#ifdef MEDIA350_G14ED_G20E
        unsigned char* L6319_;
#endif


        if (P0200_puc_Bitmap_Destination == NULL) {
                P0200_puc_Bitmap_Destination = G0348_Bitmap_Screen;
        }
        if (G0578_B_UseByteBoxCoordinates == C1_TRUE) {
                L6312_ = M768_BOX_LEFT(((char*)P0201_pi_Box));
                L6313_ = M769_BOX_RIGHT(((char*)P0201_pi_Box));
                L6315_ = M771_BOX_BOTTOM(((char*)P0201_pi_Box));
                L6314_ = M770_BOX_TOP(((char*)P0201_pi_Box));
        } else {
                L6312_ = M768_BOX_LEFT(P0201_pi_Box);
                L6313_ = M769_BOX_RIGHT(P0201_pi_Box);
                L6315_ = M771_BOX_BOTTOM(P0201_pi_Box);
                L6314_ = M770_BOX_TOP(P0201_pi_Box);
        }
        P0199_puc_Bitmap_Source += (P0204_i_SourceByteWidth * P0203_i_Y) + (P0202_i_X >> 1);
        P0200_puc_Bitmap_Destination += (P0205_i_DestinationByteWidth * L6314_) + (L6312_ >> 1);
        L6310_ = P0202_i_X % 2;
        L6311_ = L6312_ % 2;
        L6320_ = L6315_ - L6314_ + 1;
        L6309_ = (L6313_ - L6312_ + 1) >> 1;
        if (L6312_ % 2) {
                L6307_ = 0x0F;
        } else {
                L6307_ = 0xFF;
        }
        if (L6313_ % 2) {
                L6308_ = 0xFF;
        } else {
                L6308_ = 0xF0;
        }
        if ((L6307_ & L6308_) == 0xFF) {
                L6309_--;
        }
        if (L6309_ == 0) {
                if (L6312_ == L6313_) {
                        L6307_ &= L6308_;
                } else {
                        L6307_ |= L6308_;
                }
        }
        asm {
                L080944:
                        LDA        P0206_i_TransparentColor
                        BMI        L080965
                        ASL        A
                        ASL        A
                        TAX
                        LDA        >G3980_apuc_,X
                        STA        L6317_
#ifdef MEDIA350_G14ED_G20E
                        LDA        >G3981_apuc_,X
                        STA        L6319_
#endif
                        INX
                        INX
                        LDA        >G3980_apuc_,X
                        STA        L6317_+2
#ifdef MEDIA350_G14ED_G20E
                        LDA        >G3981_apuc_,X
                        STA        L6319_+2
#endif
                L080965:
                        LDA        L6310_
                        EOR        L6311_
                        BEQ        L080975
                        LDA        L6310_
                        BNE        L080972
                        BRL        L080B09
                L080972:
                        BRL        L080A1F
                L080975:
                        LDA        P0206_i_TransparentColor
                        SEP        #0x30
                        BPL        L0809BE
                L08097B:
                        LDY        L6309_
                        BEQ        L080993
                        LDA        [P0199_puc_Bitmap_Source],Y
                        EOR        [P0200_puc_Bitmap_Destination],Y
                        AND        L6308_
                        EOR        [P0200_puc_Bitmap_Destination],Y
                        STA        [P0200_puc_Bitmap_Destination],Y
                        DEY
                        BEQ        L080993
                L08098C:
                        LDA        [P0199_puc_Bitmap_Source],Y
                        STA        [P0200_puc_Bitmap_Destination],Y
                        DEY
                        BNE        L08098C
                L080993:
                        LDA        [P0199_puc_Bitmap_Source],Y
                        EOR        [P0200_puc_Bitmap_Destination],Y
                        AND        L6307_
                        EOR        [P0200_puc_Bitmap_Destination],Y
                        STA        [P0200_puc_Bitmap_Destination],Y
                        REP        #0x30
                        CLC
                        LDA        P0199_puc_Bitmap_Source
                        ADC        P0204_i_SourceByteWidth
                        STA        P0199_puc_Bitmap_Source
                        BCC        L0809AA
                        INC        P0199_puc_Bitmap_Source+2
                L0809AA:
                        CLC
                        LDA        P0200_puc_Bitmap_Destination
                        ADC        P0205_i_DestinationByteWidth
                        STA        P0200_puc_Bitmap_Destination
                        BCC        L0809B5
                        INC        P0200_puc_Bitmap_Destination+2
                L0809B5:
                        DEC        L6320_
                        SEP        #0x30
                        BNE        L08097B
                        BRL        L080BF7
                L0809BE:
                        LDY        L6309_
                        BEQ        L0809EA
                        LDA        [P0199_puc_Bitmap_Source],Y
                        TAX
#ifdef MEDIA350_G14ED_G20E
                        LDA        [P0200_puc_Bitmap_Destination],Y
#endif
#ifdef MEDIA409_G21E
                        EOR        [P0200_puc_Bitmap_Destination],Y
#endif
                        PHY
                        TXY
                        AND        [L6317_],Y
#ifdef MEDIA350_G14ED_G20E
                        ORA        [L6319_],Y
#endif
                        PLY
#ifdef MEDIA350_G14ED_G20E
                        EOR        [P0200_puc_Bitmap_Destination],Y
#endif
                        AND        L6308_
                        EOR        [P0200_puc_Bitmap_Destination],Y
                        STA        [P0200_puc_Bitmap_Destination],Y
                        DEY
                        BEQ        L0809EA
                L0809D9:
                        LDA        [P0199_puc_Bitmap_Source],Y
                        TAX
#ifdef MEDIA350_G14ED_G20E
                        LDA        [P0200_puc_Bitmap_Destination],Y
#endif
#ifdef MEDIA409_G21E
                        EOR        [P0200_puc_Bitmap_Destination],Y
#endif
                        PHY
                        TXY
                        AND        [L6317_],Y
#ifdef MEDIA350_G14ED_G20E
                        ORA        [L6319_],Y
#endif
                        PLY
#ifdef MEDIA409_G21E
                        EOR        [P0200_puc_Bitmap_Destination],Y
#endif
                        STA        [P0200_puc_Bitmap_Destination],Y
                        DEY
                        BNE        L0809D9
                L0809EA:
                        LDA        [P0199_puc_Bitmap_Source],Y
                        TAX
#ifdef MEDIA350_G14ED_G20E
                        LDA        [P0200_puc_Bitmap_Destination],Y
#endif
#ifdef MEDIA409_G21E
                        EOR        [P0200_puc_Bitmap_Destination],Y
#endif
                        PHY
                        TXY
                        AND        [L6317_],Y
#ifdef MEDIA350_G14ED_G20E
                        ORA        [L6319_],Y
#endif
                        PLY
#ifdef MEDIA350_G14ED_G20E
                        EOR        [P0200_puc_Bitmap_Destination],Y
#endif
                        AND        L6307_
                        EOR        [P0200_puc_Bitmap_Destination],Y
                        STA        [P0200_puc_Bitmap_Destination],Y
                        REP        #0x30
                        CLC
                        LDA        P0199_puc_Bitmap_Source
                        ADC        P0204_i_SourceByteWidth
                        STA        P0199_puc_Bitmap_Source
                        BCC        L080A0B
                        INC        P0199_puc_Bitmap_Source+2
                L080A0B:
                        CLC
                        LDA        P0200_puc_Bitmap_Destination
                        ADC        P0205_i_DestinationByteWidth
                        STA        P0200_puc_Bitmap_Destination
                        BCC        L080A16
                        INC        P0200_puc_Bitmap_Destination+2
                L080A16:
                        DEC        L6320_
                        SEP        #0x30
                        BNE        L0809BE
                        BRL        L080BF7
                L080A1F:
                        LDA        P0206_i_TransparentColor
                        SEP        #0x30
                        BPL        L080A88
                L080A25:
                        LDY        L6309_
                        BEQ        L080A51
                        REP        #0x20
                        LDA        [P0199_puc_Bitmap_Source],Y
                        XBA
                        ASL        A
                        ASL        A
                        ASL        A
                        ASL        A
                        SEP        #0x30
                        XBA
                        EOR        [P0200_puc_Bitmap_Destination],Y
                        AND        L6308_
                        EOR        [P0200_puc_Bitmap_Destination],Y
                        STA        [P0200_puc_Bitmap_Destination],Y
                        DEY
                        BEQ        L080A51
                L080A40:
                        REP        #0x20
                        LDA        [P0199_puc_Bitmap_Source],Y
                        XBA
                        ASL        A
                        ASL        A
                        ASL        A
                        ASL        A
                        SEP        #0x30
                        XBA
                        STA        [P0200_puc_Bitmap_Destination],Y
                        DEY
                        BNE        L080A40
                L080A51:
                        REP        #0x20
                        LDA        [P0199_puc_Bitmap_Source],Y
                        XBA
                        ASL        A
                        ASL        A
                        ASL        A
                        ASL        A
                        SEP        #0x30
                        XBA
                        EOR        [P0200_puc_Bitmap_Destination],Y
                        AND        L6307_
                        EOR        [P0200_puc_Bitmap_Destination],Y
                        STA        [P0200_puc_Bitmap_Destination],Y
                        REP        #0x30
                        CLC
                        LDA        P0199_puc_Bitmap_Source
                        ADC        P0204_i_SourceByteWidth
                        STA        P0199_puc_Bitmap_Source
                        BCC        L080A72
                        INC        P0199_puc_Bitmap_Source+2
                L080A72:
                        CLC
                        LDA        P0200_puc_Bitmap_Destination
                        ADC        P0205_i_DestinationByteWidth
                        STA        P0200_puc_Bitmap_Destination
                        BCC        L080A7D
                        INC        P0200_puc_Bitmap_Destination+2
                L080A7D:
                        DEC        L6320_
                        SEP        #0x30
                        BEQ        L080A85
                        BRA        L080A25
                L080A85:
                        BRL        L080BF7
                L080A88:
                        LDY        L6309_
                        BEQ        L080AC8
                        REP        #0x20
                        LDA        [P0199_puc_Bitmap_Source],Y
                        XBA
                        ASL        A
                        ASL        A
                        ASL        A
                        ASL        A
                        SEP        #0x30
                        XBA
                        TAX
#ifdef MEDIA350_G14ED_G20E
                        LDA        [P0200_puc_Bitmap_Destination],Y
#endif
#ifdef MEDIA409_G21E
                        EOR        [P0200_puc_Bitmap_Destination],Y
#endif
                        PHY
                        TXY
                        AND        [L6317_],Y
#ifdef MEDIA350_G14ED_G20E
                        ORA        [L6319_],Y
#endif
                        PLY
#ifdef MEDIA350_G14ED_G20E
                        EOR        [P0200_puc_Bitmap_Destination],Y
#endif
                        AND        L6308_
                        EOR        [P0200_puc_Bitmap_Destination],Y
                        STA        [P0200_puc_Bitmap_Destination],Y
                        DEY
                        BEQ        L080AC8
                L080AAD:
                        REP        #0x20
                        LDA        [P0199_puc_Bitmap_Source],Y
                        XBA
                        ASL        A
                        ASL        A
                        ASL        A
                        ASL        A
                        SEP        #0x30
                        XBA
                        TAX
#ifdef MEDIA350_G14ED_G20E
                        LDA        [P0200_puc_Bitmap_Destination],Y
#endif
#ifdef MEDIA409_G21E
                        EOR        [P0200_puc_Bitmap_Destination],Y
#endif
                        PHY
                        TXY
                        AND        [L6317_],Y
#ifdef MEDIA350_G14ED_G20E
                        ORA        [L6319_],Y
#endif
                        PLY
#ifdef MEDIA409_G21E
                        EOR        [P0200_puc_Bitmap_Destination],Y
#endif
                        STA        [P0200_puc_Bitmap_Destination],Y
                        DEY
                        BNE        L080AAD
                L080AC8:
                        REP        #0x20
                        LDA        [P0199_puc_Bitmap_Source],Y
                        XBA
                        ASL        A
                        ASL        A
                        ASL        A
                        ASL        A
                        SEP        #0x30
                        XBA
                        TAX
#ifdef MEDIA350_G14ED_G20E
                        LDA        [P0200_puc_Bitmap_Destination],Y
#endif
#ifdef MEDIA409_G21E
                        EOR        [P0200_puc_Bitmap_Destination],Y
#endif
                        PHY
                        TXY
                        AND        [L6317_],Y
#ifdef MEDIA350_G14ED_G20E
                        ORA        [L6319_],Y
#endif
                        PLY
#ifdef MEDIA350_G14ED_G20E
                        EOR        [P0200_puc_Bitmap_Destination],Y
#endif
                        AND        L6307_
                        EOR        [P0200_puc_Bitmap_Destination],Y
                        STA        [P0200_puc_Bitmap_Destination],Y
                        REP        #0x30
                        CLC
                        LDA        P0199_puc_Bitmap_Source
                        ADC        P0204_i_SourceByteWidth
                        STA        P0199_puc_Bitmap_Source
                        BCC        L080AF3
                        INC        P0199_puc_Bitmap_Source+2
                L080AF3:
                        CLC
                        LDA        P0200_puc_Bitmap_Destination
                        ADC        P0205_i_DestinationByteWidth
                        STA        P0200_puc_Bitmap_Destination
                        BCC        L080AFE
                        INC        P0200_puc_Bitmap_Destination+2
                L080AFE:
                        DEC        L6320_
                        SEP        #0x30
                        BEQ        L080B06
                        BRA        L080A88
                L080B06:
                        BRL        L080BF7
                L080B09:
                        REP        #0x30
                        SEC
                        LDA        P0199_puc_Bitmap_Source
                        SBC        #0x01
                        STA        P0199_puc_Bitmap_Source
                        BCS        L080B17
                        DEC        P0199_puc_Bitmap_Source+2
                L080B17:
                        LDA        P0206_i_TransparentColor
                        SEP        #0x30
                        BPL        L080B7C
                L080B1D:
                        LDY        L6309_
                        BEQ        L080B47
                        REP        #0x20
                        LDA        [P0199_puc_Bitmap_Source],Y
                        XBA
                        LSR        A
                        LSR        A
                        LSR        A
                        LSR        A
                        SEP        #0x30
                        EOR        [P0200_puc_Bitmap_Destination],Y
                        AND        L6308_
                        EOR        [P0200_puc_Bitmap_Destination],Y
                        STA        [P0200_puc_Bitmap_Destination],Y
                        DEY
                        BEQ        L080B47
                L080B37:
                        REP        #0x20
                        LDA        [P0199_puc_Bitmap_Source],Y
                        XBA
                        LSR        A
                        LSR        A
                        LSR        A
                        LSR        A
                        SEP        #0x30
                        STA        [P0200_puc_Bitmap_Destination],Y
                        DEY
                        BNE        L080B37
                L080B47:
                        REP        #0x20
                        LDA        [P0199_puc_Bitmap_Source],Y
                        XBA
                        LSR        A
                        LSR        A
                        LSR        A
                        LSR        A
                        SEP        #0x30
                        EOR        [P0200_puc_Bitmap_Destination],Y
                        AND        L6307_
                        EOR        [P0200_puc_Bitmap_Destination],Y
                        STA        [P0200_puc_Bitmap_Destination],Y
                        REP        #0x30
                        CLC
                        LDA        P0199_puc_Bitmap_Source
                        ADC        P0204_i_SourceByteWidth
                        STA        P0199_puc_Bitmap_Source
                        BCC        L080B67
                        INC        P0199_puc_Bitmap_Source+2
                L080B67:
                        CLC
                        LDA        P0200_puc_Bitmap_Destination
                        ADC        P0205_i_DestinationByteWidth
                        STA        P0200_puc_Bitmap_Destination
                        BCC        L080B72
                        INC        P0200_puc_Bitmap_Destination+2
                L080B72:
                        DEC        L6320_
                        SEP        #0x30
                        BEQ        L080B7A
                        BRA        L080B1D
                L080B7A:
                        BRA        L080BF7
                L080B7C:
                        LDY        L6309_
                        BEQ        L080BBA
                        REP        #0x20
                        LDA        [P0199_puc_Bitmap_Source],Y
                        XBA
                        LSR        A
                        LSR        A
                        LSR        A
                        LSR        A
                        SEP        #0x30
                        TAX
#ifdef MEDIA350_G14ED_G20E
                        LDA        [P0200_puc_Bitmap_Destination],Y
#endif
#ifdef MEDIA409_G21E
                        EOR        [P0200_puc_Bitmap_Destination],Y
#endif
                        PHY
                        TXY
                        AND        [L6317_],Y
#ifdef MEDIA350_G14ED_G20E
                        ORA        [L6319_],Y
#endif
                        PLY
#ifdef MEDIA350_G14ED_G20E
                        EOR        [P0200_puc_Bitmap_Destination],Y
#endif
                        AND        L6308_
                        EOR        [P0200_puc_Bitmap_Destination],Y
                        STA        [P0200_puc_Bitmap_Destination],Y
                        DEY
                        BEQ        L080BBA
                L080BA0:
                        REP        #0x20
                        LDA        [P0199_puc_Bitmap_Source],Y
                        XBA
                        LSR        A
                        LSR        A
                        LSR        A
                        LSR        A
                        SEP        #0x30
                        TAX
#ifdef MEDIA350_G14ED_G20E
                        LDA        [P0200_puc_Bitmap_Destination],Y
#endif
#ifdef MEDIA409_G21E
                        EOR        [P0200_puc_Bitmap_Destination],Y
#endif
                        PHY
                        TXY
                        AND        [L6317_],Y
#ifdef MEDIA350_G14ED_G20E
                        ORA        [L6319_],Y
#endif
                        PLY
#ifdef MEDIA409_G21E
                        EOR        [P0200_puc_Bitmap_Destination],Y
#endif
                        STA        [P0200_puc_Bitmap_Destination],Y
                        DEY
                        BNE        L080BA0
                L080BBA:
                        REP        #0x20
                        LDA        [P0199_puc_Bitmap_Source],Y
                        XBA
                        LSR        A
                        LSR        A
                        LSR        A
                        LSR        A
                        SEP        #0x30
                        TAX
#ifdef MEDIA350_G14ED_G20E
                        LDA        [P0200_puc_Bitmap_Destination],Y
#endif
#ifdef MEDIA409_G21E
                        EOR        [P0200_puc_Bitmap_Destination],Y
#endif
                        PHY
                        TXY
                        AND        [L6317_],Y
#ifdef MEDIA350_G14ED_G20E
                        ORA        [L6319_],Y
#endif
                        PLY
#ifdef MEDIA350_G14ED_G20E
                        EOR        [P0200_puc_Bitmap_Destination],Y
#endif
                        AND        L6307_
                        EOR        [P0200_puc_Bitmap_Destination],Y
                        STA        [P0200_puc_Bitmap_Destination],Y
                        REP        #0x30
                        CLC
                        LDA        P0199_puc_Bitmap_Source
                        ADC        P0204_i_SourceByteWidth
                        STA        P0199_puc_Bitmap_Source
                        BCC        L080BE4
                        INC        P0199_puc_Bitmap_Source+2
                L080BE4:
                        CLC
                        LDA        P0200_puc_Bitmap_Destination
                        ADC        P0205_i_DestinationByteWidth
                        STA        P0200_puc_Bitmap_Destination
                        BCC        L080BEF
                        INC        P0200_puc_Bitmap_Destination+2
                L080BEF:
                        DEC        L6320_
                        SEP        #0x30
                        BEQ        L080BF7
                        BRA        L080B7C
                L080BF7:
                        REP        #0x30
        }
#endif
#ifdef MEDIA413_A20ED_A20E_A20F_A20G_A21E_A22E_A22G
        REGISTER int16_t L1591_i_D4;
        unsigned int16_t* L1592_pui_SourceBlitBitPlane0;
        unsigned int16_t* L1593_pui_SourceBlitBitPlane1;
        unsigned int16_t* L1594_pui_SourceBlitBitPlane2;
        unsigned int16_t* L1595_pui_SourceBlitBitPlane3;
        int16_t L1596_i_SourceBlitModulo;
        unsigned int16_t* L1597_pui_DestinationBlitBitPlane0;
        unsigned int16_t* L1598_pui_DestinationBlitBitPlane1;
        unsigned int16_t* L1599_pui_DestinationBlitBitPlane2;
        unsigned int16_t* L1600_pui_DestinationBlitBitPlane3;
        int16_t L1601_i_DestinationBlitModulo;
        int16_t L1602_i_Modulo;
        int16_t L1603_i_Modulo;
        int16_t L1604_i_Modulo;
        int16_t L1605_i_Modulo;
        unsigned int16_t* L1606_pui_;
        int16_t L1607_i_BoxWidth;
        int16_t L1608_i_BlitSizeHeight;
        int16_t L1609_i_BoxX1;
        int16_t L1610_i_BoxY1;
        unsigned char* L1611_puc_Box;
        int16_t L1612_i_BlitterFirstWordMask;
        int16_t L1613_i_BlitterLastWordMask;
        int16_t L1614_i_ShiftValue; /* Set in bltcon0 for A source shift value or in bltcon1 for B source shift value */
        int16_t L1615_i_LastWordMaskIndex;
        int16_t L1616_i_BoxX2;
        int16_t L1617_i_FirstWordMaskIndex;
        int16_t L1618_i_LastWordMaskIndex;
        unsigned int16_t L1619_ui_BlitSizeWidthWordCount;
        int16_t L1620_i_;
        int16_t L1621_i_BlitSizeLastWordMask;
        int16_t L1622_i_BlitSizeFirstWordMask;
        int16_t L1623_i_;


        P0204_i_SourceByteWidth >>= 3; /* Width in bits in a bitplane */
        P0205_i_DestinationByteWidth >>= 3; /* Width in bits in a bitplane */
        if (P0200_pui_Bitmap_Destination == NULL) {
                P0200_pui_Bitmap_Destination = (unsigned int16_t*)G0348_Bitmap_Screen;
        }
        if (G0578_B_UseByteBoxCoordinates == C1_TRUE) {
                L1611_puc_Box = (unsigned char*)P0201_pi_Box;
                L1608_i_BlitSizeHeight = (M771_BOX_BOTTOM(L1611_puc_Box) & 0xFF) - (M770_BOX_TOP(L1611_puc_Box) & 0xFF) + 1;
                L1609_i_BoxX1 = M768_BOX_LEFT(L1611_puc_Box) & 0xFF;
                L1616_i_BoxX2 = M769_BOX_RIGHT(L1611_puc_Box) & 0xFF;
                L1610_i_BoxY1 = M770_BOX_TOP(L1611_puc_Box) & 0xFF;
        } else {
                L1608_i_BlitSizeHeight = M771_BOX_BOTTOM(P0201_pi_Box) - M770_BOX_TOP(P0201_pi_Box) + 1;
                L1609_i_BoxX1 = M768_BOX_LEFT(P0201_pi_Box);
                L1616_i_BoxX2 = M769_BOX_RIGHT(P0201_pi_Box);
                L1610_i_BoxY1 = M770_BOX_TOP(P0201_pi_Box);
        }
        L1607_i_BoxWidth = L1616_i_BoxX2 - L1609_i_BoxX1 + 1;
        L1615_i_LastWordMaskIndex = P0202_i_X + L1607_i_BoxWidth - 1;
        L1617_i_FirstWordMaskIndex = P0202_i_X & 0x0F;
        L1618_i_LastWordMaskIndex = L1609_i_BoxX1 & 0x0F;
        L1619_ui_BlitSizeWidthWordCount = ((L1616_i_BoxX2 + 16) >> 4) - (L1609_i_BoxX1 >> 4);
        L1620_i_ = 1;
        L1623_i_ = 0;
        L1606_pui_ = &G0734_ps_AmigaData->BlitterTemporaryBitplane[L1619_ui_BlitSizeWidthWordCount - 1];
        if (L1618_i_LastWordMaskIndex == L1617_i_FirstWordMaskIndex) {
                L1614_i_ShiftValue = 0;
        } else {
                if (L1618_i_LastWordMaskIndex > L1617_i_FirstWordMaskIndex) {
                        L1614_i_ShiftValue = (L1618_i_LastWordMaskIndex - L1617_i_FirstWordMaskIndex) << 12;
                } else {
                        P0200_pui_Bitmap_Destination--;
                        if (L1619_ui_BlitSizeWidthWordCount < P0205_i_DestinationByteWidth) {
                                L1619_ui_BlitSizeWidthWordCount++;
                                L1620_i_++;
                        } else {
                                L1623_i_++;
                        }
                        L1606_pui_++;
                        L1614_i_ShiftValue = (L1618_i_LastWordMaskIndex + 16 - L1617_i_FirstWordMaskIndex) << 12;
                }
        }
        L1592_pui_SourceBlitBitPlane0 = P0199_pui_Bitmap_Source + ((P0203_i_Y * P0204_i_SourceByteWidth) + (P0202_i_X >> 4));
        L1593_pui_SourceBlitBitPlane1 = L1592_pui_SourceBlitBitPlane0 + (P0925_i_SourceHeight * P0204_i_SourceByteWidth);
        L1594_pui_SourceBlitBitPlane2 = L1593_pui_SourceBlitBitPlane1 + (P0925_i_SourceHeight * P0204_i_SourceByteWidth);
        L1595_pui_SourceBlitBitPlane3 = L1594_pui_SourceBlitBitPlane2 + (P0925_i_SourceHeight * P0204_i_SourceByteWidth);
        L1596_i_SourceBlitModulo = (P0204_i_SourceByteWidth - L1619_ui_BlitSizeWidthWordCount) << 1;
        L1597_pui_DestinationBlitBitPlane0 = P0200_pui_Bitmap_Destination + ((L1610_i_BoxY1 * P0205_i_DestinationByteWidth) + (L1609_i_BoxX1 >> 4));
        L1598_pui_DestinationBlitBitPlane1 = L1597_pui_DestinationBlitBitPlane0 + (P0926_i_DestinationHeight * P0205_i_DestinationByteWidth);
        L1599_pui_DestinationBlitBitPlane2 = L1598_pui_DestinationBlitBitPlane1 + (P0926_i_DestinationHeight * P0205_i_DestinationByteWidth);
        L1600_pui_DestinationBlitBitPlane3 = L1599_pui_DestinationBlitBitPlane2 + (P0926_i_DestinationHeight * P0205_i_DestinationByteWidth);
        L1601_i_DestinationBlitModulo = (P0205_i_DestinationByteWidth - L1619_ui_BlitSizeWidthWordCount) << 1;
        L1602_i_Modulo = (L1619_ui_BlitSizeWidthWordCount - L1620_i_) << 1;
        L1603_i_Modulo = (L1619_ui_BlitSizeWidthWordCount - 1) << 1;
        L1604_i_Modulo = (2 - L1620_i_) << 1;
        L1605_i_Modulo = 2;
        L1612_i_BlitterFirstWordMask = G1102_ai_BlitMasks[L1617_i_FirstWordMaskIndex];
        L1613_i_BlitterLastWordMask = (G1102_ai_BlitMasks + 16)[(L1615_i_LastWordMaskIndex & 0x0F) + 1];
        L1621_i_BlitSizeLastWordMask = (G1102_ai_BlitMasks + 16)[L1618_i_LastWordMaskIndex];
        L1622_i_BlitSizeFirstWordMask = G1102_ai_BlitMasks[(L1616_i_BoxX2 & 0x0F) + 1];
        OwnBlitter();
        if ((P0206_i_TransparentColor != CM1_COLOR_NO_TRANSPARENCY) || L1621_i_BlitSizeLastWordMask || L1622_i_BlitSizeFirstWordMask) {
                if (P0206_i_TransparentColor != CM1_COLOR_NO_TRANSPARENCY) {
                        WaitBlit();
                        custom.bltcon0 = (3 << ((P0206_i_TransparentColor & 0x03) << 1)) | L1614_i_ShiftValue | SRCA | SRCB | DEST;
                        custom.bltcon1 = L1614_i_ShiftValue;
                        custom.bltafwm = L1612_i_BlitterFirstWordMask;
                        custom.bltalwm = L1613_i_BlitterLastWordMask;
                        custom.bltapt = (APTR)L1593_pui_SourceBlitBitPlane1;
                        custom.bltamod = L1596_i_SourceBlitModulo;
                        custom.bltbpt = (APTR)L1592_pui_SourceBlitBitPlane0;
                        custom.bltbmod = L1596_i_SourceBlitModulo;
                        custom.bltdpt = (APTR)G0734_ps_AmigaData->BlitterTemporaryBitplane;
                        custom.bltdmod = 0;
                        custom.bltsize = M092_BLITSIZE(L1619_ui_BlitSizeWidthWordCount, L1608_i_BlitSizeHeight);
                        WaitBlit();
                        custom.bltcon0 = (2 << ((P0206_i_TransparentColor & 0x0C) >> 1)) | L1614_i_ShiftValue | SRCA | SRCB | SRCC | DEST;
                        custom.bltcon1 = L1614_i_ShiftValue;
                        custom.bltafwm = L1612_i_BlitterFirstWordMask;
                        custom.bltalwm = L1613_i_BlitterLastWordMask;
                        custom.bltapt = (APTR)L1595_pui_SourceBlitBitPlane3;
                        custom.bltamod = L1596_i_SourceBlitModulo;
                        custom.bltbpt = (APTR)L1594_pui_SourceBlitBitPlane2;
                        custom.bltbmod = L1596_i_SourceBlitModulo;
                        custom.bltcpt = (APTR)G0734_ps_AmigaData->BlitterTemporaryBitplane;
                        custom.bltcmod = 0;
                        custom.bltdpt = (APTR)G0734_ps_AmigaData->BlitterTemporaryBitplane;
                        custom.bltdmod = 0;
                        custom.bltsize = M092_BLITSIZE(L1619_ui_BlitSizeWidthWordCount, L1608_i_BlitSizeHeight);
                } else {
                        WaitBlit();
                        /* Clear all bits in BlitterTemporaryBitplane for the bitmap size (only a part of BlitterTemporaryBitplane is used as it is actually sized to store a 320x200 bitplane) */
                        custom.bltcon0 = DEST;
                        custom.bltcon1 = 0;
                        custom.bltafwm = 0xFFFF;
                        custom.bltalwm = 0xFFFF;
                        custom.bltdpt = (APTR)G0734_ps_AmigaData->BlitterTemporaryBitplane;
                        custom.bltdmod = 0;
                        custom.bltsize = M092_BLITSIZE(L1619_ui_BlitSizeWidthWordCount, L1608_i_BlitSizeHeight);
                }
                WaitBlit();
                custom.bltcon0 = SRCB | DEST | A_OR_B;
                custom.bltcon1 = 0;
                custom.bltafwm = 0xFFFF;
                custom.bltalwm = L1621_i_BlitSizeLastWordMask;
                custom.bltadat = 0xFFFF;
                custom.bltamod = L1604_i_Modulo;
                custom.bltbpt = (APTR)&G0734_ps_AmigaData->BlitterTemporaryBitplane[L1623_i_];
                custom.bltbmod = L1602_i_Modulo;
                custom.bltdpt = (APTR)&G0734_ps_AmigaData->BlitterTemporaryBitplane[L1623_i_];
                custom.bltdmod = L1602_i_Modulo;
                custom.bltsize = M092_BLITSIZE(L1620_i_, L1608_i_BlitSizeHeight);
                WaitBlit();
                custom.bltcon0 = SRCB | DEST | A_OR_B;
                custom.bltcon1 = 0;
                custom.bltafwm = L1622_i_BlitSizeFirstWordMask;
                custom.bltalwm = 0xFFFF;
                custom.bltadat = 0xFFFF;
                custom.bltamod = L1605_i_Modulo;
                custom.bltbpt = (APTR)L1606_pui_;
                custom.bltbmod = L1603_i_Modulo;
                custom.bltdpt = (APTR)L1606_pui_;
                custom.bltdmod = L1603_i_Modulo;
                custom.bltsize = M092_BLITSIZE(16 / 16, L1608_i_BlitSizeHeight);
                WaitBlit();
                if (L1623_i_) {
                        L1591_i_D4 = *L1597_pui_DestinationBlitBitPlane0;
                }
                custom.bltcon0 = L1614_i_ShiftValue | SRCA | SRCB | SRCC | DEST | ABC | ANBC | NABC | ANBNC;
                custom.bltcon1 = 0;
                custom.bltafwm = L1612_i_BlitterFirstWordMask;
                custom.bltalwm = L1613_i_BlitterLastWordMask;
                custom.bltapt = (APTR)L1592_pui_SourceBlitBitPlane0;
                custom.bltamod = L1596_i_SourceBlitModulo;
                custom.bltbpt = (APTR)G0734_ps_AmigaData->BlitterTemporaryBitplane;
                custom.bltbmod = 0;
                custom.bltcpt = (APTR)L1597_pui_DestinationBlitBitPlane0;
                custom.bltcmod = L1601_i_DestinationBlitModulo;
                custom.bltdpt = (APTR)L1597_pui_DestinationBlitBitPlane0;
                custom.bltdmod = L1601_i_DestinationBlitModulo;
                custom.bltsize = M092_BLITSIZE(L1619_ui_BlitSizeWidthWordCount, L1608_i_BlitSizeHeight);
                WaitBlit();
                if (L1623_i_) {
                        *L1597_pui_DestinationBlitBitPlane0 = L1591_i_D4;
                        L1591_i_D4 = *L1598_pui_DestinationBlitBitPlane1;
                }
                custom.bltcon0 = L1614_i_ShiftValue | SRCA | SRCB | SRCC | DEST | ABC | ANBC | NABC | ANBNC;
                custom.bltcon1 = 0;
                custom.bltafwm = L1612_i_BlitterFirstWordMask;
                custom.bltalwm = L1613_i_BlitterLastWordMask;
                custom.bltapt = (APTR)L1593_pui_SourceBlitBitPlane1;
                custom.bltamod = L1596_i_SourceBlitModulo;
                custom.bltbpt = (APTR)G0734_ps_AmigaData->BlitterTemporaryBitplane;
                custom.bltbmod = 0;
                custom.bltcpt = (APTR)L1598_pui_DestinationBlitBitPlane1;
                custom.bltcmod = L1601_i_DestinationBlitModulo;
                custom.bltdpt = (APTR)L1598_pui_DestinationBlitBitPlane1;
                custom.bltdmod = L1601_i_DestinationBlitModulo;
                custom.bltsize = M092_BLITSIZE(L1619_ui_BlitSizeWidthWordCount, L1608_i_BlitSizeHeight);
                WaitBlit();
                if (L1623_i_) {
                        *L1598_pui_DestinationBlitBitPlane1 = L1591_i_D4;
                        L1591_i_D4 = *L1599_pui_DestinationBlitBitPlane2;
                }
                custom.bltcon0 = L1614_i_ShiftValue | SRCA | SRCB | SRCC | DEST | ABC | ANBC | NABC | ANBNC;
                custom.bltcon0 = L1614_i_ShiftValue | SRCA | SRCB | SRCC | DEST | ABC | ANBC | NABC | ANBNC; /* BUG0_00 Useless code. Duplicate line */
                custom.bltcon1 = 0;
                custom.bltafwm = L1612_i_BlitterFirstWordMask;
                custom.bltalwm = L1613_i_BlitterLastWordMask;
                custom.bltapt = (APTR)L1594_pui_SourceBlitBitPlane2;
                custom.bltamod = L1596_i_SourceBlitModulo;
                custom.bltbpt = (APTR)G0734_ps_AmigaData->BlitterTemporaryBitplane;
                custom.bltbmod = 0;
                custom.bltcpt = (APTR)L1599_pui_DestinationBlitBitPlane2;
                custom.bltcmod = L1601_i_DestinationBlitModulo;
                custom.bltdpt = (APTR)L1599_pui_DestinationBlitBitPlane2;
                custom.bltdmod = L1601_i_DestinationBlitModulo;
                custom.bltsize = M092_BLITSIZE(L1619_ui_BlitSizeWidthWordCount, L1608_i_BlitSizeHeight);
                WaitBlit();
                if (L1623_i_) {
                        *L1599_pui_DestinationBlitBitPlane2 = L1591_i_D4;
                        L1591_i_D4 = *L1600_pui_DestinationBlitBitPlane3;
                }
                custom.bltcon0 = L1614_i_ShiftValue | SRCA | SRCB | SRCC | DEST | ABC | ANBC | NABC | ANBNC;
                custom.bltcon1 = 0;
                custom.bltafwm = L1612_i_BlitterFirstWordMask;
                custom.bltalwm = L1613_i_BlitterLastWordMask;
                custom.bltapt = (APTR)L1595_pui_SourceBlitBitPlane3;
                custom.bltamod = L1596_i_SourceBlitModulo;
                custom.bltbpt = (APTR)G0734_ps_AmigaData->BlitterTemporaryBitplane;
                custom.bltbmod = 0;
                custom.bltcpt = (APTR)L1600_pui_DestinationBlitBitPlane3;
                custom.bltcmod = L1601_i_DestinationBlitModulo;
                custom.bltdpt = (APTR)L1600_pui_DestinationBlitBitPlane3;
                custom.bltdmod = L1601_i_DestinationBlitModulo;
                custom.bltsize = M092_BLITSIZE(L1619_ui_BlitSizeWidthWordCount, L1608_i_BlitSizeHeight);
                if (L1623_i_) {
                        WaitBlit();
                        *L1600_pui_DestinationBlitBitPlane3 = L1591_i_D4;
                }
        } else {
                WaitBlit();
                if (L1623_i_) {
                        L1591_i_D4 = *L1597_pui_DestinationBlitBitPlane0;
                }
                custom.bltcon0 = L1614_i_ShiftValue | SRCA | DEST | A_TO_D;
                custom.bltcon1 = 0;
                custom.bltafwm = L1612_i_BlitterFirstWordMask;
                custom.bltalwm = L1613_i_BlitterLastWordMask;
                custom.bltapt = (APTR)L1592_pui_SourceBlitBitPlane0;
                custom.bltamod = L1596_i_SourceBlitModulo;
                custom.bltdpt = (APTR)L1597_pui_DestinationBlitBitPlane0;
                custom.bltdmod = L1601_i_DestinationBlitModulo;
                custom.bltsize = M092_BLITSIZE(L1619_ui_BlitSizeWidthWordCount, L1608_i_BlitSizeHeight);
                WaitBlit();
                if (L1623_i_) {
                        *L1597_pui_DestinationBlitBitPlane0 = L1591_i_D4;
                        L1591_i_D4 = *L1598_pui_DestinationBlitBitPlane1;
                }
                custom.bltcon0 = L1614_i_ShiftValue | SRCA | DEST | A_TO_D;
                custom.bltcon1 = 0;
                custom.bltafwm = L1612_i_BlitterFirstWordMask;
                custom.bltalwm = L1613_i_BlitterLastWordMask;
                custom.bltapt = (APTR)L1593_pui_SourceBlitBitPlane1;
                custom.bltamod = L1596_i_SourceBlitModulo;
                custom.bltdpt = (APTR)L1598_pui_DestinationBlitBitPlane1;
                custom.bltdmod = L1601_i_DestinationBlitModulo;
                custom.bltsize = M092_BLITSIZE(L1619_ui_BlitSizeWidthWordCount, L1608_i_BlitSizeHeight);
                WaitBlit();
                if (L1623_i_) {
                        *L1598_pui_DestinationBlitBitPlane1 = L1591_i_D4;
                        L1591_i_D4 = *L1599_pui_DestinationBlitBitPlane2;
                }
                custom.bltcon0 = L1614_i_ShiftValue | SRCA | DEST | A_TO_D;
                custom.bltcon1 = 0;
                custom.bltafwm = L1612_i_BlitterFirstWordMask;
                custom.bltalwm = L1613_i_BlitterLastWordMask;
                custom.bltapt = (APTR)L1594_pui_SourceBlitBitPlane2;
                custom.bltamod = L1596_i_SourceBlitModulo;
                custom.bltdpt = (APTR)L1599_pui_DestinationBlitBitPlane2;
                custom.bltdmod = L1601_i_DestinationBlitModulo;
                custom.bltsize = M092_BLITSIZE(L1619_ui_BlitSizeWidthWordCount, L1608_i_BlitSizeHeight);
                WaitBlit();
                if (L1623_i_) {
                        *L1599_pui_DestinationBlitBitPlane2 = L1591_i_D4;
                        L1591_i_D4 = *L1600_pui_DestinationBlitBitPlane3;
                }
                custom.bltcon0 = L1614_i_ShiftValue | SRCA | DEST | A_TO_D;
                custom.bltcon1 = 0;
                custom.bltafwm = L1612_i_BlitterFirstWordMask;
                custom.bltalwm = L1613_i_BlitterLastWordMask;
                custom.bltapt = (APTR)L1595_pui_SourceBlitBitPlane3;
                custom.bltamod = L1596_i_SourceBlitModulo;
                custom.bltdpt = (APTR)L1600_pui_DestinationBlitBitPlane3;
                custom.bltdmod = L1601_i_DestinationBlitModulo;
                custom.bltsize = M092_BLITSIZE(L1619_ui_BlitSizeWidthWordCount, L1608_i_BlitSizeHeight);
                if (L1623_i_) {
                        WaitBlit();
                        *L1600_pui_DestinationBlitBitPlane3 = L1591_i_D4;
                }
        }
        DisownBlitter();
        WaitBlit();
#endif
#ifdef MEDIA463_P20JA_P20JB_I34E_I34M_P31J
        int16_t L2192_ai_Box[4];


        if ((P0199_puc_Bitmap_Source == NULL) || (P0200_puc_Bitmap_Destination == NULL)) {
#ifdef MEDIA458_P20JA_P20JB
                (*(G2156_VideoDriver->VIDRV_02_Blit))(P0199_puc_Bitmap_Source, P0200_puc_Bitmap_Destination, P2364_pi_XYZ, P0202_i_X, P0203_i_Y, P0204_i_SourceByteWidth, P0205_i_DestinationByteWidth, P0206_i_TransparentColor, P2365_i_Flip);
#endif
#ifdef MEDIA709_I34E_I34M_P31J
                M768_BOX_LEFT(L2192_ai_Box) = M704_ZONE_LEFT(P2364_pi_XYZ);
                M769_BOX_RIGHT(L2192_ai_Box) = M705_ZONE_RIGHT(P2364_pi_XYZ);
                M770_BOX_TOP(L2192_ai_Box) = M706_ZONE_TOP(P2364_pi_XYZ);
                M771_BOX_BOTTOM(L2192_ai_Box) = M707_ZONE_BOTTOM(P2364_pi_XYZ);
                (*(G2156_VideoDriver->VIDRV_02_Blit))(P0199_puc_Bitmap_Source, P0200_puc_Bitmap_Destination, L2192_ai_Box, P0202_i_X, P0203_i_Y, P0204_i_SourceByteWidth, P0205_i_DestinationByteWidth, P0206_i_TransparentColor, P2365_i_Flip);
#endif
        } else {
                F0684_Blit(P0199_puc_Bitmap_Source, P0200_puc_Bitmap_Destination, P2364_pi_XYZ, P0202_i_X, P0203_i_Y, P0204_i_SourceByteWidth, P0205_i_DestinationByteWidth, P0206_i_TransparentColor, P2365_i_Flip);
        }
#endif
#ifdef MEDIA551_F20E_F20J_F31E_F31J
        register unsigned int16_t L6533_i_X1;
        register unsigned int16_t L6532_i_Y1;
        unsigned int16_t L6528_i_X2;
        register unsigned int16_t L6531_i_Y2;
        int16_t L6529_;
        int16_t L6530_;


        L6533_i_X1 = M704_ZONE_LEFT(P2364_pi_XYZ);
        L6528_i_X2 = M705_ZONE_RIGHT(P2364_pi_XYZ);
        L6532_i_Y1 = M706_ZONE_TOP(P2364_pi_XYZ);
        L6531_i_Y2 = M707_ZONE_BOTTOM(P2364_pi_XYZ);
        P0204_i_SourceByteWidth = ((int)((P0204_i_SourceByteWidth + 31) & 0xFFFFFFE0) >> 1) * 2;
        P0205_i_DestinationByteWidth = ((int)((P0205_i_DestinationByteWidth + 31) & 0xFFFFFFE0) >> 1) * 2;
        L6530_ = L6528_i_X2 - L6533_i_X1 + 1;
        L6529_ = L6531_i_Y2 - L6532_i_Y1 + 1;
        if (P0200_puc_Bitmap_Destination == NULL) {
                if (P0206_i_TransparentColor < 0) {
                        EGB_writeMode(G4105_WORK, 0);
                } else {
                        EGB_writeMode(G4105_WORK, 6);
                        EGB_color(G4105_WORK, 3, P0206_i_TransparentColor);
                }
                EGB_writePage(G4105_WORK, G4103_WRITE_PAGE);
                WORD(G4106_EGBPARA + 0) = L6533_i_X1;
                WORD(G4106_EGBPARA + 2) = L6532_i_Y1;
                WORD(G4106_EGBPARA + 4) = L6528_i_X2;
                WORD(G4106_EGBPARA + 6) = L6531_i_Y2;
                EGB_viewport(G4105_WORK, G4106_EGBPARA);
                WORD(G4106_EGBPARA + 4) = 20;
                WORD(G4106_EGBPARA + 6) = L6533_i_X1 - (P0202_i_X & 1);
                WORD(G4106_EGBPARA + 8) = L6532_i_Y1;
                WORD(G4106_EGBPARA + 10) = L6533_i_X1 - (P0202_i_X & 1) + P0204_i_SourceByteWidth - 1;
                WORD(G4106_EGBPARA + 12) = L6531_i_Y2;
                DWORD(G4106_EGBPARA + 0) = (int)P0199_puc_Bitmap_Source + (P0203_i_Y * (P0204_i_SourceByteWidth >> 1)) + (P0202_i_X >> 1);
                EGB_putBlock(G4105_WORK, 1, G4106_EGBPARA);
        } else {
                if (P0199_puc_Bitmap_Source == NULL) {
                        return;
                }
                EGB_resolutionRam(G4105_WORK, 128, 4, P0205_i_DestinationByteWidth, L6531_i_Y2 + 1, P0200_puc_Bitmap_Destination);
                EGB_writePage(G4105_WORK, 128);
                if (P0206_i_TransparentColor < 0) {
                        EGB_writeMode(G4105_WORK, 0);
                } else {
                        EGB_writeMode(G4105_WORK, 6);
                        EGB_color(G4105_WORK, 3, P0206_i_TransparentColor);
                }
                WORD(G4106_EGBPARA + 0) = L6533_i_X1;
                WORD(G4106_EGBPARA + 2) = L6532_i_Y1;
                WORD(G4106_EGBPARA + 4) = L6528_i_X2;
                WORD(G4106_EGBPARA + 6) = L6531_i_Y2;
                EGB_viewport(G4105_WORK, G4106_EGBPARA);
                WORD(G4106_EGBPARA + 4) = 20;
                WORD(G4106_EGBPARA + 6) = L6533_i_X1 - (P0202_i_X & 1);
                WORD(G4106_EGBPARA + 8) = L6532_i_Y1;
                WORD(G4106_EGBPARA + 10) = L6533_i_X1 - (P0202_i_X & 1) + P0204_i_SourceByteWidth - 1;
                WORD(G4106_EGBPARA + 12) = L6531_i_Y2;
                DWORD(G4106_EGBPARA + 0) = (int)P0199_puc_Bitmap_Source + (P0203_i_Y * (P0204_i_SourceByteWidth >> 1)) + (P0202_i_X >> 1);
                EGB_putBlock(G4105_WORK, 1, G4106_EGBPARA);
        }
#endif
#ifdef MEDIA577_X30J
        long L2193_l_SupervisorStack;


        if (P0199_puc_Bitmap_Source == NULL) {
                return;
        }
        asm {
                        movem.l d3-d7/a2-a5,-(sp)
                        move.l  P2364_pi_XYZ(a6),d0
                        beq.w   @Tloc_4FEA
                        movea.l d0,a2
                        move.l  P0199_puc_Bitmap_Source(a6),d0
                        bne.s   @Tloc_4C88
                        move.l  G3090_X68000VideoMemoryAddress(a5),d0
                        move.w  G3089_(a5),d1
                        bra.s   @Tloc_4C90
                @Tloc_4C88:
                        move.w  P0204_i_SourceByteWidth(a6),d1
                        addq.w  #1,d1
                        lsr.w   #1,d1
                @Tloc_4C90:
                        movea.w d1,a3
                        movea.l d0,a0
                        move.l  P0200_puc_Bitmap_Destination(a6),d0
                        bne.s   @Tloc_4CA4
                        movea.l G3090_X68000VideoMemoryAddress(a5),a1
                        move.w  G3089_(a5),d7
                        bra.s   @Tloc_4CAE
                @Tloc_4CA4:
                        move.w  P0205_i_DestinationByteWidth(a6),d7
                        addq.w  #1,d7
                        lsr.w   #1,d7
                        movea.l d0,a1
                @Tloc_4CAE:
                        movea.w d7,a4
                        move.w  P0202_i_X(a6),d4
                        move.w  P0203_i_Y(a6),d3
                        moveq   #0,d5
                        moveq   #0,d6
                        mulu.w  d1,d3
                        adda.l  d3,a0
                        lsr.w   #1,d4
                        adda.w  d4,a0
                        addx.b  d5,d5
                        moveq   #0,d1
                        moveq   #0,d2
                        moveq   #0,d3
                        moveq   #0,d4
                        move.w  (a2)+,d4
                        move.w  (a2)+,d2
                        tst.l   d0
                        beq.w   @Tloc_4F20
                        btst    d1,d2
                        bne.s   @Tloc_4CE2
                        move.b  #0xF0,d6
                        bra.s   @Tloc_4CE6
                @Tloc_4CE2:
                        move.b  #0xFF,d6
                @Tloc_4CE6:
                        sub.w   d4,d2
                        move.w  d2,d0
                        lsr.w   #1,d2
                        move.w  (a2)+,d3
                        move.w  (a2)+,d1
                        sub.w   d3,d1
                        swap    d6
                        mulu.w  d7,d3
                        adda.l  d3,a1
                        lsr.w   #1,d4
                        adda.w  d4,a1
                        addx.b  d6,d6
                        swap    d5
                        tst.w   d6
                        beq.s   @Tloc_4D0A
                        move.b  #0xF,d5
                        bra.s   @Tloc_4D0E
                @Tloc_4D0A:
                        move.b  #0xFF,d5
                @Tloc_4D0E:
                        swap    d6
                        move.b  d6,d4
                        and.b   d5,d4
                        beq.s   @Tloc_4D18
                        subq.w  #1,d2
                @Tloc_4D18:
                        suba.w  d2,a3
                        subq.w  #1,a3
                        suba.w  d2,a4
                        subq.w  #1,a4
                        tst.w   d2
                        bpl.s   @Tloc_4D2E
                        tst.w   d0
                        bne.s   @Tloc_4D2C
                        and.b   d5,d6
                        bra.s   @Tloc_4D2E
                @Tloc_4D2C:
                        or.b    d5,d6
                @Tloc_4D2E:
                        move.w  P0206_i_TransparentColor(a6),d0
                        bmi.s   @Tloc_4D40
                        moveq   #8,d4
                        move.w  d0,d3
                        asl.w   d4,d3
                        movea.l G3084_puc_X68000_4096bytes(a5),a2
                        adda.w  d3,a2
                @Tloc_4D40:
                        swap    d6
                        swap    d5
                        eor.w   d5,d6
                        bne.w   @Tloc_4DEA
                        swap    d6
                        swap    d5
                        tst.w   d0
                        bpl.s   @Tloc_4D9A
                @Tloc_4D52:
                        move.w  d2,d3
                        bmi.s   @Tloc_4D82
                        move.b  (a0)+,d0
                        move.b  (a1),d4
                        eor.b   d4,d0
                        and.b   d5,d0
                        eor.b   d4,d0
                        move.b  d0,(a1)+
                        subq.w  #1,d3
                        bmi.s   @Tloc_4D82
                        move.w  a0,d0
                        move.w  a1,d7
                        or.w    d0,d7
                        andi.w  #1,d7
                        bne.s   @Tloc_4D7C
                        bra.s   @Tloc_4D76
                @Tloc_4D74:
                        move.l  (a0)+,(a1)+
                @Tloc_4D76:
                        subq.w  #4,d3
                        bge.s   @Tloc_4D74
                        addq.w  #4,d3
                @Tloc_4D7C:
                        move.b  (a0)+,(a1)+
                        dbf     d3,@Tloc_4D7C
                @Tloc_4D82:
                        move.b  (a0),d0
                        move.b  (a1),d4
                        eor.b   d4,d0
                        and.b   d6,d0
                        eor.b   d4,d0
                        move.b  d0,(a1)
                        adda.l  a3,a0
                        adda.l  a4,a1
                        dbf     d1,@Tloc_4D52
                        bra.w   @Tloc_4FEA
                @Tloc_4D9A:
                        swap    d1
                        move.w  d2,d3
                        bmi.s   @Tloc_4DCA
                        move.b  (a0)+,d0
                        move.b  (a2,d0.w),d1
                        move.b  (a1),d4
                        eor.b   d4,d0
                        and.b   d1,d0
                        and.b   d5,d0
                        eor.b   d4,d0
                        move.b  d0,(a1)+
                        subq.w  #1,d3
                        bmi.s   @Tloc_4DCA
                @Tloc_4DB6:
                        move.b  (a0)+,d0
                        move.b  (a2,d0.w),d1
                        move.b  (a1),d4
                        eor.b   d4,d0
                        and.b   d1,d0
                        eor.b   d4,d0
                        move.b  d0,(a1)+
                        dbf     d3,@Tloc_4DB6
                @Tloc_4DCA:
                        move.b  (a0),d0
                        move.b  (a2,d0.w),d1
                        move.b  (a1),d4
                        eor.b   d4,d0
                        and.b   d1,d0
                        and.b   d6,d0
                        eor.b   d4,d0
                        move.b  d0,(a1)
                        adda.l  a3,a0
                        adda.l  a4,a1
                        swap    d1
                        dbf     d1,@Tloc_4D9A
                        bra.w   @Tloc_4FEA
                @Tloc_4DEA:
                        move.l  a6,-(sp)
                        movea.l G3083_puc_X68000_256bytes(a5),a5
                        move.b  #0xF,d6
                        moveq   #0,d7
                        tst.w   d0
                        bpl.w   @Tloc_4E80
                        moveq   #0,d0
                        tst.w   d5
                        bne.s   @Tloc_4E08
                        lea     @Tloc_4E1E,a6
                        bra.s   @Tloc_4E0E
                @Tloc_4E08:
                        lea     @Tloc_4E14,a6
                        subq.l  #1,a3
                @Tloc_4E0E:
                        move.b  #0xF0,d5
                @Tloc_4E12:
                        jmp     (a6)
                @Tloc_4E14:
                        move.b  (a0)+,d7
                        move.b  (a5,d7.w),d7
                        and.b   d5,d7
                        swap    d7
                @Tloc_4E1E:
                        move.w  d2,d3
                        bmi.s   @Tloc_4E5A
                        move.b  (a0)+,d0
                        move.b  (a5,d0.w),d0
                        move.b  d0,d7
                        and.b   d5,d7
                        and.b   d6,d0
                        swap    d7
                        or.b    d7,d0
                        move.b  (a1),d4
                        eor.b   d4,d0
                        swap    d5
                        and.b   d5,d0
                        swap    d5
                        eor.b   d4,d0
                        move.b  d0,(a1)+
                        subq.w  #1,d3
                        bmi.s   @Tloc_4E5A
                @Tloc_4E44:
                        move.b  (a0)+,d0
                        move.b  (a5,d0.w),d0
                        move.b  d0,d7
                        and.b   d5,d7
                        and.b   d6,d0
                        swap    d7
                        or.b    d7,d0
                        move.b  d0,(a1)+
                        dbf     d3,@Tloc_4E44
                @Tloc_4E5A:
                        move.b  (a0),d0
                        move.b  (a5,d0.w),d0
                        and.b   d6,d0
                        swap    d7
                        or.b    d7,d0
                        move.b  (a1),d4
                        eor.b   d4,d0
                        swap    d6
                        and.b   d6,d0
                        swap    d6
                        eor.b   d4,d0
                        move.b  d0,(a1)
                        adda.l  a3,a0
                        adda.l  a4,a1
                        dbf     d1,@Tloc_4E12
                        bra.w   @Tloc_4FE8
                @Tloc_4E80:
                        moveq   #0,d0
                        tst.w   d5
                        bne.s   @Tloc_4E8C
                        lea     @Tloc_4EA4,a6
                        bra.s   @Tloc_4E92
                @Tloc_4E8C:
                        lea     @Tloc_4E9A,a6
                        subq.l  #1,a3
                @Tloc_4E92:
                        move.b  #0xF0,d5
                @Tloc_4E96:
                        swap    d1
                        jmp     (a6)
                @Tloc_4E9A:
                        move.b  (a0)+,d7
                        move.b  (a5,d7.w),d7
                        and.b   d5,d7
                        swap    d7
                @Tloc_4EA4:
                        move.w  d2,d3
                        bmi.s   @Tloc_4EF2
                        move.b  (a0)+,d0
                        move.b  (a5,d0.w),d0
                        move.b  d0,d7
                        and.b   d5,d7
                        and.b   d6,d0
                        swap    d7
                        or.b    d7,d0
                        move.b  (a2,d0.w),d1
                        move.b  (a1),d4
                        eor.b   d4,d0
                        swap    d5
                        and.b   d5,d0
                        swap    d5
                        and.b   d1,d0
                        eor.b   d4,d0
                        move.b  d0,(a1)+
                        subq.w  #1,d3
                        bmi.s   @Tloc_4EF2
                @Tloc_4ED0:
                        move.b  (a0)+,d0
                        move.b  (a5,d0.w),d0
                        move.b  d0,d7
                        and.b   d5,d7
                        and.b   d6,d0
                        swap    d7
                        or.b    d7,d0
                        move.b  (a2,d0.w),d1
                        move.b  (a1),d4
                        eor.b   d4,d0
                        and.b   d1,d0
                        eor.b   d4,d0
                        move.b  d0,(a1)+
                        dbf     d3,@Tloc_4ED0
                @Tloc_4EF2:
                        move.b  (a0),d0
                        move.b  (a5,d0.w),d0
                        and.b   d6,d0
                        swap    d7
                        or.b    d7,d0
                        move.b  (a2,d0.w),d1
                        move.b  (a1),d4
                        eor.b   d4,d0
                        swap    d6
                        and.b   d6,d0
                        swap    d6
                        and.b   d1,d0
                        eor.b   d4,d0
                        move.b  d0,(a1)
                        adda.l  a3,a0
                        adda.l  a4,a1
                        swap    d1
                        dbf     d1,@Tloc_4E96
                        bra.w   @Tloc_4FE8
                @Tloc_4F20:
                        adda.w  d4,a1
                        adda.w  d4,a1
                        sub.w   d4,d2
                        addq.w  #1,d2
                        suba.w  d2,a4
                        suba.w  d2,a4
                        add.w   d5,d2
                        swap    d5
                        lsr.w   #1,d2
                        suba.w  d2,a3
                        bcc.s   @Tloc_4F3A
                        addq.w  #1,d5
                        subq.l  #1,a3
                @Tloc_4F3A:
                        move.w  (a2)+,d3
                        move.w  (a2)+,d1
                        sub.w   d3,d1
                        mulu.w  d7,d3
                        adda.l  d3,a1
                        clr.l   -(sp)
                        dc.w    0xFF20  /* DOS CALL SUPER */
                        move.l  d0,L2193_l_SupervisorStack(a6)
                        move.w  P0206_i_TransparentColor(a6),d4
                        bpl.s   @Tloc_4F90
                        movea.l G3085_pul_X68000_1024bytes(a5),a5
                @Tloc_4F56:
                        move.w  d2,d3
                        swap    d5
                        tst.w   d5
                        beq.s   @Tloc_4F74
                        moveq   #0xF,d0
                        and.b   (a0)+,d0
                        move.w  d0,(a1)+
                        subq.w  #2,d3
                        bmi.s   @Tloc_4F78
                @Tloc_4F68:
                        moveq   #0,d0
                        move.b  (a0)+,d0
                        add.w   d0,d0
                        add.w   d0,d0
                        move.l  (a5,d0.w),(a1)+
                @Tloc_4F74:
                        subq.w  #1,d3
                        bpl.s   @Tloc_4F68
                @Tloc_4F78:
                        swap    d5
                        tst.w   d5
                        beq.s   @Tloc_4F84
                        move.b  (a0)+,d0
                        lsr.b   #4,d0
                        move.w  d0,(a1)+
                @Tloc_4F84:
                        adda.l  a3,a0
                        adda.l  a4,a1
                        subq.w  #1,d1
                        bpl.s   @Tloc_4F56
                        bra.w   @Tloc_4FDE
                @Tloc_4F90:
                        move.w  d2,d3
                        swap    d5
                        tst.w   d5
                        beq.s   @Tloc_4FC0
                        moveq   #0xF,d0
                        and.b   (a0)+,d0
                        cmp.b   d0,d4
                        beq.s   @Tloc_4FA2
                        move.w  d0,(a1)
                @Tloc_4FA2:
                        addq.l  #2,a1
                        subq.w  #2,d3
                        bmi.s   @Tloc_4FC4
                @Tloc_4FA8:
                        move.b  (a0)+,d0
                        moveq   #0xF,d6
                        and.b   d0,d6
                        lsr.b   #4,d0
                        cmp.b   d0,d4
                        beq.s   @Tloc_4FB6
                        move.w  d0,(a1)
                @Tloc_4FB6:
                        addq.l  #2,a1
                        cmp.b   d6,d4
                        beq.s   @Tloc_4FBE
                        move.w  d6,(a1)
                @Tloc_4FBE:
                        addq.l  #2,a1
                @Tloc_4FC0:
                        subq.w  #1,d3
                        bpl.s   @Tloc_4FA8
                @Tloc_4FC4:
                        swap    d5
                        tst.w   d5
                        beq.s   @Tloc_4FD6
                        move.b  (a0)+,d0
                        lsr.b   #4,d0
                        cmp.b   d0,d4
                        beq.s   @Tloc_4FD4
                        move.w  d0,(a1)
                @Tloc_4FD4:
                        addq.l  #2,a1
                @Tloc_4FD6:
                        adda.l  a3,a0
                        adda.l  a4,a1
                        subq.w  #1,d1
                        bpl.s   @Tloc_4F90
                @Tloc_4FDE:
                        move.l  L2193_l_SupervisorStack(a6),-(sp)
                        dc.w    0xFF20  /* DOS CALL SUPER */
                        addq.l  #4,sp
                        bra.s   @Tloc_4FEA
                @Tloc_4FE8:
                        movea.l (sp)+,a6
                @Tloc_4FEA:
                        movem.l (sp)+,d3-d7/a2-a5
        }
#endif
#ifdef MEDIA692_X31J
        if (P0200_puc_Bitmap_Destination == NULL) {
                VDEO_06_BlitToScreen(P0199_puc_Bitmap_Source, 0, P2364_pi_XYZ, P0202_i_X, P0203_i_Y, P0204_i_SourceByteWidth, P0206_i_TransparentColor, 0);
        } else {
                GRF1_06_Blit(P0199_puc_Bitmap_Source, P0200_puc_Bitmap_Destination, P2364_pi_XYZ, P0202_i_X, P0203_i_Y, P0204_i_SourceByteWidth, P0205_i_DestinationByteWidth, P0206_i_TransparentColor, 0, 0);
        }
#endif
#ifdef MEDIA752_A36M_A31E_A31M_A33M_A35E_A35M_AU1E_AU2E
        register int16_t L2199_i_;
        register int16_t L2200_i_;
        register int16_t L2201_i_;
        register int16_t L2202_i_;
        register int16_t L2203_i_;
#if ((EXETYPE == C03_GAME) || (EXETYPE == C18_VDEO))
        int16_t L2204_ai_XYZ[4];
#endif
        int16_t L2205_ai_XYZ[4];


#if (EXETYPE == C18_VDEO)
        if (P0200_pui_Bitmap_Destination == NULL) {
                return;
        }
#endif
#if ((EXETYPE == C03_GAME) || (EXETYPE == C18_VDEO))
        F1132_ConvertBoxCoordinates(P2364_pi_XYZ, L2204_ai_XYZ);
#endif
#if ((EXETYPE == C03_GAME) || (EXETYPE == C06_CEDT) || (EXETYPE == C07_HINT))
        if (P0200_pui_Bitmap_Destination == G0348_Bitmap_Screen) {
                P0200_pui_Bitmap_Destination = NULL;
        }
#endif
#if ((EXETYPE == C03_GAME) || (EXETYPE == C18_VDEO))
        L2201_i_ = (L2204_ai_XYZ[3] - L2204_ai_XYZ[2] + 1);
#endif
#if ((EXETYPE == C06_CEDT) || (EXETYPE == C07_HINT))
        L2201_i_ = (P2364_pi_XYZ[3] - P2364_pi_XYZ[2] + 1);
#endif
        if (!P0200_pui_Bitmap_Destination && (L2201_i_ > 63)) {
                L2203_i_ = (L2201_i_ > 127) ? 3 : 2;
                L2202_i_ = (L2201_i_ / L2203_i_) + 2;
#if ((EXETYPE == C03_GAME) || (EXETYPE == C18_VDEO))
                L2205_ai_XYZ[0] = L2204_ai_XYZ[0];
                L2205_ai_XYZ[1] = L2204_ai_XYZ[1];
                L2205_ai_XYZ[2] = L2204_ai_XYZ[2];
#endif
#if ((EXETYPE == C06_CEDT) || (EXETYPE == C07_HINT))
                L2205_ai_XYZ[0] = P2364_pi_XYZ[0];
                L2205_ai_XYZ[1] = P2364_pi_XYZ[1];
                L2205_ai_XYZ[2] = P2364_pi_XYZ[2];
#endif
                if (G3125_B_) {
                        G3125_B_ = C0_FALSE;
                } else {
                        asm {
#if ((EXETYPE == C03_GAME) || (EXETYPE == C18_VDEO))
                                        lea     L2204_ai_XYZ(a6),a0
#endif
#if ((EXETYPE == C06_CEDT) || (EXETYPE == C07_HINT))
                                        movea.l P2364_pi_XYZ(a6),a0
#endif
                                        moveq   #0,d2
                                        move.w  d4,d2
                                        add.w   4(a0),d2
                                        addi.w  #0x2C,d2
                                        lsl.l   #8,d2
                                        lea     (0xDFF004).l,a0
                                        move.l  #0x1FF00,d1
                                @Tloc_191F8:
                                        move.l  (a0),d0
                                        andi.l  #0x10000,d0
                                        bne.s   @Tloc_191F8
                                @Tloc_19202:
                                        move.l  (a0),d0
                                        and.l   d1,d0
                                        cmp.l   d2,d0
                                        bgt.s   @Tloc_19202
                                @Tloc_1920A:
                                        move.l  (a0),d0
                                        and.l   d1,d0
                                        cmp.l   d2,d0
                                        blt.s   @Tloc_1920A
#if ((EXETYPE == C03_GAME) || (EXETYPE == C18_VDEO))
                                        move.l  (a0),d0
                                        lsr.l   #8,d0
                                        andi.w  #0x1FF,d0
                                        cmpi.w  #256,d0
                                        beq.s   @Tloc_19202
#endif
                        }
                }
                for (L2199_i_ = 0; L2199_i_ < L2203_i_; L2199_i_++) {
                        L2200_i_ = (L2202_i_ < L2201_i_) ? L2202_i_ : L2201_i_;
                        L2205_ai_XYZ[3] = L2205_ai_XYZ[2] + L2200_i_ - 1;
                        F1013_Blit_Amiga(P0199_pui_Bitmap_Source, P0200_pui_Bitmap_Destination, L2205_ai_XYZ, P0202_i_X, P0203_i_Y, P0204_i_SourceByteWidth, P0205_i_DestinationByteWidth, P0206_i_TransparentColor, P0925_i_SourceHeight, P0926_i_DestinationHeight);
                        P0203_i_Y += L2200_i_;
                        L2201_i_ -= L2202_i_;
                        L2205_ai_XYZ[2] = L2205_ai_XYZ[3] + 1;
                }
        } else {
                if (G3125_B_) {
                        G3125_B_ = C0_FALSE;
                } else {
                        if (!P0200_pui_Bitmap_Destination) {
                                asm {
#if ((EXETYPE == C03_GAME) || (EXETYPE == C18_VDEO))
                                                lea     L2204_ai_XYZ(a6),a0
#endif
#if ((EXETYPE == C06_CEDT) || (EXETYPE == C07_HINT))
                                                movea.l P2364_pi_XYZ(a6),a0
#endif
                                                moveq   #0,d2
                                                move.w  6(a0),d2
                                                addi.w  #0x2C,d2
                                                lsl.l   #8,d2
                                                lea     (0xDFF004).l,a0
                                                move.l  #0x1FF00,d1
                                        @Tloc_192B2:
                                                move.l  (a0),d0
                                                and.l   d1,d0
                                                cmp.l   d2,d0
                                                blt.s   @Tloc_192B2
                                }
                        }
                }
#if ((EXETYPE == C03_GAME) || (EXETYPE == C18_VDEO))
                F1013_Blit_Amiga(P0199_pui_Bitmap_Source, P0200_pui_Bitmap_Destination, L2204_ai_XYZ, P0202_i_X, P0203_i_Y, P0204_i_SourceByteWidth, P0205_i_DestinationByteWidth, P0206_i_TransparentColor, P0925_i_SourceHeight, P0926_i_DestinationHeight);
#endif
#if ((EXETYPE == C06_CEDT) || (EXETYPE == C07_HINT))
                F1013_Blit_Amiga(P0199_pui_Bitmap_Source, P0200_pui_Bitmap_Destination, P2364_pi_XYZ, P0202_i_X, P0203_i_Y, P0204_i_SourceByteWidth, P0205_i_DestinationByteWidth, P0206_i_TransparentColor, P0925_i_SourceHeight, P0926_i_DestinationHeight);
#endif
        }
#endif
}
#endif
