#ifndef COMPILE_H
#include "COMPILE.H"
#endif
#ifdef MEDIA678_F31E_F31J_X31J_P31J_SU1E_AU1E_AU2E_AU3E
unsigned int16_t F7276_GetPixelColor(
#ifdef MEDIA772_SU1E
unsigned char* P4045_puc_Bitmap, int16_t P4046_i_PixelX, int16_t P4047_i_PixelY, unsigned int16_t P4048_ui_Width)
#endif
#ifdef MEDIA764_AU1E_AU2E_AU3E
unsigned char* P4045_puc_Bitmap, int16_t P4046_i_PixelX, int16_t P4047_i_PixelY, unsigned int16_t P4048_ui_Width, unsigned int16_t P4049_ui_Height)
#endif
#ifdef MEDIA671_F31E_F31J_P31J
unsigned char* P4045_puc_Bitmap, int16_t P4046_i_PixelX, int16_t P4047_i_PixelY, unsigned int16_t P4048_ui_Width, unsigned int16_t P4049_ui_Height)
#endif
#ifdef MEDIA692_X31J
register unsigned char* P4045_puc_Bitmap, int16_t P4046_i_PixelX, int16_t P4047_i_PixelY, register unsigned int16_t P4048_ui_Width, unsigned int16_t P4049_ui_Height)
#endif
{
#ifdef MEDIA772_SU1E
        asm {
                        movea.l d5,a1
                        move.w  P4046_i_PixelX(a6),d1
                        moveq   #0xF,d2
                        and.w   d1,d2
                        movea.l P4045_puc_Bitmap(a6),a0
                        move.w  P4047_i_PixelY(a6),d0
                        mulu.w  P4048_ui_Width(a6),d0
                        lsr.w   #1,d1
                        andi.w  #0xF8,d1
                        add.w   d1,d0
                        adda.w  d0,a0
                        moveq   #0xF,d5
                        sub.w   d2,d5
                        movem.w (a0),d0-d3
                        btst    d5,d3
                        bne.s   @Tloc_676C
                        btst    d5,d2
                        bne.s   @Tloc_6750
                        btst    d5,d1
                        bne.s   @Tloc_6744
                        btst    d5,d0
                        bne.s   @Tloc_6740
                        moveq   #0,d0
                        bra.s   @Tloc_67A6
                @Tloc_6740:
                        moveq   #1,d0
                        bra.s   @Tloc_67A6
                @Tloc_6744:
                        btst    d5,d0
                        bne.s   @Tloc_674C
                        moveq   #2,d0
                        bra.s   @Tloc_67A6
                @Tloc_674C:
                        moveq   #3,d0
                        bra.s   @Tloc_67A6
                @Tloc_6750:
                        btst    d5,d1
                        bne.s   @Tloc_6760
                        btst    d5,d0
                        bne.s   @Tloc_675C
                        moveq   #4,d0
                        bra.s   @Tloc_67A6
                @Tloc_675C:
                        moveq   #5,d0
                        bra.s   @Tloc_67A6
                @Tloc_6760:
                        btst    d5,d0
                        bne.s   @Tloc_6768
                        moveq   #6,d0
                        bra.s   @Tloc_67A6
                @Tloc_6768:
                        moveq   #7,d0
                        bra.s   @Tloc_67A6
                @Tloc_676C:
                        btst    d5,d2
                        bne.s   @Tloc_678C
                        btst    d5,d1
                        bne.s   @Tloc_6780
                        btst    d5,d0
                        bne.s   @Tloc_677C
                        moveq   #8,d0
                        bra.s   @Tloc_67A6
                @Tloc_677C:
                        moveq   #9,d0
                        bra.s   @Tloc_67A6
                @Tloc_6780:
                        btst    d5,d0
                        bne.s   @Tloc_6788
                        moveq   #0xA,d0
                        bra.s   @Tloc_67A6
                @Tloc_6788:
                        moveq   #0xB,d0
                        bra.s   @Tloc_67A6
                @Tloc_678C:
                        btst    d5,d1
                        bne.s   @Tloc_679C
                        btst    d5,d0
                        bne.s   @Tloc_6798
                        moveq   #0xC,d0
                        bra.s   @Tloc_67A6
                @Tloc_6798:
                        moveq   #0xD,d0
                        bra.s   @Tloc_67A6
                @Tloc_679C:
                        btst    d5,d0
                        bne.s   @Tloc_67A4
                        moveq   #0xE,d0
                        bra.s   @Tloc_67A6
                @Tloc_67A4:
                        moveq   #0xF,d0
                @Tloc_67A6:
                        move.l  a1,d5
        }
#endif
#ifdef MEDIA764_AU1E_AU2E_AU3E
        asm {
                        move.l  d3,-(sp)
                        move.w  d7,-(sp)
                        move.w  P4047_i_PixelY(a6),d1
                        move.w  P4046_i_PixelX(a6),d7
                        move.w  P4048_ui_Width(a6),d2
                        move.w  P4049_ui_Height(a6),d3
                        movea.l P4045_puc_Bitmap(a6),a0
#ifdef MEDIA762_AU1E
                        lsr.w   #2,d2
#endif
#ifdef MEDIA768_AU2E_AU3E
                        lsr.w   #3,d2
#endif
                        mulu.w  d2,d1
                        mulu.w  d2,d3
                        move.w  d7,d2
                        lsr.w   #3,d2
                        add.w   d2,d1
                        adda.w  d1,a0
                        andi.w  #7,d7
                        subq.w  #7,d7
                        neg.w   d7
                        moveq   #0,d0
                        btst    d7,(a0)
                        beq.s   @Tloc_7A34
                        bset    #0,d0
                @Tloc_7A34:
                        adda.w  d3,a0
                        btst    d7,(a0)
                        beq.s   @Tloc_7A3E
                        bset    #1,d0
                @Tloc_7A3E:
                        adda.w  d3,a0
                        btst    d7,(a0)
                        beq.s   @Tloc_7A48
                        bset    #2,d0
                @Tloc_7A48:
                        adda.w  d3,a0
                        btst    d7,(a0)
                        beq.s   @Tloc_7A52
                        bset    #3,d0
                @Tloc_7A52:
                        move.w  (sp)+,d7
                        move.l  (sp)+,d3
        }
#endif
#ifdef MEDIA692_X31J
        P4048_ui_Width++;
        P4048_ui_Width >>= 1;
        P4045_puc_Bitmap += (P4048_ui_Width * P4047_i_PixelY) + (P4046_i_PixelX >> 1);
        if (P4046_i_PixelX & 1) {
                return *P4045_puc_Bitmap & 0x0F;
        } else {
                return *P4045_puc_Bitmap >> 4;
        }
#endif
#ifdef MEDIA671_F31E_F31J_P31J
        int16_t L4112_i_;


#ifdef MEDIA667_P31J
        L4112_i_ = P4045_puc_Bitmap[(P4046_i_PixelX >> 1) + ((((P4048_ui_Width + 1) & 0xFFFE) >> 1) * P4047_i_PixelY)];
        if (P4046_i_PixelX & 1) {
                L4112_i_ &= 0x0F;
        } else {
                L4112_i_ = L4112_i_ >> 4;
        }
#endif
#ifdef MEDIA670_F31E_F31J
        L4112_i_ = P4045_puc_Bitmap[(P4046_i_PixelX >> 1) + (((int)((P4048_ui_Width + 31) & 0xFFFFFFE0) >> 1) * P4047_i_PixelY)];
        if (P4046_i_PixelX & 1) {
                L4112_i_ = L4112_i_ >> 4;
        } else {
                L4112_i_ &= 0x0F;
        }
#endif
        return L4112_i_;
#endif
}
#endif
