#define ANOMALY_IO
#ifndef COMPILE_H
#include "COMPILE.H"
#endif
#ifdef MEDIA042_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
#ifdef MEDIA055_S10EA_S10EB_S11E_S12E_S12G_S13FA_S13FB_S20E_S21E_G14ED_G20E_G21E_A20ED_A20E_A20F_A20G_A21E_A22E_A22G_F20E_F20J_X30J_A36M_A31E_A31M_A33M_A35E_A35M_F31E_F31J_X31J
int16_t G0587_i_HideMousePointerRequestCount = 1;
#endif
#ifdef MEDIA143_S10EA_S10EB_S11E_S12E_S12G_S13FA_S13FB_S20E_S21E_A20ED_A20E_A20F_A20G_A21E_A22E_A22G_F20E_F20J_X30J_A36M_A31E_A31M_A33M_A35E_A35M_F31E_F31J_X31J
int16_t G0588_i_MouseButtonsStatus;
#endif
#ifdef MEDIA388_G20E_G21E
BOOLEAN G4018_B_;
BOOLEAN G4025_B_;
#endif
#ifdef MEDIA551_F20E_F20J_F31E_F31J
int16_t G2010_; /* G0589_i_MousePointerHotspotX ? */
int16_t G2011_; /* G0590_i_MousePointerHotspotY ? */
#endif
#ifdef MEDIA613_X30J_A36M_A31E_A31M_A33M_A35E_A35M_X31J
int16_t G3114_;
int16_t G3112_;
char G3132_Unreferenced[12];
#endif
#ifdef MEDIA744_A36M
char G3254_Unreferenced[4];
#endif
#ifdef MEDIA351_G14ED_G20E_G21E
long G4054_l_Unreferenced;
#endif
#ifdef MEDIA009_S10EA_S10EB_S11E_S12E_S12G_S13FA_S13FB_S20E_S21E_G14ED_G20E_G21E_A20ED_A20E_A20F_A20G_A21E_A22E_A22G
int16_t G0589_i_MousePointerHotspotX;
int16_t G0590_i_MousePointerHotspotY;
#endif
#ifdef MEDIA008_S10EA_S10EB_S11E_S12E_S12G_S13FA_S13FB_S20E_S21E_G14ED_G20E_G21E
long G0591_l_MousePointerYX;
#endif
#ifdef MEDIA551_F20E_F20J_F31E_F31J
int16_t G4128_VIS_MX; /* G0591_l_MousePointerYX */
int16_t G4129_VIS_MY; /* G0591_l_MousePointerYX */
unsigned char* G4130_MOUSE_SAVE;
unsigned char* G4131_MMOUSE_VECT;
unsigned char* G4132_BMOUSE_VECT;
#endif
#ifdef MEDIA055_S10EA_S10EB_S11E_S12E_S12G_S13FA_S13FB_S20E_S21E_G14ED_G20E_G21E_A20ED_A20E_A20F_A20G_A21E_A22E_A22G_F20E_F20J_X30J_A36M_A31E_A31M_A33M_A35E_A35M_F31E_F31J_X31J
BOOLEAN G0592_B_BuildMousePointerScreenAreaRequested;
BOOLEAN G0593_B_BuildMousePointerScreenAreaCompleted; /* FM-Towns variable name: DRAW_MOUSE */
BOOLEAN G0594_B_BuildMousePointerScreenAreaRequestedInMouseException; /* FM-Towns variable name: MSE_ON */
BOOLEAN G0595_B_MousePointerVisible; /* FM-Towns variable name: MSE_SEEN */ /* Unreferenced in Amiga */
BOOLEAN G0596_B_NoDrawInVerticalBlankWhileHidingMousePointer; /* FM-Towns variable name: IN_MOUSE_OFF */ /* Unreferenced in Amiga */
BOOLEAN G0597_B_IgnoreMouseMovements;
BOOLEAN G0598_B_MousePointerBitmapUpdated = C1_TRUE;
#endif
#ifdef MEDIA006_S10EA_S10EB_S11E_S12E_S12G_S13FA_S13FB /* CHANGE7_09_OPTIMIZATION Variables reordered */
int16_t G0603_i_MousePointerScreenAreaCurrentX;
int16_t G0604_i_MousePointerScreenAreaCurrentY;
#endif
#ifdef MEDIA055_S10EA_S10EB_S11E_S12E_S12G_S13FA_S13FB_S20E_S21E_G14ED_G20E_G21E_A20ED_A20E_A20F_A20G_A21E_A22E_A22G_F20E_F20J_X30J_A36M_A31E_A31M_A33M_A35E_A35M_F31E_F31J_X31J
unsigned int16_t G0599_ui_UseChampionIconOrdinalAsMousePointerBitmap; /* If non zero then the mouse pointer bitmap is a champion icon */
BOOLEAN G0600_B_UseObjectAsMousePointerBitmap; /* If true and G0599_ui_UseChampionIconOrdinalAsMousePointerBitmap = 0 then the mouse pointer bitmap is an object icon */
BOOLEAN G0601_B_UseHandAsMousePointerBitmap; /* If true and G0600_B_UseObjectAsMousePointerBitmap = C0_FALSE and G0599_ui_UseChampionIconOrdinalAsMousePointerBitmap = 0 then the mouse pointer bitmap is the hand else it is the arrow */
#endif
#ifdef MEDIA603_X30J_A31E_A31M_A33M_A35E_A35M_X31J
char G3133_Unreferenced[10];
#endif
#ifdef MEDIA744_A36M
char G3133_Unreferenced[4];
#endif
#ifdef MEDIA008_S10EA_S10EB_S11E_S12E_S12G_S13FA_S13FB_S20E_S21E_G14ED_G20E_G21E
BOOLEAN G0602_B_CurrentMousePointerIsObject = C0_FALSE;
#endif
#ifdef MEDIA267_S20E_S21E_G14ED_G20E_G21E_A20ED_A20E_A20F_A20G_A21E_A22E_A22G /* CHANGE7_09_OPTIMIZATION Variables reordered */
int16_t G0603_i_MousePointerScreenAreaCurrentX; /* Unreferenced in Amiga */
int16_t G0604_i_MousePointerScreenAreaCurrentY; /* Unreferenced in Amiga */
#endif
#ifdef MEDIA009_S10EA_S10EB_S11E_S12E_S12G_S13FA_S13FB_S20E_S21E_G14ED_G20E_G21E_A20ED_A20E_A20F_A20G_A21E_A22E_A22G
int16_t G0605_i_MousePointerBitmapHotspotX;
int16_t G0606_i_MousePointerBitmapHotspotY;
#endif
#ifdef MEDIA351_G14ED_G20E_G21E
int16_t G4046_i_;
unsigned int16_t* G4019_pui_;
unsigned int16_t* G4020_pui_;
char* G4014_pc_;
char* G4012_pc_;
unsigned char* G4017_puc_;
#endif
#ifdef MEDIA349_G14ED
BOOLEAN G4018_B_;
#endif
#ifdef MEDIA551_F20E_F20J_F31E_F31J
char G4137_MSE_SHAPE[6];
int16_t G4138_CURSORFLAG;
unsigned char* G4139_CYAN_ARROW_CURSOR;/*Unreferenced*/
unsigned char* G4140_CYAN_HAND_CURSOR;/*Unreferenced*/
unsigned char* G0615_puc_Bitmap_MousePointerOriginalColorsObject;
unsigned char* G0616_puc_Bitmap_MousePointerModifiedColorsObject;
unsigned char* G0613_puc_Bitmap_MousePointerOriginalColorsChampionIcon;
#endif
#ifdef MEDIA007_S10EA_S10EB_S11E_S12E_S12G_S13FA_S13FB_S20E_S21E
int16_t G0607_i_MousePointerScreenAreaNextX;
int16_t G0608_i_MousePointerScreenAreaNextY;
int16_t G0609_i_MousePointerAreaLastLineIndex;
unsigned int16_t G0610_ui_MousePointerAreaUnitWidth;
unsigned char* G0611_puc_Bitmap_MousePointerArea;
unsigned char* G0612_puc_Bitmap_MousePointerAreaCustom;
unsigned char* G0613_puc_Bitmap_MousePointerOriginalColorsChampionIcon;
unsigned char* G0614_puc_Bitmap_MousePointerModifiedColorsChampionIcon;
unsigned char* G0615_puc_Bitmap_MousePointerOriginalColorsObject;
unsigned char* G0616_puc_Bitmap_MousePointerModifiedColorsObject;
unsigned char* G0617_puc_Bitmap_MousePointerScreenArea;
#endif
#ifdef MEDIA424_A20ED_A20E_A20F_A20G_A21E_A22E_A22G_A36M
int16_t G1132_i_Unreferenced = 0; /* REPLACE BY UNUSED VARIABLE ABOVE G0602_B_CurrentMousePointerIsObject */
#endif
#ifdef MEDIA425_A20ED_A20E_A20F_A20G_A21E_A22E_A22G_A36M_A31E_A31M_A33M_A35E_A35M
#ifdef MEDIA746_A36M_A31E_A31M_A33M_A35E_A35M
int16_t G3204_ai_ArrowPointerDimensions[2] = { 32, 18 }; /* Referenced relatively from G0042_auc_Graphic562_Bitmap_ArrowPointer */
#endif
unsigned char G0042_auc_Graphic562_Bitmap_ArrowPointer[M075_BITMAP_BYTE_COUNT(32, 18)] = {
        0x00, 0x00, 0x00, 0x00, 0x40, 0x00, 0x00, 0x00, 0x60, 0x00, 0x00, 0x00, 0x70, 0x00, 0x00, 0x00,
        0x78, 0x00, 0x00, 0x00, 0x7C, 0x00, 0x00, 0x00, 0x7E, 0x00, 0x00, 0x00, 0x7F, 0x00, 0x00, 0x00,
        0x7F, 0x80, 0x00, 0x00, 0x7C, 0x00, 0x00, 0x00, 0x6C, 0x00, 0x00, 0x00, 0x46, 0x00, 0x00, 0x00,
        0x06, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
        0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x40, 0x00, 0x00, 0x00,
        0x60, 0x00, 0x00, 0x00, 0x70, 0x00, 0x00, 0x00, 0x78, 0x00, 0x00, 0x00, 0x7C, 0x00, 0x00, 0x00,
        0x7E, 0x00, 0x00, 0x00, 0x7F, 0x00, 0x00, 0x00, 0x7F, 0x80, 0x00, 0x00, 0x7C, 0x00, 0x00, 0x00,
        0x6C, 0x00, 0x00, 0x00, 0x46, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
        0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
        0xC0, 0x00, 0x00, 0x00, 0xA0, 0x00, 0x00, 0x00, 0x90, 0x00, 0x00, 0x00, 0x88, 0x00, 0x00, 0x00,
        0x84, 0x00, 0x00, 0x00, 0x82, 0x00, 0x00, 0x00, 0x81, 0x00, 0x00, 0x00, 0x80, 0x80, 0x00, 0x00,
        0x80, 0x40, 0x00, 0x00, 0x83, 0xC0, 0x00, 0x00, 0x92, 0x00, 0x00, 0x00, 0xA9, 0x00, 0x00, 0x00,
        0xC9, 0x00, 0x00, 0x00, 0x04, 0x80, 0x00, 0x00, 0x04, 0x80, 0x00, 0x00, 0x03, 0x80, 0x00, 0x00,
        0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xC0, 0x00, 0x00, 0x00, 0xE0, 0x00, 0x00, 0x00,
        0xF0, 0x00, 0x00, 0x00, 0xF8, 0x00, 0x00, 0x00, 0xFC, 0x00, 0x00, 0x00, 0xFE, 0x00, 0x00, 0x00,
        0xFF, 0x00, 0x00, 0x00, 0xFF, 0x80, 0x00, 0x00, 0xFF, 0xC0, 0x00, 0x00, 0xFF, 0xC0, 0x00, 0x00,
        0xFE, 0x00, 0x00, 0x00, 0xEF, 0x00, 0x00, 0x00, 0xCF, 0x00, 0x00, 0x00, 0x07, 0x80, 0x00, 0x00,
        0x07, 0x80, 0x00, 0x00, 0x03, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 } ;
#ifdef MEDIA746_A36M_A31E_A31M_A33M_A35E_A35M
int16_t G3205_ai_HandPointerDimensions[2] = { 32, 18 }; /* Referenced relatively from G0043_auc_Graphic562_Bitmap_HandPointer */
#endif
unsigned char G0043_auc_Graphic562_Bitmap_HandPointer[M075_BITMAP_BYTE_COUNT(32, 18)] = {
        0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
        0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
        0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
        0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
        0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xC0, 0x00, 0x00, 0x00, 0x6A, 0x00, 0x00, 0x00,
        0x35, 0x40, 0x00, 0x00, 0x1A, 0xA0, 0x00, 0x00, 0x0D, 0x50, 0x00, 0x00, 0x0E, 0xA8, 0x00, 0x00,
        0x07, 0xF8, 0x00, 0x00, 0xC7, 0xFC, 0x00, 0x00, 0x67, 0xFC, 0x00, 0x00, 0x77, 0xFC, 0x00, 0x00,
        0x3F, 0xFC, 0x00, 0x00, 0x3F, 0xFC, 0x00, 0x00, 0x1F, 0xFE, 0x00, 0x00, 0x07, 0xFF, 0x00, 0x00,
        0x01, 0xFF, 0x00, 0x00, 0x00, 0xFF, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
        0x20, 0x00, 0x00, 0x00, 0x95, 0x00, 0x00, 0x00, 0x4A, 0xA0, 0x00, 0x00, 0x25, 0x50, 0x00, 0x00,
        0x12, 0xA8, 0x00, 0x00, 0x11, 0x54, 0x00, 0x00, 0xC8, 0x04, 0x00, 0x00, 0x28, 0x02, 0x00, 0x00,
        0x98, 0x02, 0x00, 0x00, 0x88, 0x02, 0x00, 0x00, 0x40, 0x02, 0x00, 0x00, 0x40, 0x02, 0x00, 0x00,
        0x20, 0x01, 0x00, 0x00, 0x18, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
        0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xE0, 0x00, 0x00, 0x00, 0xFF, 0x00, 0x00, 0x00,
        0x7F, 0xE0, 0x00, 0x00, 0x3F, 0xF0, 0x00, 0x00, 0x1F, 0xF8, 0x00, 0x00, 0x1F, 0xFC, 0x00, 0x00,
        0xCF, 0xFC, 0x00, 0x00, 0xEF, 0xFE, 0x00, 0x00, 0xFF, 0xFE, 0x00, 0x00, 0xFF, 0xFE, 0x00, 0x00,
        0x7F, 0xFE, 0x00, 0x00, 0x7F, 0xFE, 0x00, 0x00, 0x3F, 0xFF, 0x00, 0x00, 0x1F, 0xFF, 0x00, 0x00,
        0x07, 0xFF, 0x00, 0x00, 0x01, 0xFF, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 };
#endif
#ifdef MEDIA413_A20ED_A20E_A20F_A20G_A21E_A22E_A22G
unsigned char G1025_auc_PaletteChanges_MousePointerObjectIconShadow[16] = { 120, 120, 120, 120, 120, 120, 120, 120, 120, 120, 120, 120, 0, 120, 120, 120 };
unsigned char G0044_auc_Graphic562_PaletteChanges_MousePointerIcon[16] = { 120, 10, 20, 30, 40, 50, 60, 70, 80, 90, 100, 110, 0, 130, 140, 150 }; /* Atari ST: { 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 120, 40, 40, 40 } */
unsigned char G0045_auc_Graphic562_PaletteChanges_MousePointerIconShadow[16] = { 0, 120, 120, 120, 120, 120, 120, 120, 120, 120, 120, 120, 0, 120, 120, 120 }; /* Atari ST: { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 120, 0, 0, 0 } */
unsigned char* G1142_puc_Bitmap_MousePointerTemporaryBuffer = NULL;
unsigned char* G0615_puc_Bitmap_MousePointerOriginalColorsObject = NULL;
unsigned char* G0613_puc_Bitmap_MousePointerOriginalColorsChampionIcon = NULL;
struct SimpleSprite G1096_aps_MousePointerSprites[4] = {
        { NULL, 18, 0, 0, 0 },
        { NULL, 18, 0, 0, 0 },
        { NULL, 18, 0, 0, 0 },
        { NULL, 18, 0, 0, 0 } };
SPRITEIMAGE* G1097_aps_MousePointerSpriteImages[4] = { NULL, NULL, NULL, NULL };
#endif
#ifdef MEDIA551_F20E_F20J_F31E_F31J
unsigned char G0042_auc_Graphic562_Bitmap_ArrowPointer[M075_BITMAP_BYTE_COUNT(18, 18)] = {
        0x00, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11,
        0xF0, 0x10, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11,
        0xF0, 0x0F, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11,
        0xF0, 0xFF, 0x10, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11,
        0xF0, 0xFF, 0x0F, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11,
        0xF0, 0xFF, 0xFF, 0x10, 0x11, 0x11, 0x11, 0x11, 0x11,
        0xF0, 0xFF, 0xFF, 0x0F, 0x11, 0x11, 0x11, 0x11, 0x11,
        0xF0, 0xFF, 0xFF, 0xFF, 0x10, 0x11, 0x11, 0x11, 0x11,
        0xF0, 0xFF, 0xFF, 0xFF, 0x0F, 0x11, 0x11, 0x11, 0x11,
        0xF0, 0xFF, 0xFF, 0x00, 0x00, 0x10, 0x11, 0x11, 0x11,
        0xF0, 0x0F, 0xFF, 0x10, 0x11, 0x11, 0x11, 0x11, 0x11,
        0xF0, 0x10, 0xF0, 0x0F, 0x11, 0x11, 0x11, 0x11, 0x11,
        0x00, 0x11, 0xF0, 0x0F, 0x11, 0x11, 0x11, 0x11, 0x11,
        0x10, 0x11, 0x01, 0xFF, 0x10, 0x11, 0x11, 0x11, 0x11,
        0x11, 0x11, 0x01, 0xFF, 0x10, 0x11, 0x11, 0x11, 0x11,
        0x11, 0x11, 0x11, 0x00, 0x10, 0x11, 0x11, 0x11, 0x11,
        0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11,
        0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11 };
unsigned char G0043_auc_Graphic562_Bitmap_HandPointer[M075_BITMAP_BYTE_COUNT(18, 18)] = {
        0xFF, 0x10, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11,
        0xF0, 0x0F, 0x0F, 0x0F, 0x11, 0x11, 0x11, 0x11, 0x11,
        0x01, 0xFF, 0xF0, 0xF0, 0xF0, 0x10, 0x11, 0x11, 0x11,
        0x11, 0xF0, 0x0F, 0x0F, 0x0F, 0x0F, 0x11, 0x11, 0x11,
        0x11, 0x01, 0xFF, 0xF0, 0xF0, 0xF0, 0x10, 0x11, 0x11,
        0x11, 0x01, 0xFF, 0x0F, 0x0F, 0x0F, 0x0F, 0x11, 0x11,
        0x00, 0x11, 0xF0, 0xFF, 0xFF, 0xFF, 0x0F, 0x11, 0x11,
        0xFF, 0x10, 0xF0, 0xFF, 0xFF, 0xFF, 0xFF, 0x10, 0x11,
        0xF0, 0x0F, 0xF0, 0xFF, 0xFF, 0xFF, 0xFF, 0x10, 0x11,
        0xF0, 0xFF, 0xF0, 0xFF, 0xFF, 0xFF, 0xFF, 0x10, 0x11,
        0x01, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x10, 0x11,
        0x01, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x10, 0x11,
        0x11, 0xF0, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x0F, 0x11,
        0x11, 0x01, 0xF0, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x11,
        0x11, 0x11, 0x01, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x11,
        0x11, 0x11, 0x11, 0x01, 0xFF, 0xFF, 0xFF, 0xFF, 0x11,
        0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11,
        0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11 };
#endif
#ifdef MEDIA457_P20JA
unsigned char G0042_auc_Graphic562_Bitmap_ArrowPointer[M075_BITMAP_BYTE_COUNT(18, 18)] = {
        0x00, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11,
        0x0F, 0x01, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11,
        0x0F, 0xF0, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11,
        0x0F, 0xFF, 0x01, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11,
        0x0F, 0xFF, 0xF0, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11,
        0x0F, 0xFF, 0xFF, 0x01, 0x11, 0x11, 0x11, 0x11, 0x11,
        0x0F, 0xFF, 0xFF, 0xF0, 0x11, 0x11, 0x11, 0x11, 0x11,
        0x0F, 0xFF, 0xFF, 0xFF, 0x01, 0x11, 0x11, 0x11, 0x11,
        0x0F, 0xFF, 0xFF, 0xFF, 0xF0, 0x11, 0x11, 0x11, 0x11,
        0x0F, 0xFF, 0xFF, 0x00, 0x00, 0x01, 0x11, 0x11, 0x11,
        0x0F, 0xF0, 0xFF, 0x01, 0x11, 0x11, 0x11, 0x11, 0x11,
        0x0F, 0x01, 0x0F, 0xF0, 0x11, 0x11, 0x11, 0x11, 0x11,
        0x00, 0x11, 0x0F, 0xF0, 0x11, 0x11, 0x11, 0x11, 0x11,
        0x01, 0x11, 0x10, 0xFF, 0x01, 0x11, 0x11, 0x11, 0x11,
        0x11, 0x11, 0x10, 0xFF, 0x01, 0x11, 0x11, 0x11, 0x11,
        0x11, 0x11, 0x11, 0x00, 0x01, 0x11, 0x11, 0x11, 0x11,
        0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11,
        0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11 };
unsigned char G0043_auc_Graphic562_Bitmap_HandPointer[M075_BITMAP_BYTE_COUNT(18, 18)] = {
        0xFF, 0x01, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11,
        0x0F, 0xF0, 0xF0, 0xF0, 0x11, 0x11, 0x11, 0x11, 0x11,
        0x10, 0xFF, 0x0F, 0x0F, 0x0F, 0x01, 0x11, 0x11, 0x11,
        0x11, 0x0F, 0xF0, 0xF0, 0xF0, 0xF0, 0x11, 0x11, 0x11,
        0x11, 0x10, 0xFF, 0x0F, 0x0F, 0x0F, 0x01, 0x11, 0x11,
        0x11, 0x10, 0xFF, 0xF0, 0xF0, 0xF0, 0xF0, 0x11, 0x11,
        0x00, 0x11, 0x0F, 0xFF, 0xFF, 0xFF, 0xF0, 0x11, 0x11,
        0xFF, 0x01, 0x0F, 0xFF, 0xFF, 0xFF, 0xFF, 0x01, 0x11,
        0x0F, 0xF0, 0x0F, 0xFF, 0xFF, 0xFF, 0xFF, 0x01, 0x11,
        0x0F, 0xFF, 0x0F, 0xFF, 0xFF, 0xFF, 0xFF, 0x01, 0x11,
        0x10, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x01, 0x11,
        0x10, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x01, 0x11,
        0x11, 0x0F, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xF0, 0x11,
        0x11, 0x10, 0x0F, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x11,
        0x11, 0x11, 0x10, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x11,
        0x11, 0x11, 0x11, 0x10, 0xFF, 0xFF, 0xFF, 0xFF, 0x11,
        0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11,
        0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11 };
#endif
#ifdef MEDIA480_P20JB_I34E_I34M_P31J
unsigned char G0042_auc_Graphic562_Bitmap_ArrowPointer[M075_BITMAP_BYTE_COUNT(18, 18)] = {
        0x00, 0xCC, 0xCC, 0xCC, 0xCC, 0xCC, 0xCC, 0xCC, 0xCC,
        0x0F, 0x0C, 0xCC, 0xCC, 0xCC, 0xCC, 0xCC, 0xCC, 0xCC,
        0x0F, 0xF0, 0xCC, 0xCC, 0xCC, 0xCC, 0xCC, 0xCC, 0xCC,
        0x0F, 0xFF, 0x0C, 0xCC, 0xCC, 0xCC, 0xCC, 0xCC, 0xCC,
        0x0F, 0xFF, 0xF0, 0xCC, 0xCC, 0xCC, 0xCC, 0xCC, 0xCC,
        0x0F, 0xFF, 0xFF, 0x0C, 0xCC, 0xCC, 0xCC, 0xCC, 0xCC,
        0x0F, 0xFF, 0xFF, 0xF0, 0xCC, 0xCC, 0xCC, 0xCC, 0xCC,
        0x0F, 0xFF, 0xFF, 0xFF, 0x0C, 0xCC, 0xCC, 0xCC, 0xCC,
        0x0F, 0xFF, 0xFF, 0xFF, 0xF0, 0xCC, 0xCC, 0xCC, 0xCC,
        0x0F, 0xFF, 0xFF, 0x00, 0x00, 0x0C, 0xCC, 0xCC, 0xCC,
        0x0F, 0xF0, 0xFF, 0x0C, 0xCC, 0xCC, 0xCC, 0xCC, 0xCC,
        0x0F, 0x0C, 0x0F, 0xF0, 0xCC, 0xCC, 0xCC, 0xCC, 0xCC,
        0x00, 0xCC, 0x0F, 0xF0, 0xCC, 0xCC, 0xCC, 0xCC, 0xCC,
        0x0C, 0xCC, 0xC0, 0xFF, 0x0C, 0xCC, 0xCC, 0xCC, 0xCC,
        0xCC, 0xCC, 0xC0, 0xFF, 0x0C, 0xCC, 0xCC, 0xCC, 0xCC,
        0xCC, 0xCC, 0xCC, 0x00, 0x0C, 0xCC, 0xCC, 0xCC, 0xCC,
        0xCC, 0xCC, 0xCC, 0xCC, 0xCC, 0xCC, 0xCC, 0xCC, 0xCC,
        0xCC, 0xCC, 0xCC, 0xCC, 0xCC, 0xCC, 0xCC, 0xCC, 0xCC };
unsigned char G0043_auc_Graphic562_Bitmap_HandPointer[M075_BITMAP_BYTE_COUNT(18, 18)] = {
        0xFF, 0x0C, 0xCC, 0xCC, 0xCC, 0xCC, 0xCC, 0xCC, 0xCC,
        0x0F, 0xF0, 0xF0, 0xF0, 0xCC, 0xCC, 0xCC, 0xCC, 0xCC,
        0xC0, 0xFF, 0x0F, 0x0F, 0x0F, 0x0C, 0xCC, 0xCC, 0xCC,
        0xCC, 0x0F, 0xF0, 0xF0, 0xF0, 0xF0, 0xCC, 0xCC, 0xCC,
        0xCC, 0xC0, 0xFF, 0x0F, 0x0F, 0x0F, 0x0C, 0xCC, 0xCC,
        0xCC, 0xC0, 0xFF, 0xF0, 0xF0, 0xF0, 0xF0, 0xCC, 0xCC,
        0x00, 0xCC, 0x0F, 0xFF, 0xFF, 0xFF, 0xF0, 0xCC, 0xCC,
        0xFF, 0x0C, 0x0F, 0xFF, 0xFF, 0xFF, 0xFF, 0x0C, 0xCC,
        0x0F, 0xF0, 0x0F, 0xFF, 0xFF, 0xFF, 0xFF, 0x0C, 0xCC,
        0x0F, 0xFF, 0x0F, 0xFF, 0xFF, 0xFF, 0xFF, 0x0C, 0xCC,
        0xC0, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x0C, 0xCC,
        0xC0, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x0C, 0xCC,
        0xCC, 0x0F, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xF0, 0xCC,
        0xCC, 0xC0, 0x0F, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xCC,
        0xCC, 0xCC, 0xC0, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xCC,
        0xCC, 0xCC, 0xCC, 0xC0, 0xFF, 0xFF, 0xFF, 0xFF, 0xCC,
        0xCC, 0xCC, 0xCC, 0xCC, 0xCC, 0xCC, 0xCC, 0xCC, 0xCC,
        0xCC, 0xCC, 0xCC, 0xCC, 0xCC, 0xCC, 0xCC, 0xCC, 0xCC };
#endif
#ifdef MEDIA613_X30J_A36M_A31E_A31M_A33M_A35E_A35M_X31J
int16_t G3116_;
#endif
#ifdef MEDIA376_G14ED_G20E_G21E_F20E_F20J_X30J_P20JA_P20JB_I34E_I34M_A36M_A31E_A31M_A33M_A35E_A35M_F31E_F31J_X31J_P31J
int16_t G2164_i_MousePointerChampionIndex;
#endif
#ifdef MEDIA351_G14ED_G20E_G21E
unsigned char* G4016_puc_;
#endif
#ifdef MEDIA008_S10EA_S10EB_S11E_S12E_S12G_S13FA_S13FB_S20E_S21E_G14ED_G20E_G21E
unsigned char* G0618_puc_Bitmap_MousePointerHiddenScreenArea;
#endif
#ifdef MEDIA351_G14ED_G20E_G21E
int16_t G4042_i_; /* Mouse X */
int16_t G4044_i_; /* Mouse Y */
unsigned char* G4009_puc_Bitmap_MousePointerObject[2]; /* Atari ST: Try to merge G0615_puc_Bitmap_MousePointerOriginalColorsObject and G0616_puc_Bitmap_MousePointerModifiedColorsObject */
unsigned char* G4015_puc_Bitmap_MousePointerChampion[2]; /* Atari ST: Try to merge G0613_puc_Bitmap_MousePointerOriginalColorsChampionIcon and G0614_puc_Bitmap_MousePointerModifiedColorsChampionIcon */
#endif
#ifdef MEDIA607_X30J_X31J
int16_t G3107_i_GetMousePointerType;
#endif
#ifdef MEDIA746_A36M_A31E_A31M_A33M_A35E_A35M
int16_t G3107_i_GetMousePointerType = -1;
#endif
#ifdef MEDIA613_X30J_A36M_A31E_A31M_A33M_A35E_A35M_X31J
int16_t G3105_B_;
int16_t G3102_B_MouseBounded;
int16_t G3103_i_MouseBoundButtonsStatus = 0;
int16_t G3104_ai_XYZ_MouseBound[4];
#endif
#ifdef MEDIA746_A36M_A31E_A31M_A33M_A35E_A35M
BOOLEAN G3202_B_;
#endif
#ifdef MEDIA692_X31J
INT1_HANDLER G3146_s_InterruptHandler;
#endif
#ifdef MEDIA607_X30J_X31J
int16_t G3110_;
#endif
#ifdef MEDIA577_X30J
int16_t G3113_ = 323;
int16_t G3111_ = 154;
#endif
#ifdef MEDIA692_X31J
int16_t G3113_;
int16_t G3111_;
int16_t G3144_;
int16_t G3142_;
int16_t G3145_;
int16_t G3143_;
#endif
#ifdef MEDIA607_X30J_X31J
int16_t G3108_;
#endif
#ifdef MEDIA529_F20E_F20J_X30J_P20JA_P20JB_I34E_I34M_A36M_A31E_A31M_A33M_A35E_A35M_F31E_F31J_X31J_P31J
MOUSE_POINTER_SCREEN_REGION G2052_as_MousePointerScreenRegions[16] = {
#ifdef MEDIA524_F20E_F20J_X30J_P20JA_P20JB_I34E_I34M_F31E_F31J_P31J
#ifdef MEDIA463_P20JA_P20JB_I34E_I34M_P31J /* BUGX_XX: Coordinates not correct for Japanese where viewport start at Y=31 instead of 33 */
        {   0, 223,  33, 168, C1_POINTER_HAND,      0 }, /* Viewport */
        { 224, 319,  33, 168, C0_POINTER_ARROW,     0 }, /* Menu area */
#endif
#ifdef MEDIA577_X30J
        {   0, 223,  31, 166, C1_POINTER_HAND,      0 }, /* Viewport */
        { 224, 319,  31, 166, C0_POINTER_ARROW,     0 }, /* Menu area */
#endif
#ifdef MEDIA551_F20E_F20J_F31E_F31J
        {   0, 223,  31, 168, C1_POINTER_HAND,      0 }, /* Viewport */
        { 224, 319,  31, 168, C0_POINTER_ARROW,     0 }, /* Menu area */
#endif
        {   0, 319, 169, 199, C0_POINTER_ARROW,     0 }, /* Message area */
        {   0,  41,   0,   6, C0_POINTER_ARROW, 8 | 1 }, /* Champion 1 status box - Name */
#ifdef MEDIA463_P20JA_P20JB_I34E_I34M_P31J /* BUGX_XX: Coordinates not correct for Japanese where viewport start at Y=31 instead of 33 */
        {   0,  41,   7,  32, C0_POINTER_ARROW,     1 }, /* Champion 1 status box - Hands */
        {  42,  69,   0,  32, C1_POINTER_HAND,      0 }, /* Champion 1 status box - Bar graphs */
#endif
#ifdef MEDIA577_X30J
        {   0,  41,   7,  28, C0_POINTER_ARROW,     1 }, /* Champion 1 status box - Hands */
        {  42,  69,   0,  28, C1_POINTER_HAND,      0 }, /* Champion 1 status box - Bar graphs */
#endif
#ifdef MEDIA551_F20E_F20J_F31E_F31J
        {   0,  41,   7,  30, C0_POINTER_ARROW,     1 }, /* Champion 1 status box - Hands */
        {  42,  69,   0,  30, C1_POINTER_HAND,      0 }, /* Champion 1 status box - Bar graphs */
#endif
        {  70, 110,   0,   6, C0_POINTER_ARROW, 8 | 2 }, /* Champion 2 status box - Name */
#ifdef MEDIA463_P20JA_P20JB_I34E_I34M_P31J /* BUGX_XX: Coordinates not correct for Japanese where viewport start at Y=31 instead of 33 */
        {  70, 110,   7,  32, C0_POINTER_ARROW,     2 }, /* Champion 2 status box - Hands */
        { 111, 137,   0,  32, C1_POINTER_HAND,      0 }, /* Champion 2 status box - Bar graphs */
#endif
#ifdef MEDIA577_X30J
        {  70, 110,   7,  28, C0_POINTER_ARROW,     2 }, /* Champion 2 status box - Hands */
        { 111, 137,   0,  28, C1_POINTER_HAND,      0 }, /* Champion 2 status box - Bar graphs */
#endif
#ifdef MEDIA551_F20E_F20J_F31E_F31J
        {  70, 110,   7,  30, C0_POINTER_ARROW,     2 }, /* Champion 2 status box - Hands */
        { 111, 137,   0,  30, C1_POINTER_HAND,      0 }, /* Champion 2 status box - Bar graphs */
#endif
        { 138, 179,   0,   6, C0_POINTER_ARROW, 8 | 3 }, /* Champion 3 status box - Name */
#ifdef MEDIA463_P20JA_P20JB_I34E_I34M_P31J /* BUGX_XX: Coordinates not correct for Japanese where viewport start at Y=31 instead of 33 */
        { 138, 179,   7,  32, C0_POINTER_ARROW,     3 }, /* Champion 3 status box - Hands */
        { 180, 206,   0,  32, C1_POINTER_HAND,      0 }, /* Champion 3 status box - Bar graphs */
#endif
#ifdef MEDIA577_X30J
        { 138, 179,   7,  28, C0_POINTER_ARROW,     3 }, /* Champion 3 status box - Hands */
        { 180, 206,   0,  28, C1_POINTER_HAND,      0 }, /* Champion 3 status box - Bar graphs */
#endif
#ifdef MEDIA551_F20E_F20J_F31E_F31J
        { 138, 179,   7,  30, C0_POINTER_ARROW,     3 }, /* Champion 3 status box - Hands */
        { 180, 206,   0,  30, C1_POINTER_HAND,      0 }, /* Champion 3 status box - Bar graphs */
#endif
        { 207, 248,   0,   6, C0_POINTER_ARROW, 8 | 4 }, /* Champion 4 status box - Name */
#ifdef MEDIA463_P20JA_P20JB_I34E_I34M_P31J /* BUGX_XX: Coordinates not correct for Japanese where viewport start at Y=31 instead of 33 */
        { 207, 248,   7,  32, C0_POINTER_ARROW,     4 }, /* Champion 4 status box - Hands */
        { 249, 273,   0,  32, C1_POINTER_HAND,      0 }, /* Champion 4 status box - Bar graphs */
        { 274, 319,   0,  32, C0_POINTER_ARROW,     0 } }; /* Champion icon area */
#endif
#ifdef MEDIA577_X30J
        { 207, 248,   7,  28, C0_POINTER_ARROW,     4 }, /* Champion 4 status box - Hands */
        { 249, 273,   0,  28, C1_POINTER_HAND,      0 }, /* Champion 4 status box - Bar graphs */
        { 274, 319,   0,  28, C0_POINTER_ARROW,     0 } }; /* Champion icon area */
#endif
#ifdef MEDIA551_F20E_F20J_F31E_F31J
        { 207, 248,   7,  30, C0_POINTER_ARROW,     4 }, /* Champion 4 status box - Hands */
        { 249, 273,   0,  30, C1_POINTER_HAND,      0 }, /* Champion 4 status box - Bar graphs */
        { 274, 319,   0,  30, C0_POINTER_ARROW,     0 } }; /* Champion icon area */
#endif
#endif
#ifdef MEDIA749_A36M_A31E_A31M_A33M_A35E_A35M_X31J
#ifdef MEDIA692_X31J
        {   0,  31, 224, 136, C1_POINTER_HAND,      0 },
        { 224,  31,  96, 136, C0_POINTER_ARROW,     0 },
        {   0, 167, 320,  33, C0_POINTER_ARROW,     0 },
#endif
#ifdef MEDIA746_A36M_A31E_A31M_A33M_A35E_A35M
        {   0,  33, 224, 136, C1_POINTER_HAND,      0 },
        { 224,  33,  96, 136, C0_POINTER_ARROW,     0 },
        {   0, 169, 320,  31, C0_POINTER_ARROW,     0 },
#endif
        {   0,   0,  42,   7, C0_POINTER_ARROW, 8 | 1 },
#ifdef MEDIA692_X31J
        {   0,   7,  42,  22, C0_POINTER_ARROW,     1 },
        {  42,   0,  28,  29, C1_POINTER_HAND,      0 },
        {  70,   0,  42,   7, C0_POINTER_ARROW, 8 | 2 },
#endif
#ifdef MEDIA746_A36M_A31E_A31M_A33M_A35E_A35M
        {   0,   7,  42,  26, C0_POINTER_ARROW,     1 },
        {  42,   0,  28,  33, C1_POINTER_HAND,      0 },
        {  70,   0,  41,   7, C0_POINTER_ARROW, 8 | 2 },
#endif
#ifdef MEDIA692_X31J
        {  70,   7,  42,  22, C0_POINTER_ARROW,     2 },
        { 111,   0,  28,  29, C1_POINTER_HAND,      0 },
#endif
#ifdef MEDIA746_A36M_A31E_A31M_A33M_A35E_A35M
        {  70,   7,  41,  26, C0_POINTER_ARROW,     2 },
        { 111,   0,  27,  33, C1_POINTER_HAND,      0 },
#endif
        { 138,   0,  42,   7, C0_POINTER_ARROW, 8 | 3 },
#ifdef MEDIA692_X31J
        { 138,   7,  42,  22, C0_POINTER_ARROW,     3 },
        { 180,   0,  28,  29, C1_POINTER_HAND,      0 },
#endif
#ifdef MEDIA746_A36M_A31E_A31M_A33M_A35E_A35M
        { 138,   7,  42,  26, C0_POINTER_ARROW,     3 },
        { 180,   0,  27,  33, C1_POINTER_HAND,      0 },
#endif
        { 207,   0,  42,   7, C0_POINTER_ARROW, 8 | 4 },
#ifdef MEDIA692_X31J
        { 207,   7,  42,  22, C0_POINTER_ARROW,     4 },
        { 249,   0,  28,  29, C1_POINTER_HAND,      0 },
        { 274,   0,  46,  29, C0_POINTER_ARROW,     0 } };
#endif
#ifdef MEDIA746_A36M_A31E_A31M_A33M_A35E_A35M
        { 207,   7,  42,  26, C0_POINTER_ARROW,     4 },
        { 249,   0,  25,  33, C1_POINTER_HAND,      0 },
        { 274,   0,  46,  33, C0_POINTER_ARROW,     0 } };
#endif
#endif
#endif
#ifdef MEDIA524_F20E_F20J_X30J_P20JA_P20JB_I34E_I34M_F31E_F31J_P31J
int16_t G2051_ai_Zone_ChampionIconRegion[4] = { 274, 319, 0, 28 };
#endif
#ifdef MEDIA749_A36M_A31E_A31M_A33M_A35E_A35M_X31J
int16_t G2051_ai_Zone_ChampionIconRegion[4] = { 274, 0, 46, 29 };
#endif
#ifdef MEDIA551_F20E_F20J_F31E_F31J
char G4079_MWORK[MosWorkSize];
int16_t G4071_i_MSE_STATE = 1;
unsigned char G4075_aauc_MSE_CURSOR[4][512];
long G4073_ai_HOT_X[4];
long G4074_ai_HOT_Y[4];
int16_t G3104_ai_XYZ_MouseBound[4];
BOOLEAN G3102_B_MouseBounded;
int16_t G8092_MousePointerType;
int16_t G4072_B_FORCED_UPDATE;
int16_t G3103_i_MouseBoundButtonsStatus;
long G4078_;
long G4076_;
long G4077_;
int16_t G2050_ai_Box_Impossible[4] = { 0, 0, 0, 0 };
#endif
#ifdef MEDIA463_P20JA_P20JB_I34E_I34M_P31J
int16_t G2050_ai_Box_Impossible[4] = { 1, 0, 1, 0 }; /* These fake coordinates (where X1 > X2 and Y1 > Y2 !) are used in F0700_TriggerImmediateMouseEvent to force call to F0781_MouseHandler (via dwrd_130E4_MouseHandler) in F8094_ProcessMouseMovement (IBMIO). */
BOOLEAN G2124_B_ = C0_FALSE;
#endif
#ifdef MEDIA613_X30J_A36M_A31E_A31M_A33M_A35E_A35M_X31J
#ifdef MEDIA607_X30J_X31J
int16_t G3115_[4][4] = {
#endif
#ifdef MEDIA746_A36M_A31E_A31M_A33M_A35E_A35M
int16_t G3115_[5][4] = {
        {  0, 0,  0,  0 },
#endif
        {  0, 0, 16, 16 },
        {  0, 0, 16, 16 },
        {  8, 8, 18, 18 },
        { 10, 7, 21, 16 } };
#endif
#ifdef MEDIA746_A36M_A31E_A31M_A33M_A35E_A35M
struct SimpleSprite G1096_aps_MousePointerSprites[4];
/*SPRITEIMAGE (*G3203_)[5][4];*/ /* Similar to G1097_aps_MousePointerSpriteImages */
int16_t* G3203_;
#endif
#ifdef MEDIA613_X30J_A36M_A31E_A31M_A33M_A35E_A35M_X31J
int16_t G3109_;
#endif
#ifdef MEDIA744_A36M
int16_t G3255_Unreferenced = 0;
#endif
#ifdef MEDIA746_A36M_A31E_A31M_A33M_A35E_A35M
int16_t G3223_ = -1;
int16_t G3244_ = -1;
#endif
#ifdef MEDIA613_X30J_A36M_A31E_A31M_A33M_A35E_A35M_X31J
unsigned char G3100_auc_PaletteChanges_3[16] = { 12, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 12, 0, 0, 0 };
#endif
#ifdef MEDIA529_F20E_F20J_X30J_P20JA_P20JB_I34E_I34M_A36M_A31E_A31M_A33M_A35E_A35M_F31E_F31J_X31J_P31J
unsigned char G0045_auc_Graphic562_PaletteChanges_MousePointerIconShadow[16] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 12, 0, 0, 0 };
#endif
#ifdef MEDIA613_X30J_A36M_A31E_A31M_A33M_A35E_A35M_X31J
unsigned char G3101_auc_PaletteChanges_1[16] = { 12, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 0, 13, 14, 15 };
#endif
#ifdef MEDIA137_S10EA_S10EB_S11E_S12E_S12G_S13FA_S13FB_S20E_S21E_A20ED_A20E_A20F_A20G_A21E_A22E_A22G
unsigned char G0619_auc_Box_MousePointer_ObjectShadow[4] = { 2, 17, 2, 17 }; /* Identical to G2053_ai_XYZ */
unsigned char G0620_auc_Box_MousePointer_Object[4] = { 0, 15, 0, 15 }; /* Identical to G2054_ai_XYZ */
#endif
#ifdef MEDIA489_F20E_F20J_P20JA_P20JB
int16_t G2053_ai_XYZ[4] = { 2, 17, 2, 17 }; /* Identical to G0619_auc_Box_MousePointer_ObjectShadow */
int16_t G2054_ai_XYZ[4] = { 0, 15, 0, 15 }; /* Identical to G0620_auc_Box_MousePointer_Object */
#endif
#ifdef MEDIA712_I34E_I34M_F31E_F31J_P31J
int16_t G2053_ai_XYZ[4] = { 2, 2, 16, 16 };
int16_t G2054_ai_XYZ[4] = { 0, 0, 16, 16 };
#endif
#ifdef MEDIA014_S10EA_S10EB_S11E_S12E_S12G_S13FA_S13FB_S20E_S21E_G14ED_G20E_G21E_A20ED_A20E_A20F_A20G_A21E_A22E_A22G_F20E_F20J
int16_t G0621_ai_Box_MousePointer_ChampionIconShadow[4] = { 2, 20, 2, 15 };
int16_t G0622_ai_Box_MousePointer_ChampionIcon[4] = { 0, 18, 0, 13 };
#endif
#ifdef MEDIA489_F20E_F20J_P20JA_P20JB
int16_t G2055_ai_XYZ_ChampionIcon[4] = { 0, 17, 0, 13 };
int16_t G2056_ai_XYZ[4] = { 0, 17, 0, 17 };
#endif
#ifdef MEDIA712_I34E_I34M_F31E_F31J_P31J
int16_t G2055_ai_XYZ_ChampionIcon[4] = { 0, 0, 18, 14 };
int16_t G2056_ai_XYZ[4] = { 0, 0, 18, 18 };
#endif
#ifdef MEDIA493_F20E_F20J_P20JA_P20JB_F31E_F31J_P31J
int16_t G2218_[4] = { 7, 11, 8, 14 };
#endif
#ifdef MEDIA413_A20ED_A20E_A20F_A20G_A21E_A22E_A22G
BOOLEAN G1094_B_PreventBuildPointerScreenArea;
#ifdef MEDIA433_A20E_A20F_A20G_A21E_A22E_A22G
BOOLEAN G1095_B_ = C0_FALSE;
#endif
int16_t G1098_i_MousePointerType;
int16_t G1099_i_PreviousMousePointerType;
#ifdef MEDIA433_A20E_A20F_A20G_A21E_A22E_A22G
char G1139_ac_Unreferenced[6];
#endif
#ifdef MEDIA410_A20ED
char G1139_ac_Unreferenced[8];
#endif
#endif
#ifdef MEDIA472_P20JB_P31J
int16_t G2350_ = 0;
#endif
#ifdef MEDIA667_P31J
#ifndef NOCOPYPROTECTION
char G2351_Side0Track2Sector1PostCRCByte1_CPSX = 87;  /* 0x57 */
char G2352_Side0Track2Sector1PostCRCByte2_CPSX = 110; /* 0x6E */
char G2215_ac_Side0Track2Sector2PostCRCBytes_CPSX[7] = { '0', '1', '5', '-', '0', '0', '0' };
char G2353_Side0Track2Sector3PostCRCByte1_CPSX = 24;  /* 0x18 */
char G2354_Side0Track2Sector3PostCRCByte2_CPSX = 149; /* 0x95 */
char G2355_Side0Track2Sector4PostCRCByte1_CPSX = 99;  /* 0x63 */
char G2356_Side0Track2Sector4PostCRCByte2_CPSX = 70;  /* 0x46 */
char G2357_Side0Track2Sector5PostCRCByte1_CPSX = 137; /* 0x89 */
char G2358_Side0Track2Sector5PostCRCByte2_CPSX = 115; /* 0x73 */
#endif
#endif

#ifdef MEDIA463_P20JA_P20JB_I34E_I34M_P31J
IO_DRIVER* G2161_IODriver;
IO_DRIVER* G2162_IODriver;
#endif
#ifdef MEDIA709_I34E_I34M_P31J
int16_t G2163_;
#endif
#ifdef MEDIA457_P20JA
char G2237_Unreferenced[22];
#endif
#ifdef MEDIA469_P20JB
char G2237_Unreferenced[26];
#endif
#ifdef MEDIA667_P31J
char G2237_Unreferenced[24];
int16_t G2238_Unreferenced;
#endif


#ifdef MEDIA007_S10EA_S10EB_S11E_S12E_S12G_S13FA_S13FB_S20E_S21E
overlay "main"
#endif
#ifdef MEDIA351_G14ED_G20E_G21E
segment "gsthings"
#endif

#ifdef MEDIA413_A20ED_A20E_A20F_A20G_A21E_A22E_A22G
void F0545_MOUSE_AllocateMemory(
)
{
        REGISTER int16_t L1742_i_;


        for (L1742_i_ = 0; L1742_i_ < 4; L1742_i_++) {
                G1097_aps_MousePointerSpriteImages[L1742_i_] = AllocMem((long)sizeof(SPRITEIMAGE), MEMF_CHIP | MEMF_CLEAR);
                if (G1097_aps_MousePointerSpriteImages[L1742_i_] == NULL) {
                        Alert(0x80444D90, 0L);
                        F0507_AMIGA_DeinitializeAndInfiniteLoop();
                }
                M008_SET(G1097_aps_MousePointerSpriteImages[L1742_i_]->posctl[1], SPRITE_ATTACHED);
        }
        G1142_puc_Bitmap_MousePointerTemporaryBuffer = AllocMem((long)M075_BITMAP_BYTE_COUNT(32, 18), MEMF_CHIP | MEMF_CLEAR);
        if (G1142_puc_Bitmap_MousePointerTemporaryBuffer == NULL) {
                Alert(0x80444D91, 0L);
                F0507_AMIGA_DeinitializeAndInfiniteLoop();
        }
        G0615_puc_Bitmap_MousePointerOriginalColorsObject = AllocMem((long)M075_BITMAP_BYTE_COUNT(32, 18), MEMF_CHIP | MEMF_CLEAR);
        if (G0615_puc_Bitmap_MousePointerOriginalColorsObject == NULL) {
                Alert(0x80444D92, 0L);
                F0507_AMIGA_DeinitializeAndInfiniteLoop();
        }
        G0613_puc_Bitmap_MousePointerOriginalColorsChampionIcon = AllocMem((long)M075_BITMAP_BYTE_COUNT(32, 18), MEMF_CHIP | MEMF_CLEAR);
        if (G0613_puc_Bitmap_MousePointerOriginalColorsChampionIcon == NULL) {
                Alert(0x80444D93, 0L);
                F0507_AMIGA_DeinitializeAndInfiniteLoop();
        }
}

void F0546_MOUSE_Deinitialize(
)
{
        REGISTER int16_t L1743_i_;


        for (L1743_i_ = 0; L1743_i_ < 4; L1743_i_++) {
                if (G1096_aps_MousePointerSprites[L1743_i_].num > 0) {
                        FreeSprite((long)G1096_aps_MousePointerSprites[L1743_i_].num);
                }
                if (G1097_aps_MousePointerSpriteImages[L1743_i_]) {
                        FreeMem(G1097_aps_MousePointerSpriteImages[L1743_i_], (long)sizeof(SPRITEIMAGE));
                }
        }
        if (G1142_puc_Bitmap_MousePointerTemporaryBuffer) {
                FreeMem(G1142_puc_Bitmap_MousePointerTemporaryBuffer, (long)M075_BITMAP_BYTE_COUNT(32, 18));
        }
        if (G0615_puc_Bitmap_MousePointerOriginalColorsObject) {
                FreeMem(G0615_puc_Bitmap_MousePointerOriginalColorsObject, (long)M075_BITMAP_BYTE_COUNT(32, 18));
        }
        if (G0613_puc_Bitmap_MousePointerOriginalColorsChampionIcon) {
                FreeMem(G0613_puc_Bitmap_MousePointerOriginalColorsChampionIcon, (long)M075_BITMAP_BYTE_COUNT(32, 18));
        }
}
#endif

#ifdef MEDIA463_P20JA_P20JB_I34E_I34M_P31J
void F0700_TriggerImmediateMouseEvent(
void
)
{
        (*(G2161_IODriver->IODRV_11_SetMouseBoundEvent))(G2050_ai_Box_Impossible, C32_MOUSE_EVENT_CHANGE_SCREEN_REGION); /* Triggers mouse event immediately */
}

int16_t F0781_MouseHandler(
int16_t P2381_i_X          SEPARATOR
int16_t P2382_i_Y          SEPARATOR
int16_t P2383_i_MouseEvent FINAL_SEPARATOR
{
        int16_t L2871_i_ChampionIndex;
        int16_t L2872_i_;
        int16_t L2873_i_OverChampionName;
        int16_t L2874_i_PointerType;
#ifdef MEDIA459_P20JA_P20JB_P31J
        int16_t L2875_i_;


        L2875_i_ = 0;
#endif
        asm     push    ds
        asm     mov     ax, cs:V0713000_DSRegisterBackup
        asm     mov     ds, ax
        if (P2383_i_MouseEvent < C32_MOUSE_EVENT_CHANGE_SCREEN_REGION) {
                F0359_COMMAND_ProcessClick_CPSC(P2381_i_X, P2382_i_Y, P2383_i_MouseEvent);
                goto end; /* BUG0_01 Coding error without consequence. Undefined return value. No consequence because the returned value is never used */
        } else {
                if (P2383_i_MouseEvent == C33_MOUSE_EVENT_LEAVE_CHAMPION_ICON_REGION) {
                        F0359_COMMAND_ProcessClick_CPSC(P2381_i_X, P2382_i_Y, P2383_i_MouseEvent);
                } else {
                        if (G0599_ui_UseChampionIconOrdinalAsMousePointerBitmap) {
                                (*(G2161_IODriver->IODRV_11_SetMouseBoundEvent))(G2051_ai_Zone_ChampionIconRegion, C33_MOUSE_EVENT_LEAVE_CHAMPION_ICON_REGION);
                                L2874_i_PointerType = CM1_POINTER_NONE;
                                goto end;
                        }
                }
        }
        /* Determine mouse pointer type */
        if (!G0601_B_UseHandAsMousePointerBitmap && !G0600_B_UseObjectAsMousePointerBitmap) {
                L2874_i_PointerType = C0_POINTER_ARROW;
        } else {
                for (L2872_i_ = 0; L2872_i_ < 16; L2872_i_++) {
                        if ((G2052_as_MousePointerScreenRegions[L2872_i_].XYZ[0] <= P2381_i_X) && (G2052_as_MousePointerScreenRegions[L2872_i_].XYZ[1] >= P2381_i_X) && (G2052_as_MousePointerScreenRegions[L2872_i_].XYZ[2] <= P2382_i_Y) && (G2052_as_MousePointerScreenRegions[L2872_i_].XYZ[3] >= P2382_i_Y)) {
                                if (G2052_as_MousePointerScreenRegions[L2872_i_].ChampionOrdinal == 0) {
                                        (*(G2161_IODriver->IODRV_11_SetMouseBoundEvent))(G2052_as_MousePointerScreenRegions[L2872_i_].XYZ, C32_MOUSE_EVENT_CHANGE_SCREEN_REGION);
                                        if ((G0600_B_UseObjectAsMousePointerBitmap == C1_TRUE) && (G2052_as_MousePointerScreenRegions[L2872_i_].PointerType == C1_POINTER_HAND)) {
                                                L2874_i_PointerType = C2_POINTER_OBJECT_ICON;
                                                break;
                                        } else {
                                                L2874_i_PointerType = G2052_as_MousePointerScreenRegions[L2872_i_].PointerType;
                                                break;
                                        }
                                } else {
                                        L2871_i_ChampionIndex = M001_ORDINAL_TO_INDEX(G2052_as_MousePointerScreenRegions[L2872_i_].ChampionOrdinal & 7);
                                        L2873_i_OverChampionName = G2052_as_MousePointerScreenRegions[L2872_i_].ChampionOrdinal >> 3;
                                        (*(G2161_IODriver->IODRV_11_SetMouseBoundEvent))(G2052_as_MousePointerScreenRegions[L2872_i_].XYZ, C32_MOUSE_EVENT_CHANGE_SCREEN_REGION);
                                        if ((L2871_i_ChampionIndex < G0305_ui_PartyChampionCount) && M516_CHAMPIONS[L2871_i_ChampionIndex].CurrentHealth && ((M001_ORDINAL_TO_INDEX(G0423_i_InventoryChampionOrdinal) == L2871_i_ChampionIndex) || L2873_i_OverChampionName)) {
                                                L2874_i_PointerType = C0_POINTER_ARROW;
                                        } else {
                                                if (G0600_B_UseObjectAsMousePointerBitmap == C1_TRUE) {
                                                        L2874_i_PointerType = C2_POINTER_OBJECT_ICON;
                                                } else {
                                                        L2874_i_PointerType = C1_POINTER_HAND;
                                                }
                                        }
                                        break;
                                }
                        }
                }
        }
        end:
        asm     mov     ax, L2874_i_PointerType
        asm     pop     ds
}

void F0782_(
void
)
{
#ifdef MEDIA459_P20JA_P20JB_P31J
        int16_t L2876_i_;


        L2876_i_ = 0;
#endif
        asm     push    ds
        asm     mov     ax, cs:V0713000_DSRegisterBackup
        asm     mov     ds, ax
        G2124_B_ = C1_TRUE;
#ifdef MEDIA458_P20JA_P20JB
        G0317_i_WaitForInputVerticalBlankCount += 3;
#endif
#ifdef MEDIA709_I34E_I34M_P31J
        G0317_i_WaitForInputVerticalBlankCount += G2163_;
#endif
        if (G0317_i_WaitForInputVerticalBlankCount >= G0318_i_WaitForInputMaximumVerticalBlankCount) {
                G0321_B_StopWaitingForPlayerInput = C1_TRUE;
        }
        asm     pop     ds
}
#endif

#ifdef MEDIA613_X30J_A36M_A31E_A31M_A33M_A35E_A35M_X31J
void F1038_UpdateMousePointer(
void
)
{ /* Register a mouse pointer */
#ifdef MEDIA607_X30J_X31J
#ifdef MEDIA692_X31J
        G3146_s_InterruptHandler.Priority = 63;
        G3146_s_InterruptHandler.Type = 0; /* Vertical Blank */
        G3146_s_InterruptHandler.CurrentInterruptCount = 1; /* Runs on every interrupt */
#endif
        asm {
                        lea     @T1038000_A5RegisterBackup,a0
                        move.l  a5,(a0)
                        lea     @Tloc_1DDAA,a1
#ifdef MEDIA577_X30J
                        moveq   #1,d1
                        moveq   #0x6C,d0         /* VDISPST */
                        trap    #0xF             /* TRAP 15 (IOCS CALL) */
#endif
#ifdef MEDIA692_X31J
                        move.l  a1,G3146_s_InterruptHandler.Code(a5)
#endif
        }
#ifdef MEDIA692_X31J
        INT1_04_InstallInterruptHandler(&G3146_s_InterruptHandler);
#endif
        return;
        asm {
                @Tloc_1DDAA:
                        movem.l d0-d7/a0-a6,-(sp)
                        movea.l @T1038000_A5RegisterBackup,a5
                        tst.w   G3108_(a5)
                        beq.w   @Tloc_1DF88
#ifdef MEDIA577_X30J
                        movea.l #0xEB0808,a6
#endif
#ifdef MEDIA692_X31J
                        movea.l #0xFFEB0808,a6
#endif
                        andi.w  #0xFDFF,(a6)
                        moveq   #0x74,d0         /* MS_GETDT */
                        trap    #0xF             /* TRAP 15 (IOCS CALL) */
                        not.w   G3109_(a5)
                        beq.s   @Tloc_1DDEC
                        moveq   #0,d5
                        lsr.l   #8,d0
                        bcc.s   @Tloc_1DDD6
                        moveq   #1,d5
                @Tloc_1DDD6:
                        lsr.l   #8,d0
                        bcc.s   @Tloc_1DDDE
                        ori.w   #2,d5
                @Tloc_1DDDE:
                        move.w  G3110_(a5),d4
                        move.w  d5,G3110_(a5)
                        move.w  d5,G0588_i_MouseButtonsStatus(a5)
                        swap    d0
                @Tloc_1DDEC:
                        swap    d0
                        tst.w   G0597_B_IgnoreMouseMovements(a5)
                        bne.w   @Tloc_1DF36
                        move.w  d0,d3
                        andi.w  #0xFF,d3
                        ext.w   d3
                        add.w   G3111_(a5),d3
#ifdef MEDIA577_X30J
                        cmpi.w  #0x1FF,d3
#endif
#ifdef MEDIA692_X31J
                        cmp.w   G3142_(a5),d3
#endif
                        bhi.s   @Tloc_1DE1A
                        move.w  d3,G3111_(a5)
                        move.w  d3,G3112_(a5)
                        lsr     G3112_(a5)
#ifdef MEDIA577_X30J
                        subi.w  #0x1C,G3112_(a5)
#endif
#ifdef MEDIA692_X31J
                        move.w  G3143_(a5),d1
                        sub.w   d1,G3112_(a5)
#endif
                @Tloc_1DE1A:
                        move.w  d0,d3
                        lsr.w   #8,d3
                        ext.w   d3
                        add.w   G3113_(a5),d3
#ifdef MEDIA577_X30J
                        cmpi.w  #0x1FF,d3
#endif
#ifdef MEDIA692_X31J
                        cmp.w   G3144_(a5),d3
#endif
                        bhi.s   @Tloc_1DE38
                        move.w  d3,G3113_(a5)
                        move.w  d3,G3114_(a5)
#ifdef MEDIA577_X30J
                        subi.w  #72,G3114_(a5)
#endif
#ifdef MEDIA692_X31J
                        move.w  G3145_(a5),d1
                        sub.w   d1,G3114_(a5)
#endif
                @Tloc_1DE38:
                        move.w  G3112_(a5),-(sp)
                        move.w  G3114_(a5),-(sp)
                        jsr     F1041_GetMousePointerType
                        addq.l  #4,sp
                        moveq   #0,d1
                        move.w  G3107_i_GetMousePointerType(a5),d1
                        ext.l   d0
                        bmi.s   @Tloc_1DE58
                        cmp.w   d1,d0
                        beq.s   @Tloc_1DE7A
                        move.w  d0,G3107_i_GetMousePointerType(a5)
                @Tloc_1DE58:
#ifdef MEDIA577_X30J
                        movea.l #0xEB0000,a0
#endif
#ifdef MEDIA692_X31J
                        movea.l #0xFFEB0000,a0
#endif
                        lsl.l   #6,d1
                        adda.l  d1,a0
                        clr.w   6(a0)
                        clr.w   0xE(a0)
                        clr.w   0x16(a0)
                        clr.w   0x1E(a0)
                        clr.w   0x26(a0)
                        clr.w   0x2E(a0)
                @Tloc_1DE7A:
                        move.l  d0,d1
                        bmi.w   @Tloc_1DF36
                        lea     G3115_(a5),a1
                        lsl.l   #3,d0
                        adda.l  d0,a1
#ifdef MEDIA577_X30J
                        movea.l #0xEB0000,a0
#endif
#ifdef MEDIA692_X31J
                        movea.l #0xFFEB0000,a0
#endif
                        lsl.l   #3,d0
                        adda.l  d0,a0
                        move.w  G3111_(a5),d3
#ifdef MEDIA692_X31J
                        tst.w   G3076_B_(a5)
                        beq.s   @Tloc_1EDB6
#endif
                        addi.w  #0x10,d3
                @Tloc_1EDB6:
                        sub.w   2(a1),d3
                        sub.w   2(a1),d3
                        move.w  d3,2(a0)
                        move.w  d3,0xA(a0)
                        addi.w  #0x10,d3
                        move.w  d3,0x12(a0)
                        move.w  d3,0x1A(a0)
                        addi.w  #0x10,d3
                        move.w  d3,0x22(a0)
                        move.w  d3,0x2A(a0)
                        move.w  G3113_(a5),d3
#ifdef MEDIA692_X31J
                        tst.w   G3076_B_(a5)
                        beq.s   @Tloc_1EDEC
#endif
                        addi.w  #0x18,d3
                @Tloc_1EDEC:
                        addi.w  #0x10,d3
                        sub.w   (a1),d3
                        move.w  d3,(a0)
                        move.w  d3,0x10(a0)
                        move.w  d3,0x20(a0)
                        addi.w  #0x10,d3
                        move.w  d3,8(a0)
                        move.w  d3,0x18(a0)
                        move.w  d3,0x28(a0)
                        lsl.w   #3,d1
                        addi.w  #0xF80,d1
                        move.w  d1,4(a0)
                        addq.w  #1,d1
                        move.w  d1,0xC(a0)
                        addq.w  #1,d1
                        move.w  d1,0x14(a0)
                        addq.w  #1,d1
                        move.w  d1,0x1C(a0)
                        addq.w  #1,d1
                        move.w  d1,0x24(a0)
                        addq.w  #1,d1
                        move.w  d1,0x2C(a0)
                        move.w  #3,6(a0)
                        move.w  #3,0xE(a0)
                        move.w  #3,0x16(a0)
                        move.w  #3,0x1E(a0)
                        move.w  #3,0x26(a0)
                        move.w  #3,0x2E(a0)
                @Tloc_1DF36:
                        tst.w   G3109_(a5)
                        beq.s   @Tloc_1DF84
                        eor.w   d5,d4
                        andi.w  #3,d4
                        beq.s   @Tloc_1DF84
                        btst    #0,d4
                        beq.s   @Tloc_1DF64
                        moveq   #1,d3
                        btst    #0,d5
                        bne.s   @Tloc_1DF54
                        moveq   #8,d3
                @Tloc_1DF54:
                        move.w  d3,-(sp)
                        move.w  G3112_(a5),-(sp)
                        move.w  G3114_(a5),-(sp)
                        jsr     F0359_COMMAND_ProcessClick_CPSC(a5)
                        addq.l  #6,sp
                @Tloc_1DF64:
                        btst    #1,d4
                        beq.s   @Tloc_1DF84
                        moveq   #2,d3
                        btst    #1,d5
                        bne.s   @Tloc_1DF74
                        moveq   #4,d3
                @Tloc_1DF74:
                        move.w  d3,-(sp)
                        move.w  G3112_(a5),-(sp)
                        move.w  G3114_(a5),-(sp)
                        jsr     F0359_COMMAND_ProcessClick_CPSC(a5)
                        addq.l  #6,sp
                @Tloc_1DF84:
                        ori.w   #0x200,(a6)
                @Tloc_1DF88:
                        addq.w  #1,G0317_i_WaitForInputVerticalBlankCount(a5)
                        move.w  G0317_i_WaitForInputVerticalBlankCount(a5),d0
                        cmp.w   G0318_i_WaitForInputMaximumVerticalBlankCount(a5),d0
                        bls.s   @Tloc_1DF9C
                        move.w  #1,G0321_B_StopWaitingForPlayerInput(a5)
                @Tloc_1DF9C:
                        movem.l (sp)+,d0-d7/a0-a6
#ifdef MEDIA577_X30J
                        rte
#endif
#ifdef MEDIA692_X31J
                        bra.s   @Tlocret_1EEC8
#endif
                @T1038000_A5RegisterBackup:dc.l 0
                @Tlocret_1EEC8:
        }
#endif
#ifdef MEDIA746_A36M_A31E_A31M_A33M_A35E_A35M
/* On Amiga, a mouse pointer is a set of 4 sprites (one for each bit plane) */
        register int16_t* L2877_pi_;
        register int16_t L2878_i_;
        register int16_t L2879_i_;
        register int16_t L2880_i_;
        register int16_t L2881_i_;


        if (G3202_B_) {
                L2878_i_ = G3114_;
                L2879_i_ = G3112_;
                L2881_i_ = F1041_GetMousePointerType(L2878_i_, L2879_i_);
                if (L2881_i_ != -1) {
                        if (G3107_i_GetMousePointerType != L2881_i_) {
                                L2877_pi_ = G3203_;
                                for (L2880_i_ = 0; L2880_i_ < 4; L2880_i_++) {
                                        ChangeSprite(&G3191_ps_MsgPort_FTL_DRIA_Video->_0x44_ViewPort, &G1096_aps_MousePointerSprites[L2880_i_], L2877_pi_ + (L2880_i_ * 40));
                                }
                        }
                        if ((G3223_ != L2878_i_) || (G3244_ != L2879_i_) || (G3107_i_GetMousePointerType != L2881_i_)) {
                                G3223_ = L2878_i_;
                                G3244_ = L2879_i_;
                                L2878_i_--;
                                L2878_i_ -= G3115_[L2881_i_ + 1][0];
                                L2879_i_ -= G3115_[L2881_i_ + 1][1];
                                MoveSprite(&G3191_ps_MsgPort_FTL_DRIA_Video->_0x44_ViewPort, &G1096_aps_MousePointerSprites[0], (long)L2878_i_, (long)L2879_i_);
                                MoveSprite(&G3191_ps_MsgPort_FTL_DRIA_Video->_0x44_ViewPort, &G1096_aps_MousePointerSprites[1], (long)L2878_i_, (long)L2879_i_);
                                MoveSprite(&G3191_ps_MsgPort_FTL_DRIA_Video->_0x44_ViewPort, &G1096_aps_MousePointerSprites[2], (long)L2878_i_ + 16, (long)L2879_i_);
                                MoveSprite(&G3191_ps_MsgPort_FTL_DRIA_Video->_0x44_ViewPort, &G1096_aps_MousePointerSprites[3], (long)L2878_i_ + 16, (long)L2879_i_);
                        }
                }
                if (G3107_i_GetMousePointerType != L2881_i_) {
                        L2877_pi_ = G3203_ + (L2881_i_ + 1) * 160;
                        for (L2880_i_ = 0; L2880_i_ < 4; L2880_i_++) {
                                ChangeSprite(&G3191_ps_MsgPort_FTL_DRIA_Video->_0x44_ViewPort, &G1096_aps_MousePointerSprites[L2880_i_], L2877_pi_ + (L2880_i_ * 40));
                        }
                        G3107_i_GetMousePointerType = L2881_i_;
                }
        }
#endif
}
#endif

#ifdef MEDIA749_A36M_A31E_A31M_A33M_A35E_A35M_X31J
void F1042_(
void
)
{
#ifdef MEDIA692_X31J
        INT1_05_UninstallInterruptHandler(&G3146_s_InterruptHandler);
#endif
}
#endif

#ifdef MEDIA746_A36M_A31E_A31M_A33M_A35E_A35M
void F1043_(
void
)
{
}

void F1044_(
void
)
{
}
#endif

#ifdef MEDIA551_F20E_F20J_F31E_F31J
void F0078_MOUSE_DisableScreenUpdate(
void
)
{
        CLI;
        if (G4071_i_MSE_STATE-- == 1) {
                MOS_disp(1);
        }
        STI;
}

void F0077_MOUSE_EnableScreenUpdate_CPSE(
void
)
{
        CLI;
        if (G4071_i_MSE_STATE++ == 0) {
                MOS_disp(0);
        }
        STI;
}

void F0706_GetMouseState(
int16_t* P2388_pi_ SEPARATOR
int16_t* P2389_pi_ SEPARATOR
int16_t* P2390_pi_ FINAL_SEPARATOR
{
}

void F0785_SetMousePointerCoordinates(
int16_t P2386_i_ SEPARATOR
int16_t P2387_i_ FINAL_SEPARATOR
{
}

void F2236_IODRV_9_SetMousePointerBitmap(
int16_t        P6096_i_PointerIndex    SEPARATOR
unsigned char* P6097_puc_PointerBitmap SEPARATOR
int16_t        P6098_i_PointerWidth    SEPARATOR
int16_t        P6099_i_HotX            SEPARATOR
int16_t        P6100_i_HotY            FINAL_SEPARATOR
{
        int16_t L6480_;
        int16_t L6479_;
        unsigned char L6478_;
        unsigned char* L6481_puc_PointerPattern;
        unsigned char* L6482_puc_PointerMask;
        int16_t L6483_;
        unsigned char L6484_;


        G4073_ai_HOT_X[P6096_i_PointerIndex] = P6099_i_HotX;
        G4074_ai_HOT_Y[P6096_i_PointerIndex] = P6100_i_HotY;
        G4075_aauc_MSE_CURSOR[P6096_i_PointerIndex][0] = 3; /* Width 24 pixels */
        G4075_aauc_MSE_CURSOR[P6096_i_PointerIndex][1] = 18; /* Height 18 pixels  */
        L6481_puc_PointerPattern = &G4075_aauc_MSE_CURSOR[P6096_i_PointerIndex][2];
        L6482_puc_PointerMask = &G4075_aauc_MSE_CURSOR[P6096_i_PointerIndex][218];
        for (L6483_ = 0; L6483_ < 18; L6483_++) {
                L6478_ = 0;
                L6479_ = 0;
                for (L6480_ = 0; L6480_ < 9; L6480_++) {
                        L6484_ = *P6097_puc_PointerBitmap++;
                        L6478_ <<= 2;
                        if ((L6484_ & 0x0F) == 1) {
                                L6478_ |= 2;
                        }
                        if ((L6484_ >> 4) == 1) {
                                L6478_ |= 1;
                        }
                        if (++L6479_ == 4) {
                                *L6482_puc_PointerMask++ = L6478_;
                                L6478_ = 0;
                                L6479_ = 0;
                        }
                        if (!(L6484_ & 0x0F)) {
                                L6484_ = (L6484_ & 0xF0) | 0x03;
                        }
                        if (!(L6484_ >> 4)) {
                                L6484_ = (L6484_ & 0x0F) | 0x30;
                        }
                        *L6481_puc_PointerPattern++ = L6484_;
                }
                P6097_puc_PointerBitmap += (P6098_i_PointerWidth - 18) >> 1;
                L6478_ = (L6478_ << 6) | 0x3F;
                *L6482_puc_PointerMask++ = L6478_;
                L6481_puc_PointerPattern += 3;
        }
}

void F2237_IODRV_10_SetMousePointer(
int16_t P6101_i_ FINAL_SEPARATOR
{
        CLI;
        F0077_MOUSE_EnableScreenUpdate_CPSE();
        MOS_type(2, G4073_ai_HOT_X[P6101_i_], G4074_ai_HOT_Y[P6101_i_], G4075_aauc_MSE_CURSOR[P6101_i_]); /* 2: Color */
        G8092_MousePointerType = P6101_i_;
        F0078_MOUSE_DisableScreenUpdate();
        STI;
}

void F1040_SetMouseBoundEvent(
int16_t* P2777_pi_XYZ SEPARATOR
int16_t  P2778_i_ButtonsStatus     FINAL_SEPARATOR
{ /* Similar to F1040_SetMouseBoundEvent */
        int16_t L2675_i_; /* Maybe declared directly in loop ? */


        CLI;
        G3103_i_MouseBoundButtonsStatus = P2778_i_ButtonsStatus;
        G3102_B_MouseBounded = C0_FALSE;
        G4072_B_FORCED_UPDATE = C1_TRUE;
        for (L2675_i_ = 0; L2675_i_ < 4; L2675_i_++) {
                G3104_ai_XYZ_MouseBound[L2675_i_] = P2777_pi_XYZ[L2675_i_];
        }
        G3102_B_MouseBounded = C1_TRUE;
        STI;
}

int16_t F0781_MouseHandler(
int16_t P2381_i_X SEPARATOR
int16_t P2382_i_Y FINAL_SEPARATOR
{
        int L2873_i_OverChampionName;
        int L2872_i_;
        int L2871_i_ChampionIndex;


        if (G3103_i_MouseBoundButtonsStatus == C33_MOUSE_EVENT_LEAVE_CHAMPION_ICON_REGION) {
                F0359_COMMAND_ProcessClick_CPSC(P2381_i_X, P2382_i_Y, C33_MOUSE_EVENT_LEAVE_CHAMPION_ICON_REGION);
        }
        /* Determine mouse pointer type */
        if (!G0601_B_UseHandAsMousePointerBitmap && !G0600_B_UseObjectAsMousePointerBitmap) {
                return C0_POINTER_ARROW;
        } else {
                for (L2872_i_ = 0; L2872_i_ < 16; L2872_i_++) {
                        if ((G2052_as_MousePointerScreenRegions[L2872_i_].XYZ[0] <= P2381_i_X) && (G2052_as_MousePointerScreenRegions[L2872_i_].XYZ[1] >= P2381_i_X) && (G2052_as_MousePointerScreenRegions[L2872_i_].XYZ[2] <= P2382_i_Y) && (G2052_as_MousePointerScreenRegions[L2872_i_].XYZ[3] >= P2382_i_Y)) {
                                if (G2052_as_MousePointerScreenRegions[L2872_i_].ChampionOrdinal == 0) {
                                        F1040_SetMouseBoundEvent(G2052_as_MousePointerScreenRegions[L2872_i_].XYZ, 0);
                                        if ((G0600_B_UseObjectAsMousePointerBitmap == C1_TRUE) && (G2052_as_MousePointerScreenRegions[L2872_i_].PointerType == C1_POINTER_HAND)) {
                                                return C2_POINTER_OBJECT_ICON;
                                        } else {
                                                return G2052_as_MousePointerScreenRegions[L2872_i_].PointerType;
                                        }
                                } else {
                                        L2871_i_ChampionIndex = M001_ORDINAL_TO_INDEX(G2052_as_MousePointerScreenRegions[L2872_i_].ChampionOrdinal & 7);
                                        L2873_i_OverChampionName = G2052_as_MousePointerScreenRegions[L2872_i_].ChampionOrdinal >> 3;
                                        F1040_SetMouseBoundEvent(G2052_as_MousePointerScreenRegions[L2872_i_].XYZ, 0);
                                        if ((L2871_i_ChampionIndex < G0305_ui_PartyChampionCount) && M516_CHAMPIONS[L2871_i_ChampionIndex].CurrentHealth && ((L2871_i_ChampionIndex == M001_ORDINAL_TO_INDEX(G0423_i_InventoryChampionOrdinal)) || L2873_i_OverChampionName)) {
                                                return C0_POINTER_ARROW;
                                        } else {
                                                if (G0600_B_UseObjectAsMousePointerBitmap == C1_TRUE) {
                                                        return C2_POINTER_OBJECT_ICON;
                                                } else {
                                                        return C1_POINTER_HAND;
                                                }
                                        }
                                }
                        }
                }
        }
}

_Far void F2239_TownsMouseHandler(
void
)
{
        int L6489_;
        int16_t L6488_;
        int L6490_;
        int L6491_;
        int L6492_;


        MOS_rdpos(&L6492_, &L6490_, &L6491_);
        if ((L6490_  != G4076_) || (L6491_ != G4077_) || G4072_B_FORCED_UPDATE) {
                G4072_B_FORCED_UPDATE = C0_FALSE;
                if (G3102_B_MouseBounded) {
                        if ((L6490_ < G3104_ai_XYZ_MouseBound[0]) || (L6490_ > G3104_ai_XYZ_MouseBound[1]) || (L6491_ < G3104_ai_XYZ_MouseBound[2]) || (L6491_ > G3104_ai_XYZ_MouseBound[3])) {
                                G3102_B_MouseBounded = C0_FALSE;
                                if ((L6488_ = F0781_MouseHandler(L6490_, L6491_)) >= 0) {
                                        F2237_IODRV_10_SetMousePointer(L6488_);
                                }
                        }
                }
                G4076_ = L6490_;
                G4077_ = L6491_;
        }
        L6489_ = L6492_;
        L6489_ ^= G4078_;
        if (L6489_ & 3) {
                if (L6489_ & 1) {
                        if (L6492_ & 1) {
                                F0359_COMMAND_ProcessClick_CPSC((int16_t)L6490_, (int16_t)L6491_, C02_MOUSE_EVENT_LEFT_BUTTON_DOWN);
                        } else {
                                F0359_COMMAND_ProcessClick_CPSC((int16_t)L6490_, (int16_t)L6491_, C04_MOUSE_EVENT_LEFT_BUTTON_UP);
                        }
                }
                if (L6489_ & 2) {
                        if (L6492_ & 2) {
                                F0359_COMMAND_ProcessClick_CPSC((int16_t)L6490_, (int16_t)L6491_, C01_MOUSE_EVENT_RIGHT_BUTTON_DOWN);
                        } else {
                                F0359_COMMAND_ProcessClick_CPSC((int16_t)L6490_, (int16_t)L6491_, C08_MOUSE_EVENT_RIGHT_BUTTON_UP);
                        }
                }
                G4078_ = L6492_;
        }
        G2010_ = L6490_;
        G2011_ = L6491_;
        G0588_i_MouseButtonsStatus = ((L6492_ >> 1) & 1) | (((int16_t)L6492_ * 2) & 2);
}

void F0700_TriggerImmediateMouseEvent(
void
)
{
        F1040_SetMouseBoundEvent(G2050_ai_Box_Impossible, 0);
        F2239_TownsMouseHandler();
}

void F2240_INIT_TOWNS_MOUSE(
void
)
{
        MOSP_start(G4079_MWORK, sizeof(G4079_MWORK));
        MOS_resolution(0, 3);
        MOS_resolution(1, 3);
        MOS_horizon(0, 319);
        MOS_vertical(0, 199);
        MOS_setpos(251, 51);
        MOS_pulse(16, 16);
        MOS_entsub(31, (void(*)())F2239_TownsMouseHandler);
}

void F2241_RESTORE_TOWNS_MOUSE(
void
)
{
        MOS_end();
}
#endif

void F0066_MOUSE_Initialize(
#ifdef MEDIA529_F20E_F20J_X30J_P20JA_P20JB_I34E_I34M_A36M_A31E_A31M_A33M_A35E_A35M_F31E_F31J_X31J_P31J
void
#endif
)
{
#ifdef MEDIA016_S10EA_S10EB_S11E_S12E_S12G_S13FA_S13FB_S20E_S21E_G14ED_G20E_G21E_A20ED_A20E_A20F_A20G_A21E_A22E_A22G_F20E_F20J_P20JA_P20JB_I34E_I34M_F31E_F31J_P31J
#ifdef MEDIA007_S10EA_S10EB_S11E_S12E_S12G_S13FA_S13FB_S20E_S21E
        REGISTER KBDVECS* L0049_ps_Kbdvecs;
#ifdef MEDIA004_S10EA_S10EB_S11E_S12E_S12G /* CHANGE5_01_FIX Useless code removed */
        int16_t L0050_i_Unreferenced; /* BUG0_00 Useless code */
#endif


        G0616_puc_Bitmap_MousePointerModifiedColorsObject = (unsigned char*)F0468_MEMORY_Allocate((long)M075_BITMAP_BYTE_COUNT(32, 18), C1_ALLOCATION_PERMANENT);
        G0615_puc_Bitmap_MousePointerOriginalColorsObject = (unsigned char*)F0468_MEMORY_Allocate((long)M075_BITMAP_BYTE_COUNT(32, 18), C1_ALLOCATION_PERMANENT);
        G0614_puc_Bitmap_MousePointerModifiedColorsChampionIcon = (unsigned char*)F0468_MEMORY_Allocate((long)M075_BITMAP_BYTE_COUNT(32, 16), C1_ALLOCATION_PERMANENT);
        G0613_puc_Bitmap_MousePointerOriginalColorsChampionIcon = (unsigned char*)F0468_MEMORY_Allocate((long)M075_BITMAP_BYTE_COUNT(32, 16), C1_ALLOCATION_PERMANENT);
        G0612_puc_Bitmap_MousePointerAreaCustom = (unsigned char*)F0468_MEMORY_Allocate((long)M075_BITMAP_BYTE_COUNT(48, 18), C1_ALLOCATION_PERMANENT);
        G0618_puc_Bitmap_MousePointerHiddenScreenArea = (unsigned char*)F0468_MEMORY_Allocate((long)M075_BITMAP_BYTE_COUNT(48, 18), C1_ALLOCATION_PERMANENT);
        G0589_i_MousePointerHotspotX = 251; /* These coordinates place the mouse pointer over the 'Enter' button on the entrance screen */
        G0590_i_MousePointerHotspotY = 51;
        L0049_ps_Kbdvecs = (KBDVECS*)Kbdvbase();
        L0049_ps_Kbdvecs->mousevec = (void (*)())S0075_MOUSE_Exception70Handler_IKBD_MIDI_MouseStatus;
#endif
#ifdef MEDIA351_G14ED_G20E_G21E
        G4009_puc_Bitmap_MousePointerObject[0] = (unsigned char*)F0468_MEMORY_Allocate((long)M075_BITMAP_BYTE_COUNT(32, 18) * 2, C1_ALLOCATION_PERMANENT);
        G4009_puc_Bitmap_MousePointerObject[1] = (unsigned char*)F0468_MEMORY_Allocate((long)M075_BITMAP_BYTE_COUNT(32, 18) * 2, C1_ALLOCATION_PERMANENT);
        G4015_puc_Bitmap_MousePointerChampion[0] = (unsigned char*)F0468_MEMORY_Allocate((long)M075_BITMAP_BYTE_COUNT(32, 18) * 2, C1_ALLOCATION_PERMANENT);
        G4015_puc_Bitmap_MousePointerChampion[1] = (unsigned char*)F0468_MEMORY_Allocate((long)M075_BITMAP_BYTE_COUNT(32, 18) * 2, C1_ALLOCATION_PERMANENT);
        G4016_puc_ = (unsigned char*)F0468_MEMORY_Allocate((long)700, C1_ALLOCATION_PERMANENT);
        G0618_puc_Bitmap_MousePointerHiddenScreenArea = (unsigned char*)F0468_MEMORY_Allocate((long)700, C1_ALLOCATION_PERMANENT);
        G4019_pui_ = (unsigned int16_t*)F0468_MEMORY_Allocate((long)700, C1_ALLOCATION_PERMANENT);
        G4020_pui_ = (unsigned int16_t*)F0468_MEMORY_Allocate((long)700, C1_ALLOCATION_PERMANENT);
        G4014_pc_ = (unsigned char*)F0468_MEMORY_Allocate((long)700, C1_ALLOCATION_PERMANENT);
        G4012_pc_ = (unsigned char*)F0468_MEMORY_Allocate((long)700, C1_ALLOCATION_PERMANENT);
        G4017_puc_ = (unsigned char*)F0468_MEMORY_Allocate((long)700, C1_ALLOCATION_PERMANENT);
        F2167_BuildAppleIIGSMouseCursor(11, 3, G0042_auc_Graphic562_Bitmap_ArrowPointer[0], G0042_auc_Graphic562_Bitmap_ArrowPointer[1], 1, 1, G4019_pui_);
        F2167_BuildAppleIIGSMouseCursor(16, 4, G0043_auc_Graphic562_Bitmap_HandPointer[0], G0043_auc_Graphic562_Bitmap_HandPointer[1], 0, 0, G4020_pui_);
#ifdef MEDIA388_G20E_G21E
        G4025_B_ = C1_TRUE;
#endif
        F0067_MOUSE_SetPointerToNormal(C0_POINTER_ARROW);
#endif
#ifdef MEDIA413_A20ED_A20E_A20F_A20G_A21E_A22E_A22G
        REGISTER int16_t L1575_i_;


        for (L1575_i_ = 0; L1575_i_ < 4; L1575_i_++) {
                if (GetSprite(&G1096_aps_MousePointerSprites[L1575_i_], (long)(L1575_i_ + 4)) == -1) {
                        Alert(0x80444D94, 0L);
                        F0507_AMIGA_DeinitializeAndInfiniteLoop();
                }
        }
        F0510_AMIGA_WaitBottomOfViewPort();
        custom.dmacon = 0x20; /* 0x8000: clear other specified bits without affecting other bits. 0x0020: Sprite DMA disable */
        F0067_MOUSE_SetPointerToNormal(); /* BUGX_XX: missing parameter */
        G1098_i_MousePointerType = C0_POINTER_TYPE_ARROW;
        G1099_i_PreviousMousePointerType = C0_POINTER_TYPE_ARROW;
#endif
#ifdef MEDIA463_P20JA_P20JB_I34E_I34M_P31J
        (*(G2161_IODriver->IODRV_09_RegisterMousePointerBitmap))(C0_POINTER_ARROW, G0042_auc_Graphic562_Bitmap_ArrowPointer, 0, 0);
        (*(G2161_IODriver->IODRV_09_RegisterMousePointerBitmap))(C1_POINTER_HAND, G0043_auc_Graphic562_Bitmap_HandPointer, 0, 0);
        (*(G2161_IODriver->IODRV_10_SetMousePointer))(C0_POINTER_ARROW);
        (*(G2161_IODriver->IODRV_02_SetMouseHandler))(F0781_MouseHandler);
        (*(G2161_IODriver->IODRV_11_SetMouseBoundEvent))(G2052_as_MousePointerScreenRegions[0].XYZ, C32_MOUSE_EVENT_CHANGE_SCREEN_REGION);
#endif
#ifdef MEDIA551_F20E_F20J_F31E_F31J
        F2236_IODRV_9_SetMousePointerBitmap(C0_POINTER_ARROW, G0042_auc_Graphic562_Bitmap_ArrowPointer, 18, 0, 0);
        F2236_IODRV_9_SetMousePointerBitmap(C1_POINTER_HAND, G0043_auc_Graphic562_Bitmap_HandPointer, 18, 0, 0);
        F2237_IODRV_10_SetMousePointer(C0_POINTER_ARROW);
        F1040_SetMouseBoundEvent(G2052_as_MousePointerScreenRegions[0].XYZ, 0);
#endif
#ifdef MEDIA458_P20JA_P20JB
        (*(G2161_IODriver->IODRV_14_SetCustomVerticalBlankRoutine))(F0782_);
#endif
#endif
#ifdef MEDIA607_X30J_X31J
#ifdef MEDIA692_X31J
        G3113_ = 251;
        G3111_ = 98;
        if (G3076_B_) {
                G3145_ = 72;
                G3143_ = 28;
                G3113_ += 72;
                G3111_ += 56;
                G3144_ = 455;
                G3142_ = 510;
        } else {
                G3144_ = 319;
                G3142_ = 447;
        }
#endif
        asm {
                        move.l  #0xC2,d0        /* SP_OFF */
                        trap    #0xF            /* TRAP 15 (IOCS CALL) */
                        clr.l   -(sp)
                        dc.w    0xFF20          /* DOS CALL SUPER */
                        lea     @Tbyte_1E046,a0
#ifdef MEDIA577_X30J
                        movea.l #0xEBC000,a1
#endif
#ifdef MEDIA692_X31J
                        movea.l #0xFFEBC000,a1
#endif
                        bsr.s   @Tloc_1E01C
                        lea     @Tbyte_1E146,a0
#ifdef MEDIA577_X30J
                        movea.l #0xEBC400,a1
#endif
#ifdef MEDIA692_X31J
                        movea.l #0xFFEBC400,a1
#endif
                        bsr.s   @Tloc_1E01C
                        lea     G3088_aui_Palette_TopAndBottomScreen(a5),a0
#ifdef MEDIA577_X30J
                        movea.l #0xE823E0,a1    /* Sprite Palette #14 (16 colors per palette) */
#endif
#ifdef MEDIA692_X31J
                        movea.l #0xFFE823E0,a1  /* Sprite Palette #14 (16 colors per palette) */
#endif
                        moveq   #0xF,d1
                @Tloc_1DFD8:
                        move.w  (a0)+,(a1)+
                        dbf     d1,@Tloc_1DFD8
#ifdef MEDIA577_X30J
                        movea.l #0xE823F8,a1    /* Second part of Sprite Palette #15 */
#endif
#ifdef MEDIA692_X31J
                        movea.l #0xFFE823F8,a1  /* Second part of Sprite Palette #15 */
#endif
                        move.w  #1,(a1)
#ifdef MEDIA577_X30J
                        movea.l #0xEB0000,a0    /* Sprite register */
#endif
#ifdef MEDIA692_X31J
                        movea.l #0xFFEB0000,a0  /* Sprite register */
#endif
                        move.w  #0x1FF,d1
                        moveq   #0,d2
                @Tloc_1DFF4:
                        move.w  d2,(a0)+
                        dbf     d1,@Tloc_1DFF4
                        move.l  d0,-(sp)
                        dc.w    0xFF20          /* DOS CALL SUPER */
                        addq.l  #4,sp
                        moveq   #0x70,d0        /* MS_INIT */
                        trap    #0xF            /* TRAP 15 (IOCS CALL) */
                        moveq   #0x72,d0        /* MS_CUROF */
                        trap    #0xF            /* TRAP 15 (IOCS CALL) */
                        move.w  #C0_POINTER_ARROW,-(sp)
                        jsr     F0067_MOUSE_SetPointerToNormal
                        addq.l  #2,sp
                        move.w  #1,G3108_(a5)
        }
        return;
        asm {
                @Tloc_1E01C:
                        move.w  #0x3F,d1
                @Tloc_1E020:
                        move.w  (a0)+,(a1)+
                        dbf     d1,@Tloc_1E020
                        move.w  #0x3F,d1
                @Tloc_1E02A:
                        clr.w   (a1)+
                        dbf     d1,@Tloc_1E02A
                        move.w  #0x3F,d1
                @Tloc_1E034:
                        move.w  (a0)+,(a1)+
                        dbf     d1,@Tloc_1E034
                        move.w  #0xBF,d1
                @Tloc_1E03E:
                        clr.w   (a1)+
                        dbf     d1,@Tloc_1E03E
                        rts
                @Tbyte_1E046:
                        dc.b 0xCC, 0x00, 0x00, 0x00, 0xC4, 0xC0, 0x00, 0x00
                        dc.b 0xC4, 0xC0, 0x00, 0x00, 0xC4, 0x4C, 0x00, 0x00
                        dc.b 0xC4, 0x4C, 0x00, 0x00, 0xC4, 0x44, 0xC0, 0x00
                        dc.b 0xC4, 0x44, 0xC0, 0x00, 0xC4, 0x44, 0x4C, 0x00
                        dc.b 0xC4, 0x44, 0x4C, 0x00, 0xC4, 0x44, 0x44, 0xC0
                        dc.b 0xC4, 0x44, 0x44, 0xC0, 0xC4, 0x44, 0x44, 0x4C
                        dc.b 0xC4, 0x44, 0x44, 0x4C, 0xC4, 0x44, 0x44, 0x44
                        dc.b 0xC4, 0x44, 0x44, 0x44, 0xC4, 0x44, 0x44, 0x44
                        dc.b 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
                        dc.b 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
                        dc.b 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
                        dc.b 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
                        dc.b 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
                        dc.b 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
                        dc.b 0x00, 0x00, 0x00, 0x00, 0xC0, 0x00, 0x00, 0x00
                        dc.b 0xC0, 0x00, 0x00, 0x00, 0x4C, 0x00, 0x00, 0x00
                        dc.b 0xC4, 0x44, 0x44, 0x44, 0xC4, 0x44, 0x44, 0x44
                        dc.b 0xC4, 0x44, 0x44, 0x44, 0xC4, 0x44, 0x44, 0x4C
                        dc.b 0xC4, 0x44, 0xC4, 0x4C, 0xC4, 0x44, 0xC4, 0x4C
                        dc.b 0xC4, 0x4C, 0x0C, 0x44, 0xC4, 0x4C, 0x0C, 0x44
                        dc.b 0xC4, 0xC0, 0x0C, 0x44, 0xC4, 0xC0, 0x00, 0xC4
                        dc.b 0xCC, 0x00, 0x00, 0xC4, 0x00, 0x00, 0x00, 0xC4
                        dc.b 0x00, 0x00, 0x00, 0x0C, 0x00, 0x00, 0x00, 0x0C
                        dc.b 0x00, 0x00, 0x00, 0x0C, 0x00, 0x00, 0x00, 0x0C
                        dc.b 0x4C, 0x00, 0x00, 0x00, 0x44, 0xC0, 0x00, 0x00
                        dc.b 0x44, 0xC0, 0x00, 0x00, 0xCC, 0xC0, 0x00, 0x00
                        dc.b 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
                        dc.b 0xC0, 0x00, 0x00, 0x00, 0xC0, 0x00, 0x00, 0x00
                        dc.b 0xC0, 0x00, 0x00, 0x00, 0x4C, 0x00, 0x00, 0x00
                        dc.b 0x4C, 0x00, 0x00, 0x00, 0x4C, 0x00, 0x00, 0x00
                        dc.b 0x44, 0xC0, 0x00, 0x00, 0x44, 0xC0, 0x00, 0x00
                        dc.b 0x44, 0xC0, 0x00, 0x00, 0xCC, 0xC0, 0x00, 0x00
                @Tbyte_1E146:
                        dc.b 0xCC, 0x00, 0x00, 0x00, 0xAA, 0xC0, 0x00, 0x00
                        dc.b 0xAA, 0xC0, 0xC0, 0xC0, 0xCA, 0xAC, 0xAC, 0xAC
                        dc.b 0xCA, 0xAC, 0xAC, 0xAC, 0x0C, 0xAA, 0xCA, 0xCA
                        dc.b 0x0C, 0xAA, 0xCA, 0xCA, 0x00, 0xCA, 0xAC, 0xAC
                        dc.b 0x00, 0xCA, 0xAC, 0xAC, 0x00, 0x0C, 0xAA, 0xCA
                        dc.b 0x00, 0x0C, 0xAA, 0xCA, 0x00, 0x0C, 0xAA, 0xAC
                        dc.b 0x00, 0x0C, 0xAA, 0xAC, 0x00, 0x00, 0xCA, 0xAA
                        dc.b 0xCC, 0x00, 0xCA, 0xAA, 0xAA, 0xC0, 0xCA, 0xAA
                        dc.b 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
                        dc.b 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
                        dc.b 0x0C, 0x00, 0x00, 0x00, 0xCA, 0xC0, 0x00, 0x00
                        dc.b 0xCA, 0xC0, 0x00, 0x00, 0xAC, 0xAC, 0x00, 0x00
                        dc.b 0xAC, 0xAC, 0x00, 0x00, 0xCA, 0xCA, 0xC0, 0x00
                        dc.b 0xCA, 0xCA, 0xC0, 0x00, 0xAC, 0xAC, 0xAC, 0x00
                        dc.b 0xAC, 0xAC, 0xAC, 0x00, 0xAA, 0xAA, 0xAC, 0x00
                        dc.b 0xAA, 0xAA, 0xAC, 0x00, 0xAA, 0xAA, 0xAA, 0xC0
                        dc.b 0xAA, 0xC0, 0xCA, 0xAA, 0xCA, 0xAC, 0xCA, 0xAA
                        dc.b 0xCA, 0xAC, 0xCA, 0xAA, 0xCA, 0xAA, 0xCA, 0xAA
                        dc.b 0xCA, 0xAA, 0xAA, 0xAA, 0x0C, 0xAA, 0xAA, 0xAA
                        dc.b 0x0C, 0xAA, 0xAA, 0xAA, 0x0C, 0xAA, 0xAA, 0xAA
                        dc.b 0x00, 0xCA, 0xAA, 0xAA, 0x00, 0xCA, 0xAA, 0xAA
                        dc.b 0x00, 0x0C, 0xAA, 0xAA, 0x00, 0x00, 0xCA, 0xAA
                        dc.b 0x00, 0x00, 0x0C, 0xAA, 0x00, 0x00, 0x00, 0xCA
                        dc.b 0x00, 0x00, 0x00, 0x0C, 0x00, 0x00, 0x00, 0x0C
                        dc.b 0xAA, 0xAA, 0xAA, 0xC0, 0xAA, 0xAA, 0xAA, 0xC0
                        dc.b 0xAA, 0xAA, 0xAA, 0xC0, 0xAA, 0xAA, 0xAA, 0xC0
                        dc.b 0xAA, 0xAA, 0xAA, 0xC0, 0xAA, 0xAA, 0xAA, 0xC0
                        dc.b 0xAA, 0xAA, 0xAA, 0xC0, 0xAA, 0xAA, 0xAA, 0xAC
                        dc.b 0xAA, 0xAA, 0xAA, 0xAC, 0xAA, 0xAA, 0xAA, 0xAC
                        dc.b 0xAA, 0xAA, 0xAA, 0xAA, 0xAA, 0xAA, 0xAA, 0xAA
                        dc.b 0xAA, 0xAA, 0xAA, 0xAA, 0xAA, 0xAA, 0xAA, 0xAA
                        dc.b 0xAA, 0xAA, 0xAA, 0xAA, 0xAA, 0xAA, 0xAA, 0xAA
        }
#endif
#ifdef MEDIA746_A36M_A31E_A31M_A33M_A35E_A35M
        register int16_t* L2882_pi_;
        register unsigned int16_t L2883_ui_;


        for (L2883_ui_ = 0; L2883_ui_ < 4; L2883_ui_++) {
                G1096_aps_MousePointerSprites[L2883_ui_].posctldata = NULL;
                G1096_aps_MousePointerSprites[L2883_ui_].height = 18;
                G1096_aps_MousePointerSprites[L2883_ui_].x = 0;
                G1096_aps_MousePointerSprites[L2883_ui_].y = 0;
                if (GetSprite(&G1096_aps_MousePointerSprites[L2883_ui_], (long)L2883_ui_ + 4) == -1) {
                        F1050_AlertCSBSystemError(0x80FF0013);
                }
        }
        if ((G3203_ = AllocMem((long)((10 + 10) * sizeof(SPRITEIMAGE)), MEMF_CHIP | MEMF_CLEAR)) == NULL) {
                 F1050_AlertCSBSystemError(0x80FF001E);
        }
        for (L2883_ui_ = 0; L2883_ui_ < 5; L2883_ui_++) {
                L2882_pi_ = G3203_ + (L2883_ui_ * 160);
                L2882_pi_[41] |= 0x80;
                L2882_pi_[121] |= 0x80;
        }
        F1036_Mouse1(G0042_auc_Graphic562_Bitmap_ArrowPointer, C0_POINTER_ARROW);
        F1036_Mouse1(G0043_auc_Graphic562_Bitmap_HandPointer, C1_POINTER_HAND);
        G3202_B_ = C1_TRUE;
        F0700_TriggerImmediateMouseEvent();
#endif
}

#ifdef MEDIA746_A36M_A31E_A31M_A33M_A35E_A35M
void F1045_(
void
)
{
        register int16_t L2884_i_;
#ifdef MEDIA758_A36M_A35E_A35M
        register int16_t* L2885_pi_;


        G3202_B_ = C0_FALSE;
        if (G3203_) {
                L2885_pi_ = G3203_;
                for (L2884_i_ = 0; L2884_i_ < 4; L2884_i_++) {
                        ChangeSprite(&G3191_ps_MsgPort_FTL_DRIA_Video->_0x44_ViewPort, &G1096_aps_MousePointerSprites[L2884_i_], L2885_pi_ + (L2884_i_* 40));
                        MoveSprite(&G3191_ps_MsgPort_FTL_DRIA_Video->_0x44_ViewPort, &G1096_aps_MousePointerSprites[L2884_i_], 352L, 240L);
                }
        }
#endif
        if (G3203_) {
                FreeMem(G3203_, (long)((10 + 10) * sizeof(SPRITEIMAGE)));
        }
        G3203_ = NULL;
        for (L2884_i_ = 0; L2884_i_ < 4; L2884_i_++) {
                FreeSprite((long)L2884_i_ + 4);
        }
}
#endif

#ifdef MEDIA613_X30J_A36M_A31E_A31M_A33M_A35E_A35M_X31J
void F1040_SetMouseBoundEvent( /* Tells the program to trigger the event specified in P2778_i_ButtonsStatus when the mouse cursor will move out of the zone specified in P2777_pi_XYZ */
int16_t* P2777_pi_XYZ          SEPARATOR
int16_t  P2778_i_ButtonsStatus FINAL_SEPARATOR
{
#ifdef MEDIA611_X30J_A36M_A31E_A31M_A33M_A35E_A35M
        int16_t L2675_i_;
#endif


        G3102_B_MouseBounded = C0_FALSE;
#ifdef MEDIA611_X30J_A36M_A31E_A31M_A33M_A35E_A35M
        for (L2675_i_ = 0; L2675_i_ < 4; L2675_i_++) {
                G3104_ai_XYZ_MouseBound[L2675_i_] = P2777_pi_XYZ[L2675_i_];
        }
#endif
#ifdef MEDIA692_X31J
        F0007_MAIN_CopyBytes(P2777_pi_XYZ, G3104_ai_XYZ_MouseBound, (long)sizeof(G3104_ai_XYZ_MouseBound));
#endif
        G3103_i_MouseBoundButtonsStatus = P2778_i_ButtonsStatus;
        G3102_B_MouseBounded = C1_TRUE;
}

void F0700_TriggerImmediateMouseEvent(
void
)
{
        G3105_B_ = C1_TRUE;
}
#endif

#ifdef MEDIA496_F20E_F20J_P20JA_P20JB_I34E_I34M_F31E_F31J_P31J
void F0783_LockMouse(
void
)
{
#ifdef MEDIA463_P20JA_P20JB_I34E_I34M_P31J
        (*(G2161_IODriver->IODRV_05_LockMouse))();
#endif
}

void F0784_UnlockMouse(
void
)
{
#ifdef MEDIA463_P20JA_P20JB_I34E_I34M_P31J
        (*(G2161_IODriver->IODRV_06_UnlockMouse))();
#endif
}

void F0702_BuildObjectMousePointerIcon(
unsigned char* P2384_puc_ObjectBitmap SEPARATOR
char*          P2385_puc_TargetBitmap FINAL_SEPARATOR
{
        unsigned char* L2887_puc_Bitmap;


#ifdef MEDIA463_P20JA_P20JB_I34E_I34M_P31J
        L2887_puc_Bitmap = M533_F0468_MEMORY_Allocate(128L, C0_ALLOCATION_TEMPORARY_ON_TOP_OF_HEAP, MASK0x0008_MEMREQ);
#endif
#ifdef MEDIA551_F20E_F20J_F31E_F31J
        L2887_puc_Bitmap = M533_F0468_MEMORY_Allocate(256L, C0_ALLOCATION_TEMPORARY_ON_TOP_OF_HEAP, MASK0x0008_MEMREQ);
#endif
#ifdef MEDIA458_P20JA_P20JB
        F1004_VIDEO_BlitShrinkWithPaletteChanges(P2384_puc_ObjectBitmap, L2887_puc_Bitmap, 16, 16, 16, 16, G0045_auc_Graphic562_PaletteChanges_MousePointerIconShadow);
#endif
#ifdef MEDIA553_F20E_F20J_I34E_I34M_F31E_F31J_P31J
        F0129_VIDEO_BlitShrinkWithPaletteChanges(P2384_puc_ObjectBitmap, L2887_puc_Bitmap, 16, 16, 16, 16, G0045_auc_Graphic562_PaletteChanges_MousePointerIconShadow);
#endif
#ifdef MEDIA457_P20JA
        F0009_MAIN_WriteSpacedBytes(P2385_puc_TargetBitmap, M075_BITMAP_BYTE_COUNT(18, 18), 0x11, 1); /* Fill 18x18 pixels with color  */
#endif
#ifdef MEDIA551_F20E_F20J_F31E_F31J
        F0009_MAIN_WriteSpacedBytes(P2385_puc_TargetBitmap, M103_BITMAP_BYTE_COUNT(18, 18), 0x11, 1); /* Fill 18x18 pixels with color  */
#endif
#ifdef MEDIA480_P20JB_I34E_I34M_P31J
        F0009_MAIN_WriteSpacedBytes(P2385_puc_TargetBitmap, M075_BITMAP_BYTE_COUNT(18, 18), 0xCC, 1); /* Fill 18x18 pixels with color C12_COLOR_DARKEST_GRAY */
#endif
#ifdef MEDIA463_P20JA_P20JB_I34E_I34M_P31J
        F0132_VIDEO_Blit(L2887_puc_Bitmap, P2385_puc_TargetBitmap, G2053_ai_XYZ, 0, 0, 16, 18, C12_COLOR_DARKEST_GRAY, MASK0x0000_NO_FLIP);
        F0469_MEMORY_FreeAtHeapTop(128L);
        F0132_VIDEO_Blit(P2384_puc_ObjectBitmap, P2385_puc_TargetBitmap, G2054_ai_XYZ, 0, 0, 16, 18, C12_COLOR_DARKEST_GRAY, MASK0x0000_NO_FLIP);
#endif
#ifdef MEDIA551_F20E_F20J_F31E_F31J
        F0132_VIDEO_Blit(L2887_puc_Bitmap, M774_CAST_PUC(P2385_puc_TargetBitmap), G2053_ai_XYZ, 0, 0, 16, 18, C12_COLOR_DARKEST_GRAY);
        F0469_MEMORY_FreeAtHeapTop(256L);
        F0132_VIDEO_Blit(P2384_puc_ObjectBitmap, M774_CAST_PUC(P2385_puc_TargetBitmap), G2054_ai_XYZ, 0, 0, 16, 18, C12_COLOR_DARKEST_GRAY);
#endif
}
#endif

#ifdef MEDIA351_G14ED_G20E_G21E
void F2159_ClampMousePointerOnASinglePixel(
)
{
        asm {
                LDA     #0x00
                PHA                     /* Space for result */
                PHA                     /* Space for result */
                PHA                     /* Space for result */
                LDX     #0x1703         /* ReadMouse */
                JSL     0xe10000
                PLA                     /* status / mode */
                PLY                     /* Y */
                PLX                     /* X */
                PHX                     /* Xmin */
                PHX                     /* Xmax */
                PHY                     /* Ymin */
                PHY                     /* Ymax */
                LDX     #0x1c03         /* ClampMouse */
                JSL     0xe10000
        }
}

int16_t F2160_GetMousePointerHotspotX(
)
{
        int16_t L6412_;


        asm {
                LDA     #0x00
                PHA                     /* Space for result */
                PHA                     /* Space for result */
                PHA                     /* Space for result */
                LDX     #0x1703         /* ReadMouse */
                JSL     0xe10000
                PLA                     /* status / mode */
                PLA                     /* Y */
                PLA                     /* X */
                STA     L6412_
        }
        return L6412_;
}

int16_t F2161_GetMousePointerHotspotY(
)
{
        int16_t L6413_;


        asm {
                LDA     #0x00
                PHA                     /* Space for result */
                PHA                     /* Space for result */
                PHA                     /* Space for result */
                LDX     #0x1703         /* ReadMouse */
                JSL     0xe10000
                PLA                     /* status / mode */
                PLA                     /* Y */
                STA     L6413_
                PLA                     /* X */
        }
        return L6413_;
}

int16_t F2158_GetMouseButtonsStatus(
)
{
        int16_t L6414_;


        asm {
                        LDA     #0x00
                        PHA                     /* Space for result */
                        PHA                     /* Space for result */
                        PHA                     /* Space for result */
                        LDX     #0x1703         /* ReadMouse */
                        JSL     0xe10000
                        PLA                     /* status / mode */
                        AND     #0x8000
                        BEQ     L082624
                        LDA     #0xffff
                L082624:
                        STA     L6414_
                        PLA                     /* Y */
                        PLA                     /* X */
        }
        return L6414_;
}
#endif

void F0067_MOUSE_SetPointerToNormal(
#ifdef MEDIA009_S10EA_S10EB_S11E_S12E_S12G_S13FA_S13FB_S20E_S21E_G14ED_G20E_G21E_A20ED_A20E_A20F_A20G_A21E_A22E_A22G
P0092_i_MousePointer)
#endif
int16_t P0092_i_MousePointer FINAL_SEPARATOR
{
#ifdef MEDIA008_S10EA_S10EB_S11E_S12E_S12G_S13FA_S13FB_S20E_S21E_G14ED_G20E_G21E
        F0077_MOUSE_EnableScreenUpdate_CPSE();
#endif
#ifdef MEDIA413_A20ED_A20E_A20F_A20G_A21E_A22E_A22G
        G1094_B_PreventBuildPointerScreenArea = C1_TRUE;
#endif
        G0600_B_UseObjectAsMousePointerBitmap = C0_FALSE;
        G0601_B_UseHandAsMousePointerBitmap = (P0092_i_MousePointer == C1_POINTER_HAND);
#ifdef MEDIA009_S10EA_S10EB_S11E_S12E_S12G_S13FA_S13FB_S20E_S21E_G14ED_G20E_G21E_A20ED_A20E_A20F_A20G_A21E_A22E_A22G
        G0598_B_MousePointerBitmapUpdated = C1_TRUE;
#endif
#ifdef MEDIA351_G14ED_G20E_G21E
        while (G0598_B_MousePointerBitmapUpdated);
#endif
#ifdef MEDIA529_F20E_F20J_X30J_P20JA_P20JB_I34E_I34M_A36M_A31E_A31M_A33M_A35E_A35M_F31E_F31J_X31J_P31J
        F0700_TriggerImmediateMouseEvent();
#endif
#ifdef MEDIA008_S10EA_S10EB_S11E_S12E_S12G_S13FA_S13FB_S20E_S21E_G14ED_G20E_G21E
        F0078_MOUSE_DisableScreenUpdate();
#endif
#ifdef MEDIA413_A20ED_A20E_A20F_A20G_A21E_A22E_A22G
        G1094_B_PreventBuildPointerScreenArea = C0_FALSE;
        F0073_MOUSE_BuildPointerScreenArea(G0589_i_MousePointerHotspotX, G0590_i_MousePointerHotspotY);
#endif
}

#ifdef MEDIA413_A20ED_A20E_A20F_A20G_A21E_A22E_A22G
#include "MOUSESET.C"
#endif

#ifdef MEDIA613_X30J_A36M_A31E_A31M_A33M_A35E_A35M_X31J
void F1036_Mouse1(
register unsigned char* P2770_puc_Bitmap SEPARATOR
int16_t                 P2771_i_         FINAL_SEPARATOR
{
#ifdef MEDIA607_X30J_X31J
        register int16_t L2888_i_;
        register int16_t L2889_i_;
        register int16_t L2890_i_;
        register int16_t L2891_i_;
        register int16_t L2892_i_;
        register int16_t* L2893_pi_;
        register int16_t* L2894_pi_;
        long L2895_l_SupervisorStack;


#ifdef MEDIA577_X30J
        L2894_pi_ = (int16_t*)((unsigned char*)0xEBC000 + (P2771_i_ * 1024));
#endif
#ifdef MEDIA692_X31J
        L2894_pi_ = (int16_t*)((unsigned char*)0xFFEBC000 + (P2771_i_ * 1024));
#endif
        L2889_i_ = M724_BITMAP_BYTE_WIDTH(M100_PIXEL_WIDTH(P2770_puc_Bitmap));
        L2892_i_ = M101_PIXEL_HEIGHT(P2770_puc_Bitmap);
#ifdef MEDIA577_X30J
        L2895_l_SupervisorStack = F1027_Supervisor(0L);
#endif
#ifdef MEDIA692_X31J
        asm {
                clr.l   -(sp)
                dc.w 0xFF20     /* DOS CALL SUPER */
                addq.l  #4,sp
                move.l  d0,L2895_l_SupervisorStack(a6)
        }
#endif
        F0008_MAIN_ClearBytes(L2894_pi_, 768L);
        for (L2891_i_ = 0; L2891_i_ < L2892_i_; L2891_i_++) {
                L2893_pi_ = L2894_pi_;
                for (L2888_i_ = 0; L2888_i_ < L2889_i_; L2888_i_++) {
                        L2890_i_ = *P2770_puc_Bitmap++ << 8;
                        L2888_i_++;
                        if (L2888_i_ != L2889_i_) {
                                L2890_i_ |= *P2770_puc_Bitmap++;
                        }
                        *L2893_pi_++ = L2890_i_;
                        *(L2893_pi_ + 1) = L2890_i_;
                        if ((L2888_i_ & 3) == 3) {
                                L2893_pi_ += 30;
                        }
                }
                L2894_pi_ += 4;
                if ((L2891_i_ & 7) == 7) {
                        L2894_pi_ += 96;
                }
        }
#ifdef MEDIA577_X30J
        F1027_Supervisor(L2895_l_SupervisorStack);
#endif
#ifdef MEDIA692_X31J
        asm {
                move.l  L2895_l_SupervisorStack(a6),-(sp)
                dc.w 0xFF20     /* DOS CALL SUPER */
                addq.l  #4,sp
        }
#endif
#endif
#ifdef MEDIA746_A36M_A31E_A31M_A33M_A35E_A35M
        register int16_t* L2896_pi_;
        register unsigned int16_t L2897_ui_;
        register unsigned int16_t L2898_ui_;
        register int16_t L2899_i_;
        register unsigned int16_t L2900_ui_;
        register unsigned int16_t L2901_ui_;
        int16_t* L2902_pi_;
#ifdef MEDIA626_A31E_A31M_A33M_A35E_A35M
        int16_t* L2903_;
        int16_t* L2904_;
        int16_t* L2905_;
        int16_t* L2906_; /* Bitplane 0 */
        int16_t* L2907_; /* Bitplane 1 */
        int16_t* L2908_; /* Bitplane 2 */
        int16_t* L2909_; /* Bitplane 3 */
#endif
#ifdef MEDIA744_A36M
        long L2903_;
        long L2904_;
        long L2905_;
        long L2906_; /* Bitplane 0 */
        long L2907_; /* Bitplane 1 */
        long L2908_; /* Bitplane 2 */
        long L2909_; /* Bitplane 3 */
#endif


        L2896_pi_ = G3203_ + ((P2771_i_ + 1) * 160) + 2;
        for (L2899_i_ = 0; L2899_i_ < 4; L2899_i_++) {
                F0008_MAIN_ClearBytes(L2896_pi_ + (L2899_i_ * 40), (long)((18 + 18) * sizeof(int16_t)));
        }
        L2898_ui_ = M101_PIXEL_HEIGHT(P2770_puc_Bitmap);
        L2897_ui_ = (int16_t)((M100_PIXEL_WIDTH(P2770_puc_Bitmap) + 0x0F) & 0xFFF0) >> 4;
        L2901_ui_ = L2898_ui_ * L2897_ui_;
        for (L2900_ui_ = 0; L2900_ui_ < L2897_ui_; L2900_ui_++) {
                L2902_pi_ = L2896_pi_;
#ifdef MEDIA626_A31E_A31M_A33M_A35E_A35M
                L2903_ = L2896_pi_ + 1;
                L2904_ = L2902_pi_ + 40;
                L2905_ = L2903_ + 40;
                L2906_ = P2770_puc_Bitmap;
                L2907_ = L2906_ + L2901_ui_;
                L2908_ = L2907_ + L2901_ui_;
                L2909_ = L2908_ + L2901_ui_;
                for (L2899_i_ = 0; L2899_i_ < L2898_ui_; L2899_i_++) {
                        *L2902_pi_ = *L2906_;
                        L2902_pi_ += 2;
                        L2906_ += L2897_ui_;
                        *L2903_ = *L2907_;
                        L2903_ += 2;
                        L2907_ += L2897_ui_;
                        *L2904_ = *L2908_;
                        L2904_ += 2;
                        L2908_ += L2897_ui_;
                        *L2905_ = *L2909_;
                        L2905_ += 2;
                        L2909_ += L2897_ui_;
                }
#endif
#ifdef MEDIA744_A36M
                L2903_ = (long)L2896_pi_ + 2;
                L2904_ = (long)L2902_pi_ + 80;
                L2905_ = L2903_ + 80;
                L2906_ = (long)P2770_puc_Bitmap;
                L2907_ = L2906_ + (long)L2901_ui_ * 2;
                L2908_ = L2907_ + (long)L2901_ui_ * 2;
                L2909_ = L2908_ + (long)L2901_ui_ * 2;
                for (L2899_i_ = 0; L2899_i_ < L2898_ui_; L2899_i_++) {
                        *((int16_t*)L2902_pi_) = *((int16_t*)L2906_);
                        L2902_pi_ += 2;
                        L2906_ += (long)L2897_ui_ * 2;
                        *((int16_t*)L2903_) = *((int16_t*)L2907_);
                        L2903_ += 4;
                        L2907_ += (long)L2897_ui_ * 2;
                        *((int16_t*)L2904_) = *((int16_t*)L2908_);
                        L2904_ += 4;
                        L2908_ += (long)L2897_ui_ * 2;
                        *((int16_t*)L2905_) = *((int16_t*)L2909_);
                        L2905_ += 4;
                        L2909_ += (long)L2897_ui_ * 2;
                }
#endif
                L2896_pi_ += 80;
                P2770_puc_Bitmap += 2;
        }
#endif
}

void F1037_Mouse2(
unsigned char* P2772_puc_Bitmap SEPARATOR
unsigned char* P2773_puc_Bitmap SEPARATOR
int16_t        P2774_i_         FINAL_SEPARATOR
{
#ifdef MEDIA611_X30J_A36M_A31E_A31M_A33M_A35E_A35M
        int16_t L2910_ai_XYZ[4];
#endif
        register int16_t L2911_i_Width;
        register int16_t L2912_i_Height;
#ifdef MEDIA577_X30J
        register long L2913_l_;
#endif
        register unsigned char* L2914_puc_;


        L2911_i_Width = M100_PIXEL_WIDTH(P2772_puc_Bitmap);
        L2912_i_Height = M101_PIXEL_HEIGHT(P2772_puc_Bitmap);
#ifdef MEDIA577_X30J
        L2914_puc_ = F0468_MEMORY_Allocate(L2913_l_ = M103_BITMAP_BYTE_COUNT(L2911_i_Width, L2912_i_Height), MASK0x8000_ALLOCATE_BITMAP | C0_ALLOCATION_TEMPORARY_ON_TOP_OF_HEAP);
#endif
#ifdef MEDIA749_A36M_A31E_A31M_A33M_A35E_A35M_X31J
        L2914_puc_ = F0606_AllocateMemForGraphic(L2911_i_Width, L2912_i_Height, C0_ALLOCATION_TEMPORARY_ON_TOP_OF_HEAP);
#endif
        F0663_CopyBitmapWithPaletteChanges(P2772_puc_Bitmap, L2914_puc_, (P2774_i_ == 0) ? G3100_auc_PaletteChanges_3 : G0045_auc_Graphic562_PaletteChanges_MousePointerIconShadow);
#ifdef MEDIA577_X30J
        L2911_i_Width += G2185_Unreferenced;
        L2912_i_Height += G2186_Unreferenced;
        F0134_VIDEO_FillBitmap(P2773_puc_Bitmap, C12_COLOR_DARKEST_GRAY, L2911_i_Width, L2912_i_Height);
        M100_PIXEL_WIDTH(P2773_puc_Bitmap) = L2911_i_Width;
        M101_PIXEL_HEIGHT(P2773_puc_Bitmap) = L2912_i_Height;
        M704_ZONE_LEFT(L2910_ai_XYZ) = G2185_Unreferenced;
        M705_ZONE_RIGHT(L2910_ai_XYZ) = L2911_i_Width - 1;
        M706_ZONE_TOP(L2910_ai_XYZ) = G2186_Unreferenced;
        M707_ZONE_BOTTOM(L2910_ai_XYZ) = L2912_i_Height - 1;
#endif
#ifdef MEDIA746_A36M_A31E_A31M_A33M_A35E_A35M
        F0134_VIDEO_FillBitmap(P2773_puc_Bitmap, C12_COLOR_DARKEST_GRAY, L2911_i_Width + G2185_Unreferenced, L2912_i_Height + G2186_Unreferenced);
        M100_PIXEL_WIDTH(P2773_puc_Bitmap) = L2911_i_Width + G2185_Unreferenced;
        M101_PIXEL_HEIGHT(P2773_puc_Bitmap) = L2912_i_Height + G2186_Unreferenced;
        M704_ZONE_LEFT(L2910_ai_XYZ) = G2185_Unreferenced;
        M708_ZONE_WIDTH(L2910_ai_XYZ) = L2911_i_Width;
        M706_ZONE_TOP(L2910_ai_XYZ) = G2186_Unreferenced;
        M709_ZONE_HEIGHT(L2910_ai_XYZ) = L2912_i_Height;
#endif
#ifdef MEDIA611_X30J_A36M_A31E_A31M_A33M_A35E_A35M
        F0654_Call_F0132_VIDEO_Blit(L2914_puc_, P2773_puc_Bitmap, L2910_ai_XYZ, 0, 0, C12_COLOR_DARKEST_GRAY);
#endif
#ifdef MEDIA692_X31J
        F0134_VIDEO_FillBitmap(P2773_puc_Bitmap, C12_COLOR_DARKEST_GRAY, M100_PIXEL_WIDTH(P2773_puc_Bitmap) = L2911_i_Width + G2185_Unreferenced, M101_PIXEL_HEIGHT(P2773_puc_Bitmap) = L2912_i_Height + G2186_Unreferenced);
        F0654_Call_F0132_VIDEO_Blit(L2914_puc_, P2773_puc_Bitmap, F0626_GetTemporaryZoneInitializedFromCoordinates(G2185_Unreferenced, G2186_Unreferenced, L2911_i_Width, L2912_i_Height), 0, 0, C12_COLOR_DARKEST_GRAY);
#endif
#ifdef MEDIA749_A36M_A31E_A31M_A33M_A35E_A35M_X31J
        F0607_FreeMemForGraphic(L2914_puc_);
#endif
#ifdef MEDIA577_X30J
        F0469_MEMORY_FreeAtHeapTop(L2913_l_ + 4);
        M704_ZONE_LEFT(L2910_ai_XYZ) = 0;
        M705_ZONE_RIGHT(L2910_ai_XYZ) -= G2185_Unreferenced;
        M706_ZONE_TOP(L2910_ai_XYZ) = 0;
        M707_ZONE_BOTTOM(L2910_ai_XYZ) -= G2186_Unreferenced;
#endif
#ifdef MEDIA746_A36M_A31E_A31M_A33M_A35E_A35M
        M704_ZONE_LEFT(L2910_ai_XYZ) = 0;
        M706_ZONE_TOP(L2910_ai_XYZ) = 0;
#endif
#ifdef MEDIA611_X30J_A36M_A31E_A31M_A33M_A35E_A35M
        F0654_Call_F0132_VIDEO_Blit(P2772_puc_Bitmap, P2773_puc_Bitmap, L2910_ai_XYZ, 0, 0, P2774_i_);
#endif
#ifdef MEDIA692_X31J
        F0654_Call_F0132_VIDEO_Blit(P2772_puc_Bitmap, P2773_puc_Bitmap, F0627_GetTemporaryZoneInitializedFromDimensions(L2911_i_Width, L2912_i_Height), 0, 0, P2774_i_);
#endif
        F0662_ApplyPaletteChanges(P2773_puc_Bitmap, G3101_auc_PaletteChanges_1);
}
#endif

void F0068_MOUSE_SetPointerToObject(
#ifdef MEDIA009_S10EA_S10EB_S11E_S12E_S12G_S13FA_S13FB_S20E_S21E_G14ED_G20E_G21E_A20ED_A20E_A20F_A20G_A21E_A22E_A22G
P0093_puc_Bitmap_Object)
#endif
#ifdef MEDIA012_S10EA_S10EB_S11E_S12E_S12G_S13FA_S13FB_S20E_S21E_G14ED_G20E_G21E_A20ED_A20E_A20F_A20G_A21E_A22E_A22G_P20JA_P20JB_I34E_I34M_P31J
REGISTER unsigned char* P0093_puc_Bitmap_Object FINAL_SEPARATOR
#endif
#ifdef MEDIA548_F20E_F20J_X30J_A36M_A31E_A31M_A33M_A35E_A35M_F31E_F31J_X31J
unsigned char* P0093_puc_Bitmap_Object FINAL_SEPARATOR
#endif
{
#ifdef MEDIA413_A20ED_A20E_A20F_A20G_A21E_A22E_A22G
        REGISTER int16_t L1576_i_Unreferenced;
#endif
#ifdef MEDIA351_G14ED_G20E_G21E
        unsigned char L6415_auc_Box_MousePointer[4];
#endif
        REGISTER unsigned char* L0051_puc_Bitmap;
#ifdef MEDIA577_X30J
        register long L2915_l_;
#endif


#ifdef MEDIA170_S10EA_S10EB_S11E_S12E_S12G_S13FA_S13FB_S20E_S21E_X30J_A36M_A31E_A31M_A33M_A35E_A35M_X31J
        M522_MOUSE_HidePointer();
#endif
#ifdef MEDIA413_A20ED_A20E_A20F_A20G_A21E_A22E_A22G
        G1094_B_PreventBuildPointerScreenArea = C1_TRUE;
#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
        G0600_B_UseObjectAsMousePointerBitmap = C1_TRUE;
        G0601_B_UseHandAsMousePointerBitmap = C0_FALSE;
#endif
#ifdef MEDIA137_S10EA_S10EB_S11E_S12E_S12G_S13FA_S13FB_S20E_S21E_A20ED_A20E_A20F_A20G_A21E_A22E_A22G
        G0598_B_MousePointerBitmapUpdated = C1_TRUE;
#endif
#ifdef MEDIA009_S10EA_S10EB_S11E_S12E_S12G_S13FA_S13FB_S20E_S21E_G14ED_G20E_G21E_A20ED_A20E_A20F_A20G_A21E_A22E_A22G
        G0578_B_UseByteBoxCoordinates = C1_TRUE;
#endif
#ifdef MEDIA351_G14ED_G20E_G21E
        L0051_puc_Bitmap = G4009_puc_Bitmap_MousePointerObject[0];
        F0134_VIDEO_FillBitmap(L0051_puc_Bitmap, C12_COLOR_DARKEST_GRAY, M076_BITMAP_UNIT_COUNT(32, 18));
        F0129_VIDEO_BlitShrinkWithPaletteChanges(P0093_puc_Bitmap_Object, G0618_puc_Bitmap_MousePointerHiddenScreenArea, 16, 16, 16, 16, G0045_auc_Graphic562_PaletteChanges_MousePointerIconShadow);
        L6415_auc_Box_MousePointer[0] = L6415_auc_Box_MousePointer[2] = 2;
        L6415_auc_Box_MousePointer[1] = L6415_auc_Box_MousePointer[3] = 17;
        F0132_VIDEO_Blit(G0618_puc_Bitmap_MousePointerHiddenScreenArea, L0051_puc_Bitmap, L6415_auc_Box_MousePointer, 0, 0, C008_BYTE_WIDTH, C016_BYTE_WIDTH, CM1_COLOR_NO_TRANSPARENCY);
        F0007_MAIN_CopyBytes(L0051_puc_Bitmap, G4009_puc_Bitmap_MousePointerObject[1], M075_BITMAP_BYTE_COUNT(32, 18));
        F0129_VIDEO_BlitShrinkWithPaletteChanges(P0093_puc_Bitmap_Object, G0618_puc_Bitmap_MousePointerHiddenScreenArea, 16, 16, 16, 16, G0044_auc_Graphic562_PaletteChanges_MousePointerIcon);
        L6415_auc_Box_MousePointer[0] = L6415_auc_Box_MousePointer[2] = 0;
        L6415_auc_Box_MousePointer[1] = L6415_auc_Box_MousePointer[3] = 15;
        F0132_VIDEO_Blit(G0618_puc_Bitmap_MousePointerHiddenScreenArea, L0051_puc_Bitmap, L6415_auc_Box_MousePointer, 0, 0, C008_BYTE_WIDTH, C016_BYTE_WIDTH, C12_COLOR_DARKEST_GRAY);
        F0129_VIDEO_BlitShrinkWithPaletteChanges(L0051_puc_Bitmap, L0051_puc_Bitmap + M075_BITMAP_BYTE_COUNT(32, 18), 32, 18, 32, 18, G4010_auc_PaletteChanges_CursorMask);
        F0129_VIDEO_BlitShrinkWithPaletteChanges(L0051_puc_Bitmap, L0051_puc_Bitmap, 32, 18, 32, 18, G4011_auc_PaletteChanges);
        F2167_BuildAppleIIGSMouseCursor(18, 8, L0051_puc_Bitmap, L0051_puc_Bitmap + M075_BITMAP_BYTE_COUNT(32, 18), 9, 9, G4012_pc_);
        L6415_auc_Box_MousePointer[0] = L6415_auc_Box_MousePointer[2] = 0;
        L6415_auc_Box_MousePointer[1] = L6415_auc_Box_MousePointer[3] = 15;
        F0132_VIDEO_Blit(P0093_puc_Bitmap_Object, G4009_puc_Bitmap_MousePointerObject[1], L6415_auc_Box_MousePointer, 0, 0, C008_BYTE_WIDTH, C016_BYTE_WIDTH, C12_COLOR_DARKEST_GRAY);
        L0051_puc_Bitmap = G4009_puc_Bitmap_MousePointerObject[1];
        F0129_VIDEO_BlitShrinkWithPaletteChanges(L0051_puc_Bitmap, L0051_puc_Bitmap + M075_BITMAP_BYTE_COUNT(32, 18), 32, 18, 32, 18, G4013_auc_PaletteChanges_CursorMask);
        F0129_VIDEO_BlitShrinkWithPaletteChanges(L0051_puc_Bitmap, L0051_puc_Bitmap, 32, 18, 32, 18, G4011_auc_PaletteChanges);
        F2167_BuildAppleIIGSMouseCursor(18, 8, L0051_puc_Bitmap, L0051_puc_Bitmap + M075_BITMAP_BYTE_COUNT(32, 18), 9, 9, G4014_pc_);
        M522_MOUSE_HidePointer();
        G0600_B_UseObjectAsMousePointerBitmap = C1_TRUE;
        G0601_B_UseHandAsMousePointerBitmap = C0_FALSE;
        G0598_B_MousePointerBitmapUpdated = C1_TRUE;
        while (G0598_B_MousePointerBitmapUpdated);
        M523_MOUSE_ShowPointer();
#endif
#ifdef MEDIA007_S10EA_S10EB_S11E_S12E_S12G_S13FA_S13FB_S20E_S21E
        L0051_puc_Bitmap = G0616_puc_Bitmap_MousePointerModifiedColorsObject;
        F0134_VIDEO_FillBitmap(L0051_puc_Bitmap, C12_COLOR_DARKEST_GRAY, M076_BITMAP_UNIT_COUNT(32, 18));
        F0129_VIDEO_BlitShrinkWithPaletteChanges(P0093_puc_Bitmap_Object, G0618_puc_Bitmap_MousePointerHiddenScreenArea, 16, 16, 16, 16, G0045_auc_Graphic562_PaletteChanges_MousePointerIconShadow);
        F0132_VIDEO_Blit(G0618_puc_Bitmap_MousePointerHiddenScreenArea, L0051_puc_Bitmap, G0619_auc_Box_MousePointer_ObjectShadow, 0, 0, C008_BYTE_WIDTH, C016_BYTE_WIDTH, CM1_COLOR_NO_TRANSPARENCY);
        F0007_MAIN_CopyBytes(L0051_puc_Bitmap, G0615_puc_Bitmap_MousePointerOriginalColorsObject, M075_BITMAP_BYTE_COUNT(32, 18));
        F0129_VIDEO_BlitShrinkWithPaletteChanges(P0093_puc_Bitmap_Object, G0618_puc_Bitmap_MousePointerHiddenScreenArea, 16, 16, 16, 16, G0044_auc_Graphic562_PaletteChanges_MousePointerIcon);
        F0132_VIDEO_Blit(G0618_puc_Bitmap_MousePointerHiddenScreenArea, L0051_puc_Bitmap, G0620_auc_Box_MousePointer_Object, 0, 0, C008_BYTE_WIDTH, C016_BYTE_WIDTH, C12_COLOR_DARKEST_GRAY);
        F0132_VIDEO_Blit(P0093_puc_Bitmap_Object, G0615_puc_Bitmap_MousePointerOriginalColorsObject, G0620_auc_Box_MousePointer_Object, 0, 0, C008_BYTE_WIDTH, C016_BYTE_WIDTH, C12_COLOR_DARKEST_GRAY);
#endif
#ifdef MEDIA413_A20ED_A20E_A20F_A20G_A21E_A22E_A22G
        L0051_puc_Bitmap = G0615_puc_Bitmap_MousePointerOriginalColorsObject;
        F0008_MAIN_ClearBytes(L0051_puc_Bitmap, M075_BITMAP_BYTE_COUNT(32, 18));
        F0129_VIDEO_BlitShrinkWithPaletteChanges(P0093_puc_Bitmap_Object, G1142_puc_Bitmap_MousePointerTemporaryBuffer, 16, 16, 16, 16, G1025_auc_PaletteChanges_MousePointerObjectIconShadow);
        F0132_VIDEO_Blit(G1142_puc_Bitmap_MousePointerTemporaryBuffer, L0051_puc_Bitmap, G0619_auc_Box_MousePointer_ObjectShadow, 0, 0, C008_BYTE_WIDTH, C016_BYTE_WIDTH, CM1_COLOR_NO_TRANSPARENCY, 16, 18);
        F0129_VIDEO_BlitShrinkWithPaletteChanges(P0093_puc_Bitmap_Object, G1142_puc_Bitmap_MousePointerTemporaryBuffer, 16, 16, 16, 16, G0044_auc_Graphic562_PaletteChanges_MousePointerIcon);
        F0132_VIDEO_Blit(G1142_puc_Bitmap_MousePointerTemporaryBuffer, L0051_puc_Bitmap, G0620_auc_Box_MousePointer_Object, 0, 0, C008_BYTE_WIDTH, C016_BYTE_WIDTH, C00_COLOR_BLACK, 16, 18);
        WaitBlit();
        G1094_B_PreventBuildPointerScreenArea = C0_FALSE;
        F0073_MOUSE_BuildPointerScreenArea(G0589_i_MousePointerHotspotX, G0590_i_MousePointerHotspotY);
#endif
#ifdef MEDIA463_P20JA_P20JB_I34E_I34M_P31J
        L0051_puc_Bitmap = M533_F0468_MEMORY_Allocate((long)M075_BITMAP_BYTE_COUNT(18, 18), C0_ALLOCATION_TEMPORARY_ON_TOP_OF_HEAP, MASK0x0008_MEMREQ);
        F0702_BuildObjectMousePointerIcon(P0093_puc_Bitmap_Object, L0051_puc_Bitmap);
        (*(G2161_IODriver->IODRV_09_RegisterMousePointerBitmap))(C2_POINTER_OBJECT_ICON, L0051_puc_Bitmap, 8, 8);
        F0700_TriggerImmediateMouseEvent();
        F0469_MEMORY_FreeAtHeapTop((long)M075_BITMAP_BYTE_COUNT(18, 18));
#endif
#ifdef MEDIA551_F20E_F20J_F31E_F31J
        L0051_puc_Bitmap = F0468_MEMORY_Allocate((long)M075_BITMAP_BYTE_COUNT(32, 18), C0_ALLOCATION_TEMPORARY_ON_TOP_OF_HEAP);
        F0702_BuildObjectMousePointerIcon(P0093_puc_Bitmap_Object, M772_CAST_PC(L0051_puc_Bitmap));
        F2236_IODRV_9_SetMousePointerBitmap(C2_POINTER_OBJECT_ICON, L0051_puc_Bitmap, 32, 8, 8);
        F2237_IODRV_10_SetMousePointer(C2_POINTER_OBJECT_ICON);
        F0469_MEMORY_FreeAtHeapTop((long)M075_BITMAP_BYTE_COUNT(32, 18));
        F0700_TriggerImmediateMouseEvent();
#endif
#ifdef MEDIA577_X30J
        L2915_l_ = M103_BITMAP_BYTE_COUNT(G2075_ObjectIconWidth + G2185_Unreferenced, G2076_ObjectIconHeight + G2185_Unreferenced);
        L0051_puc_Bitmap = F0468_MEMORY_Allocate(L2915_l_, MASK0x8000_ALLOCATE_BITMAP | C0_ALLOCATION_TEMPORARY_ON_TOP_OF_HEAP);
#endif
#ifdef MEDIA749_A36M_A31E_A31M_A33M_A35E_A35M_X31J
        L0051_puc_Bitmap = F0606_AllocateMemForGraphic(G2075_ObjectIconWidth + G2185_Unreferenced, G2076_ObjectIconHeight + G2185_Unreferenced, C0_ALLOCATION_TEMPORARY_ON_TOP_OF_HEAP);
#endif
#ifdef MEDIA613_X30J_A36M_A31E_A31M_A33M_A35E_A35M_X31J
        F1037_Mouse2(P0093_puc_Bitmap_Object, L0051_puc_Bitmap, C12_COLOR_DARKEST_GRAY);
        F1036_Mouse1(L0051_puc_Bitmap, C2_POINTER_OBJECT_ICON);
        F0700_TriggerImmediateMouseEvent();
#endif
#ifdef MEDIA577_X30J
        F0469_MEMORY_FreeAtHeapTop(L2915_l_ + 4);
#endif
#ifdef MEDIA749_A36M_A31E_A31M_A33M_A35E_A35M_X31J
        F0607_FreeMemForGraphic(L0051_puc_Bitmap);
#endif
#ifdef MEDIA170_S10EA_S10EB_S11E_S12E_S12G_S13FA_S13FB_S20E_S21E_X30J_A36M_A31E_A31M_A33M_A35E_A35M_X31J
        M523_MOUSE_ShowPointer();
#endif
}

#ifdef MEDIA413_A20ED_A20E_A20F_A20G_A21E_A22E_A22G
void F0547_MOUSE_SetPointerSprites(
P0968_pui_)
REGISTER UWORD* P0968_pui_ FINAL_SEPARATOR
{
        REGISTER UWORD* L1744_pui_;
        REGISTER UWORD* L1745_pui_;
        REGISTER unsigned long L1746_ul_;
        REGISTER unsigned long L1747_ul_;


        G1094_B_PreventBuildPointerScreenArea = C1_TRUE;
        for (L1747_ul_ = 0; L1747_ul_ < 4; L1747_ul_++) {
                L1744_pui_ = &G1097_aps_MousePointerSpriteImages[L1747_ul_ >> 1]->data[0][L1747_ul_ & 1];
                L1745_pui_ = &G1097_aps_MousePointerSpriteImages[(L1747_ul_ >> 1) + 2]->data[0][L1747_ul_ & 1];
                for (L1746_ul_ = 0; L1746_ul_ < 18; L1746_ul_++) {
                        *L1744_pui_ = *P0968_pui_++;
                        *L1745_pui_ = *P0968_pui_++;
                        L1744_pui_ += 2;
                        L1745_pui_ += 2;
                }
        }
        for (L1746_ul_ = 0; L1746_ul_ < 4; L1746_ul_++) {
                ChangeSprite(&G0734_ps_AmigaData->ViewPort, &G1096_aps_MousePointerSprites[L1746_ul_], G1097_aps_MousePointerSpriteImages[L1746_ul_]);
        }
        G1094_B_PreventBuildPointerScreenArea = C0_FALSE;
}
#endif

#ifdef MEDIA099_S10EA_S10EB_S11E_S12E_S12G_S13FA_S13FB_S20E_S21E_G14ED_G20E_G21E_F20E_F20J_X30J_P20JA_P20JB_I34E_I34M_A36M_A31E_A31M_A33M_A35E_A35M_F31E_F31J_X31J_P31J
#include "MOUSESET.C"
#endif

#ifdef MEDIA413_A20ED_A20E_A20F_A20G_A21E_A22E_A22G
void F0073_MOUSE_BuildPointerScreenArea(
P0923_i_MousePointerHotspotX, P0924_i_MousePointerHotspotY)
REGISTER int16_t P0923_i_MousePointerHotspotX SEPARATOR
REGISTER int16_t P0924_i_MousePointerHotspotY FINAL_SEPARATOR
{
        REGISTER unsigned int16_t L1577_i_ChampionIndex;
        REGISTER int16_t L1578_i_XOverChampionStatusBox;


        if (G1094_B_PreventBuildPointerScreenArea) {
                return;
        }
        G1094_B_PreventBuildPointerScreenArea = C1_TRUE;
        G0589_i_MousePointerHotspotX = P0923_i_MousePointerHotspotX;
        G0590_i_MousePointerHotspotY = P0924_i_MousePointerHotspotY;
        if (G0599_ui_UseChampionIconOrdinalAsMousePointerBitmap) {
                if ((P0924_i_MousePointerHotspotY > 28) || (P0923_i_MousePointerHotspotX < 274)) {
                        G1098_i_MousePointerType = C4_POINTER_TYPE_AUTOSELECT;
                        F0071_MOUSE_DropChampionIcon();
                } else {
                        G1098_i_MousePointerType = C2_POINTER_TYPE_CHAMPION_ICON;
                }
        } else {
                if (P0924_i_MousePointerHotspotY >= 169) {
                        G1098_i_MousePointerType = C0_POINTER_TYPE_ARROW;
                } else {
                        if (P0923_i_MousePointerHotspotX >= 274) {
                                G1098_i_MousePointerType = C0_POINTER_TYPE_ARROW;
                        } else {
                                if (P0924_i_MousePointerHotspotY <= 28) {
                                        L1577_i_ChampionIndex = P0923_i_MousePointerHotspotX / 69;
                                        L1578_i_XOverChampionStatusBox = P0923_i_MousePointerHotspotX % 69;
                                        if (L1577_i_ChampionIndex >= G0305_ui_PartyChampionCount) {
                                                G1098_i_MousePointerType = C4_POINTER_TYPE_AUTOSELECT;
                                        } else {
                                                if (L1578_i_XOverChampionStatusBox > 42) {
                                                        G1098_i_MousePointerType = C4_POINTER_TYPE_AUTOSELECT;
                                                } else {
                                                        L1577_i_ChampionIndex++;
                                                        if (L1577_i_ChampionIndex == G0423_i_InventoryChampionOrdinal) {
                                                                G1098_i_MousePointerType = C0_POINTER_TYPE_ARROW;
                                                        } else {
                                                                if (P0924_i_MousePointerHotspotY <= 6) {
                                                                        G1098_i_MousePointerType = C0_POINTER_TYPE_ARROW;
                                                                } else {
                                                                        G1098_i_MousePointerType = C4_POINTER_TYPE_AUTOSELECT;
                                                                }
                                                        }
                                                }
                                        }
                                } else {
                                        if (P0923_i_MousePointerHotspotX >= 224) {
                                                G1098_i_MousePointerType = C0_POINTER_TYPE_ARROW;
                                        } else {
                                                G1098_i_MousePointerType = C4_POINTER_TYPE_AUTOSELECT;
                                        }
                                }
                        }
                }
        }
        if (G1098_i_MousePointerType == C4_POINTER_TYPE_AUTOSELECT) {
                G1098_i_MousePointerType = (G0600_B_UseObjectAsMousePointerBitmap) ? C1_POINTER_TYPE_OBJECT_ICON : (G0601_B_UseHandAsMousePointerBitmap) ? C3_POINTER_TYPE_HAND : C0_POINTER_TYPE_ARROW;
        }
        if (G0598_B_MousePointerBitmapUpdated || (G1098_i_MousePointerType != G1099_i_PreviousMousePointerType)) {
                G0598_B_MousePointerBitmapUpdated = C0_FALSE;
                switch(G1098_i_MousePointerType) {
                        case C0_POINTER_TYPE_ARROW:
                                G0605_i_MousePointerBitmapHotspotX = 0;
                                G0606_i_MousePointerBitmapHotspotY = 0;
                                F0547_MOUSE_SetPointerSprites(G0042_auc_Graphic562_Bitmap_ArrowPointer);
                                break;
                        case C1_POINTER_TYPE_OBJECT_ICON:
                                G0605_i_MousePointerBitmapHotspotX = 8;
                                G0606_i_MousePointerBitmapHotspotY = 8;
                                F0547_MOUSE_SetPointerSprites(G0615_puc_Bitmap_MousePointerOriginalColorsObject);
                                break;
                        case C2_POINTER_TYPE_CHAMPION_ICON:
                                G0605_i_MousePointerBitmapHotspotX = 9;
                                G0606_i_MousePointerBitmapHotspotY = 7;
                                F0547_MOUSE_SetPointerSprites(G0613_puc_Bitmap_MousePointerOriginalColorsChampionIcon);
                                break;
                        case C3_POINTER_TYPE_HAND:
                                G0605_i_MousePointerBitmapHotspotX = 0;
                                G0606_i_MousePointerBitmapHotspotY = 0;
                                F0547_MOUSE_SetPointerSprites(G0043_auc_Graphic562_Bitmap_HandPointer);
                                break;
                }
        }
        G1099_i_PreviousMousePointerType = G1098_i_MousePointerType;
        P0923_i_MousePointerHotspotX -= (G0605_i_MousePointerBitmapHotspotX + 1);
        P0924_i_MousePointerHotspotY -= G0606_i_MousePointerBitmapHotspotY;
        MoveSprite(&G0734_ps_AmigaData->ViewPort, &G1096_aps_MousePointerSprites[0], (long)P0923_i_MousePointerHotspotX, (long)P0924_i_MousePointerHotspotY);
        MoveSprite(&G0734_ps_AmigaData->ViewPort, &G1096_aps_MousePointerSprites[1], (long)P0923_i_MousePointerHotspotX, (long)P0924_i_MousePointerHotspotY);
        MoveSprite(&G0734_ps_AmigaData->ViewPort, &G1096_aps_MousePointerSprites[2], (long)(P0923_i_MousePointerHotspotX + 16), (long)P0924_i_MousePointerHotspotY);
        MoveSprite(&G0734_ps_AmigaData->ViewPort, &G1096_aps_MousePointerSprites[3], (long)(P0923_i_MousePointerHotspotX + 16), (long)P0924_i_MousePointerHotspotY);
        G1094_B_PreventBuildPointerScreenArea = C0_FALSE;
}
#endif

void F0070_MOUSE_ProcessCommands125To128_ClickOnChampionIcon(
#ifdef MEDIA009_S10EA_S10EB_S11E_S12E_S12G_S13FA_S13FB_S20E_S21E_G14ED_G20E_G21E_A20ED_A20E_A20F_A20G_A21E_A22E_A22G
P0094_ui_ChampionIconIndex)
#endif
register unsigned int16_t P0094_ui_ChampionIconIndex FINAL_SEPARATOR /* ANOMALY_FMT: register keyword required */
{
#ifdef MEDIA613_X30J_A36M_A31E_A31M_A33M_A35E_A35M_X31J
        register int16_t L0053_i_ChampionIndex;
#endif
#ifdef MEDIA070_S10EA_S10EB_S11E_S12E_S12G_S13FA_S13FB_S20E_S21E_G14ED_G20E_G21E_A20ED_A20E_A20F_A20G_A21E_A22E_A22G_X30J_P20JA_P20JB_I34E_I34M_A36M_A31E_A31M_A33M_A35E_A35M_X31J_P31J
        REGISTER unsigned int16_t L0052_ui_ChampionIconIndex;
#endif
#ifdef MEDIA551_F20E_F20J_F31E_F31J
        register unsigned int16_t L0052_ui_ChampionIconIndex;/* ANOMALY_FMT: register keyword required */
#endif
#ifdef MEDIA012_S10EA_S10EB_S11E_S12E_S12G_S13FA_S13FB_S20E_S21E_G14ED_G20E_G21E_A20ED_A20E_A20F_A20G_A21E_A22E_A22G_P20JA_P20JB_I34E_I34M_P31J
        REGISTER int16_t L0053_i_ChampionIndex;
#endif
#ifdef MEDIA551_F20E_F20J_F31E_F31J
        register int16_t L0053_i_ChampionIndex;/* ANOMALY_FMT: register keyword required */
#endif
        REGISTER int16_t L0054_i_ChampionIndex;
#ifdef MEDIA009_S10EA_S10EB_S11E_S12E_S12G_S13FA_S13FB_S20E_S21E_G14ED_G20E_G21E_A20ED_A20E_A20F_A20G_A21E_A22E_A22G
        REGISTER int16_t* L0055_pi_ChampionIconBox;
#endif
#ifdef MEDIA489_F20E_F20J_P20JA_P20JB
        unsigned char* L2916_puc_ChampionIconsBitmap;
#endif
        REGISTER unsigned char* L0056_puc_Bitmap;
#ifdef MEDIA529_F20E_F20J_X30J_P20JA_P20JB_I34E_I34M_A36M_A31E_A31M_A33M_A35E_A35M_F31E_F31J_X31J_P31J
        REGISTER unsigned char* L2917_puc_Bitmap2;
#endif
#ifdef MEDIA577_X30J
        register long L2918_l_;
        long L2919_l_;
        char L2920_Unreferenced[8];
#endif


#ifdef MEDIA413_A20ED_A20E_A20F_A20G_A21E_A22E_A22G
        G1094_B_PreventBuildPointerScreenArea = C1_TRUE;
#endif
        if (!G0599_ui_UseChampionIconOrdinalAsMousePointerBitmap) {
#ifdef MEDIA016_S10EA_S10EB_S11E_S12E_S12G_S13FA_S13FB_S20E_S21E_G14ED_G20E_G21E_A20ED_A20E_A20F_A20G_A21E_A22E_A22G_F20E_F20J_P20JA_P20JB_I34E_I34M_F31E_F31J_P31J
                if (F0285_CHAMPION_GetIndexInCell(M021_NORMALIZE(P0094_ui_ChampionIconIndex + G0308_i_PartyDirection)) == CM1_CHAMPION_NONE) {
#endif
#ifdef MEDIA613_X30J_A36M_A31E_A31M_A33M_A35E_A35M_X31J
                if ((L0053_i_ChampionIndex = F0285_CHAMPION_GetIndexInCell(M021_NORMALIZE(P0094_ui_ChampionIconIndex + G0308_i_PartyDirection))) == CM1_CHAMPION_NONE) {
#endif
#ifdef MEDIA413_A20ED_A20E_A20F_A20G_A21E_A22E_A22G
                        G1094_B_PreventBuildPointerScreenArea = C0_FALSE;
#endif
                        return;
                }
#ifdef MEDIA137_S10EA_S10EB_S11E_S12E_S12G_S13FA_S13FB_S20E_S21E_A20ED_A20E_A20F_A20G_A21E_A22E_A22G
                G0598_B_MousePointerBitmapUpdated = C1_TRUE;
#endif
#ifdef MEDIA008_S10EA_S10EB_S11E_S12E_S12G_S13FA_S13FB_S20E_S21E_G14ED_G20E_G21E
                F0077_MOUSE_EnableScreenUpdate_CPSE();
#endif
#ifdef MEDIA413_A20ED_A20E_A20F_A20G_A21E_A22E_A22G
                G0599_ui_UseChampionIconOrdinalAsMousePointerBitmap = C1_TRUE;
#endif
#ifdef MEDIA009_S10EA_S10EB_S11E_S12E_S12G_S13FA_S13FB_S20E_S21E_G14ED_G20E_G21E_A20ED_A20E_A20F_A20G_A21E_A22E_A22G
                G0578_B_UseByteBoxCoordinates = C0_FALSE;
#endif
#ifdef MEDIA007_S10EA_S10EB_S11E_S12E_S12G_S13FA_S13FB_S20E_S21E
                L0056_puc_Bitmap = G0614_puc_Bitmap_MousePointerModifiedColorsChampionIcon;
                F0134_VIDEO_FillBitmap(L0056_puc_Bitmap, C12_COLOR_DARKEST_GRAY, M076_BITMAP_UNIT_COUNT(32, 16));
#endif
#ifdef MEDIA351_G14ED_G20E_G21E
                L0056_puc_Bitmap = G4015_puc_Bitmap_MousePointerChampion[0];
                F0134_VIDEO_FillBitmap(L0056_puc_Bitmap, C12_COLOR_DARKEST_GRAY, M076_BITMAP_UNIT_COUNT(32, 18));
                F0134_VIDEO_FillBitmap(G4016_puc_, C12_COLOR_DARKEST_GRAY, M075_BITMAP_BYTE_COUNT(32, 18));
#endif
#ifdef MEDIA413_A20ED_A20E_A20F_A20G_A21E_A22E_A22G
                L0056_puc_Bitmap = G1142_puc_Bitmap_MousePointerTemporaryBuffer;
                F0008_MAIN_ClearBytes(L0056_puc_Bitmap, M075_BITMAP_BYTE_COUNT(32, 18));
#endif
#ifdef MEDIA009_S10EA_S10EB_S11E_S12E_S12G_S13FA_S13FB_S20E_S21E_G14ED_G20E_G21E_A20ED_A20E_A20F_A20G_A21E_A22E_A22G
                L0055_pi_ChampionIconBox = &G0054_ai_Graphic562_Box_ChampionIcons[P0094_ui_ChampionIconIndex << 2];
#endif
#ifdef MEDIA007_S10EA_S10EB_S11E_S12E_S12G_S13FA_S13FB_S20E_S21E
                F0132_VIDEO_Blit(G0348_Bitmap_Screen, L0056_puc_Bitmap, G0621_ai_Box_MousePointer_ChampionIconShadow, *L0055_pi_ChampionIconBox, *(L0055_pi_ChampionIconBox + 2), C160_BYTE_WIDTH_SCREEN, C016_BYTE_WIDTH, C00_COLOR_BLACK);
                F0129_VIDEO_BlitShrinkWithPaletteChanges(L0056_puc_Bitmap, L0056_puc_Bitmap, 32, 16, 32, 16, G0045_auc_Graphic562_PaletteChanges_MousePointerIconShadow);
                F0007_MAIN_CopyBytes(L0056_puc_Bitmap, G0613_puc_Bitmap_MousePointerOriginalColorsChampionIcon, M075_BITMAP_BYTE_COUNT(32, 16));
                F0132_VIDEO_Blit(G0348_Bitmap_Screen, G0613_puc_Bitmap_MousePointerOriginalColorsChampionIcon, G0622_ai_Box_MousePointer_ChampionIcon, *L0055_pi_ChampionIconBox, *(L0055_pi_ChampionIconBox + 2), C160_BYTE_WIDTH_SCREEN, C016_BYTE_WIDTH, C00_COLOR_BLACK);
                L0056_puc_Bitmap = G0618_puc_Bitmap_MousePointerHiddenScreenArea;
                F0134_VIDEO_FillBitmap(L0056_puc_Bitmap, C12_COLOR_DARKEST_GRAY, M076_BITMAP_UNIT_COUNT(32, 16));
                F0132_VIDEO_Blit(G0348_Bitmap_Screen, L0056_puc_Bitmap, G0622_ai_Box_MousePointer_ChampionIcon, *L0055_pi_ChampionIconBox, *(L0055_pi_ChampionIconBox + 2), C160_BYTE_WIDTH_SCREEN, C016_BYTE_WIDTH, C00_COLOR_BLACK);
                F0129_VIDEO_BlitShrinkWithPaletteChanges(L0056_puc_Bitmap, L0056_puc_Bitmap, 32, 14, 32, 14, G0044_auc_Graphic562_PaletteChanges_MousePointerIcon);
                F0132_VIDEO_Blit(L0056_puc_Bitmap, G0614_puc_Bitmap_MousePointerModifiedColorsChampionIcon, G0622_ai_Box_MousePointer_ChampionIcon, 0, 0, C016_BYTE_WIDTH, C016_BYTE_WIDTH, C12_COLOR_DARKEST_GRAY);
#endif
#ifdef MEDIA351_G14ED_G20E_G21E
                F0132_VIDEO_Blit(G0348_Bitmap_Screen, G4016_puc_, G0622_ai_Box_MousePointer_ChampionIcon, *L0055_pi_ChampionIconBox, *(L0055_pi_ChampionIconBox + 2), C160_BYTE_WIDTH_SCREEN, C016_BYTE_WIDTH, C00_COLOR_BLACK);
                F0129_VIDEO_BlitShrinkWithPaletteChanges(G4016_puc_, G0618_, 32, 16, 32, 16, G0045_auc_Graphic562_PaletteChanges_MousePointerIconShadow);
                F0132_VIDEO_Blit(G0618_, L0056_puc_Bitmap, G0621_ai_Box_MousePointer_ChampionIconShadow, 0, 0, C016_BYTE_WIDTH, C016_BYTE_WIDTH, CM1_COLOR_NO_TRANSPARENCY);
                F0007_MAIN_CopyBytes(L0056_puc_Bitmap, G4015_puc_Bitmap_MousePointerChampion[1], M075_BITMAP_BYTE_COUNT(32, 18));
                F0132_VIDEO_Blit(G4016_puc_, G4015_puc_Bitmap_MousePointerChampion[1], G0622_ai_Box_MousePointer_ChampionIcon, 0, 0, C016_BYTE_WIDTH, C016_BYTE_WIDTH, C12_COLOR_DARKEST_GRAY);
                L0056_puc_Bitmap = G4015_puc_Bitmap_MousePointerChampion[1];
                F0129_VIDEO_BlitShrinkWithPaletteChanges(L0056_puc_Bitmap, L0056_puc_Bitmap + M075_BITMAP_BYTE_COUNT(32, 18), 32, 16, 32, 16, G4013_auc_PaletteChanges_CursorMask);
                F0129_VIDEO_BlitShrinkWithPaletteChanges(L0056_puc_Bitmap, L0056_puc_Bitmap, 32, 16, 32, 16, G4011_auc_PaletteChanges);
                F2167_BuildAppleIIGSMouseCursor(16, 8, L0056_puc_Bitmap, L0056_puc_Bitmap + M075_BITMAP_BYTE_COUNT(32, 18), 9, 7, G4017_puc_);
#endif
#ifdef MEDIA413_A20ED_A20E_A20F_A20G_A21E_A22E_A22G
                F0132_VIDEO_Blit(G0348_Bitmap_Screen, L0056_puc_Bitmap, G0621_ai_Box_MousePointer_ChampionIconShadow, *L0055_pi_ChampionIconBox, *(L0055_pi_ChampionIconBox + 2), C160_BYTE_WIDTH_SCREEN, C016_BYTE_WIDTH, C00_COLOR_BLACK, 200, 18);
                F0129_VIDEO_BlitShrinkWithPaletteChanges(L0056_puc_Bitmap, G0613_puc_Bitmap_MousePointerOriginalColorsChampionIcon, 32, 18, 32, 18, G0045_auc_Graphic562_PaletteChanges_MousePointerIconShadow);
                F0132_VIDEO_Blit(G0348_Bitmap_Screen, G0613_puc_Bitmap_MousePointerOriginalColorsChampionIcon, G0622_ai_Box_MousePointer_ChampionIcon, *L0055_pi_ChampionIconBox, *(L0055_pi_ChampionIconBox + 2), C160_BYTE_WIDTH_SCREEN, C016_BYTE_WIDTH, C00_COLOR_BLACK, 200, 18);
#endif
#ifdef MEDIA009_S10EA_S10EB_S11E_S12E_S12G_S13FA_S13FB_S20E_S21E_G14ED_G20E_G21E_A20ED_A20E_A20F_A20G_A21E_A22E_A22G
                M524_FillScreenBox(L0055_pi_ChampionIconBox, C00_COLOR_BLACK);
#endif
#ifdef MEDIA007_S10EA_S10EB_S11E_S12E_S12G_S13FA_S13FB_S20E_S21E
                F0078_MOUSE_DisableScreenUpdate();
#endif
#ifdef MEDIA413_A20ED_A20E_A20F_A20G_A21E_A22E_A22G
                WaitBlit();
#endif
#ifdef MEDIA496_F20E_F20J_P20JA_P20JB_I34E_I34M_F31E_F31J_P31J
                F0077_MOUSE_EnableScreenUpdate_CPSE(); /* ANOMALY_ASSEMBLY_COMPILATION_DIFFERENCE nop */
#endif
#ifdef MEDIA489_F20E_F20J_P20JA_P20JB
                L2916_puc_ChampionIconsBitmap = F0489_MEMORY_GetNativeBitmapOrGraphic(C028_GRAPHIC_CHAMPION_ICONS);
#endif
#ifdef MEDIA458_P20JA_P20JB
                L0056_puc_Bitmap = F0468_MEMORY_Allocate((long)M075_BITMAP_BYTE_COUNT(18, 18), C0_ALLOCATION_TEMPORARY_ON_TOP_OF_HEAP);
                L2917_puc_Bitmap2 = F0468_MEMORY_Allocate((long)M075_BITMAP_BYTE_COUNT(18, 18), C0_ALLOCATION_TEMPORARY_ON_TOP_OF_HEAP);
                F0135_VIDEO_FillBox(L0056_puc_Bitmap, G2056_ai_XYZ, C00_COLOR_BLACK, 18);
                F0135_VIDEO_FillBox(L0056_puc_Bitmap, G2055_ai_XYZ_ChampionIcon, G2218_[F0285_CHAMPION_GetIndexInCell(M021_NORMALIZE(P0094_ui_ChampionIconIndex + G0308_i_PartyDirection))], 18);
                F0132_VIDEO_Blit(L2916_puc_ChampionIconsBitmap, L0056_puc_Bitmap, G2055_ai_XYZ_ChampionIcon, 0, 0, M100_PIXEL_WIDTH(L2916_puc_ChampionIconsBitmap), 18, C12_COLOR_DARKEST_GRAY, MASK0x0000_NO_FLIP);
#endif
#ifdef MEDIA457_P20JA
                F0135_VIDEO_FillBox(L2917_puc_Bitmap2, G2056_ai_XYZ, C01_COLOR_DARK_GRAY, 18);
#endif
#ifdef MEDIA469_P20JB
                F0135_VIDEO_FillBox(L2917_puc_Bitmap2, G2056_ai_XYZ, C12_COLOR_DARKEST_GRAY, 18);
#endif
#ifdef MEDIA458_P20JA_P20JB
                F0132_VIDEO_Blit(L0056_puc_Bitmap, L2917_puc_Bitmap2, G2056_ai_XYZ, 0, 0, 18, 18, C00_COLOR_BLACK, MASK0x0000_NO_FLIP);
#endif
#ifdef MEDIA488_F20E_F20J
                L0056_puc_Bitmap = F0468_MEMORY_Allocate((long)M075_BITMAP_BYTE_COUNT(32, 18), C0_ALLOCATION_TEMPORARY_ON_TOP_OF_HEAP);
                L2917_puc_Bitmap2 = F0468_MEMORY_Allocate((long)M075_BITMAP_BYTE_COUNT(32, 18), C0_ALLOCATION_TEMPORARY_ON_TOP_OF_HEAP);
                F0135_VIDEO_FillBox(L0056_puc_Bitmap, G2056_ai_XYZ, C00_COLOR_BLACK, 32);
                F0135_VIDEO_FillBox(L0056_puc_Bitmap, G2055_ai_XYZ_ChampionIcon, G2218_[F0285_CHAMPION_GetIndexInCell(M021_NORMALIZE(P0094_ui_ChampionIconIndex + G0308_i_PartyDirection))], 32);
                F0132_VIDEO_Blit(L2916_puc_ChampionIconsBitmap, L0056_puc_Bitmap, G2055_ai_XYZ_ChampionIcon, 0, 0, M100_PIXEL_WIDTH(L2916_puc_ChampionIconsBitmap), 32, C12_COLOR_DARKEST_GRAY);
                F0135_VIDEO_FillBox(L2917_puc_Bitmap2, G2056_ai_XYZ, C01_COLOR_DARK_GRAY, 32);
                F0132_VIDEO_Blit(L0056_puc_Bitmap, L2917_puc_Bitmap2, G2056_ai_XYZ, 0, 0, 32, 32, C00_COLOR_BLACK);
#endif
#ifdef MEDIA577_X30J
                L0056_puc_Bitmap = F0468_MEMORY_Allocate(L2918_l_ = (long)M103_BITMAP_BYTE_COUNT(G2080_C19_ChampionIconWidth, G2081_C14_ChampionIconHeight), MASK0x8000_ALLOCATE_BITMAP | C0_ALLOCATION_TEMPORARY_ON_TOP_OF_HEAP);
                L2917_puc_Bitmap2 = F0468_MEMORY_Allocate(L2919_l_ = (long)M103_BITMAP_BYTE_COUNT(G2080_C19_ChampionIconWidth + G2185_Unreferenced, G2081_C14_ChampionIconHeight + G2186_Unreferenced), MASK0x8000_ALLOCATE_BITMAP | C0_ALLOCATION_TEMPORARY_ON_TOP_OF_HEAP);
#endif
#ifdef MEDIA749_A36M_A31E_A31M_A33M_A35E_A35M_X31J
                L0056_puc_Bitmap = F0606_AllocateMemForGraphic(G2080_C19_ChampionIconWidth, G2081_C14_ChampionIconHeight, C0_ALLOCATION_TEMPORARY_ON_TOP_OF_HEAP);
                L2917_puc_Bitmap2 = F0606_AllocateMemForGraphic(G2080_C19_ChampionIconWidth + G2185_Unreferenced, G2081_C14_ChampionIconHeight + G2186_Unreferenced, C0_ALLOCATION_TEMPORARY_ON_TOP_OF_HEAP);
#endif
#ifdef MEDIA613_X30J_A36M_A31E_A31M_A33M_A35E_A35M_X31J
                F0622_PrepareChampionIconBitmap(L0056_puc_Bitmap, L0053_i_ChampionIndex);
                F1037_Mouse2(L0056_puc_Bitmap, L2917_puc_Bitmap2, C00_COLOR_BLACK);
                F1036_Mouse1(L2917_puc_Bitmap2, C3_POINTER_CHAMPION_ICON);
#endif
#ifdef MEDIA712_I34E_I34M_F31E_F31J_P31J
                L0056_puc_Bitmap = F0606_AllocateMemForGraphic(G2080_C19_ChampionIconWidth, G2081_C14_ChampionIconHeight, C0_ALLOCATION_TEMPORARY_ON_TOP_OF_HEAP);
                L2917_puc_Bitmap2 = F0606_AllocateMemForGraphic(18, 18, C0_ALLOCATION_TEMPORARY_ON_TOP_OF_HEAP);
                F0622_PrepareChampionIconBitmap(L0056_puc_Bitmap, F0285_CHAMPION_GetIndexInCell(M021_NORMALIZE(P0094_ui_ChampionIconIndex + G0308_i_PartyDirection)));
#endif
#ifdef MEDIA709_I34E_I34M_P31J
                F0135_VIDEO_FillBox(L2917_puc_Bitmap2, G2056_ai_XYZ, C12_COLOR_DARKEST_GRAY, 18);
                F0132_VIDEO_Blit(L0056_puc_Bitmap, L2917_puc_Bitmap2, G2055_ai_XYZ_ChampionIcon, 0, 0, G2080_C19_ChampionIconWidth, 18, C00_COLOR_BLACK, MASK0x0000_NO_FLIP);
#endif
#ifdef MEDIA670_F31E_F31J
                F0135_VIDEO_FillBox(L2917_puc_Bitmap2, G2056_ai_XYZ, C01_COLOR_DARK_GRAY, 32);
                F0132_VIDEO_Blit(L0056_puc_Bitmap, L2917_puc_Bitmap2, G2055_ai_XYZ_ChampionIcon, 0, 0, G2080_C19_ChampionIconWidth, 32, C00_COLOR_BLACK);
#endif
#ifdef MEDIA463_P20JA_P20JB_I34E_I34M_P31J
                (*(G2161_IODriver->IODRV_09_RegisterMousePointerBitmap))(C3_POINTER_CHAMPION_ICON, L2917_puc_Bitmap2, 8, 6);
                (*(G2161_IODriver->IODRV_10_SetMousePointer))(C3_POINTER_CHAMPION_ICON);
#endif
#ifdef MEDIA551_F20E_F20J_F31E_F31J
                F2236_IODRV_9_SetMousePointerBitmap(C3_POINTER_CHAMPION_ICON, L2917_puc_Bitmap2, 32, 8, 6);
                F2237_IODRV_10_SetMousePointer(C3_POINTER_CHAMPION_ICON);
#endif
#ifdef MEDIA458_P20JA_P20JB
                F0469_MEMORY_FreeAtHeapTop((long)M075_BITMAP_BYTE_COUNT(18, 18) + (long)M075_BITMAP_BYTE_COUNT(18, 18));
#endif
#ifdef MEDIA488_F20E_F20J
                F0469_MEMORY_FreeAtHeapTop((long)M075_BITMAP_BYTE_COUNT(32, 18) + (long)M075_BITMAP_BYTE_COUNT(32, 18));
#endif
#ifdef MEDIA577_X30J
                F0469_MEMORY_FreeAtHeapTop(L2919_l_ + 4);
                F0469_MEMORY_FreeAtHeapTop(L2918_l_ + 4);
#endif
#ifdef MEDIA720_I34E_I34M_A36M_A31E_A31M_A33M_A35E_A35M_F31E_F31J_X31J_P31J
                F0607_FreeMemForGraphic(L2917_puc_Bitmap2);
                F0607_FreeMemForGraphic(L0056_puc_Bitmap);
#endif
#ifdef MEDIA463_P20JA_P20JB_I34E_I34M_P31J
                (*(G2161_IODriver->IODRV_11_SetMouseBoundEvent))(G2051_ai_Zone_ChampionIconRegion, C33_MOUSE_EVENT_LEAVE_CHAMPION_ICON_REGION);
#endif
#ifdef MEDIA551_F20E_F20J_F31E_F31J
                F1040_SetMouseBoundEvent(G2051_ai_Zone_ChampionIconRegion, C33_MOUSE_EVENT_LEAVE_CHAMPION_ICON_REGION);
#endif
#ifdef MEDIA529_F20E_F20J_X30J_P20JA_P20JB_I34E_I34M_A36M_A31E_A31M_A33M_A35E_A35M_F31E_F31J_X31J_P31J
                F0733_FillZoneByIndex(C113_ZONE_CHAMPION_ICON_TOP_LEFT + P0094_ui_ChampionIconIndex, C00_COLOR_BLACK);
#endif
#ifdef MEDIA376_G14ED_G20E_G21E_F20E_F20J_X30J_P20JA_P20JB_I34E_I34M_A36M_A31E_A31M_A33M_A35E_A35M_F31E_F31J_X31J_P31J
                G2164_i_MousePointerChampionIndex = P0094_ui_ChampionIconIndex;
#endif
                G0599_ui_UseChampionIconOrdinalAsMousePointerBitmap = M000_INDEX_TO_ORDINAL(P0094_ui_ChampionIconIndex);
#ifdef MEDIA351_G14ED_G20E_G21E
                G0598_B_MousePointerBitmapUpdated = C1_TRUE;
                while (G0598_B_MousePointerBitmapUpdated);
                F0078_MOUSE_DisableScreenUpdate();
                if (G4018_B_) {
                        F2166_();
                }
#endif
#ifdef MEDIA613_X30J_A36M_A31E_A31M_A33M_A35E_A35M_X31J
                F1040_SetMouseBoundEvent(G2051_ai_Zone_ChampionIconRegion, C33_MOUSE_EVENT_LEAVE_CHAMPION_ICON_REGION);
#endif
#ifdef MEDIA496_F20E_F20J_P20JA_P20JB_I34E_I34M_F31E_F31J_P31J
                F0078_MOUSE_DisableScreenUpdate();
#endif
        } else {
#ifdef MEDIA137_S10EA_S10EB_S11E_S12E_S12G_S13FA_S13FB_S20E_S21E_A20ED_A20E_A20F_A20G_A21E_A22E_A22G
                G0598_B_MousePointerBitmapUpdated = C1_TRUE;
#endif
#ifdef MEDIA613_X30J_A36M_A31E_A31M_A33M_A35E_A35M_X31J
                G3103_i_MouseBoundButtonsStatus = 0;
#endif
                L0052_ui_ChampionIconIndex = M001_ORDINAL_TO_INDEX(G0599_ui_UseChampionIconOrdinalAsMousePointerBitmap);
                G0599_ui_UseChampionIconOrdinalAsMousePointerBitmap = M000_INDEX_TO_ORDINAL(CM1_CHAMPION_NONE);
#ifdef MEDIA351_G14ED_G20E_G21E
                G4018_B_ = C0_FALSE;
                G0598_B_MousePointerBitmapUpdated = C1_TRUE;
#endif
#ifdef MEDIA613_X30J_A36M_A31E_A31M_A33M_A35E_A35M_X31J
                G3116_ = 0;
#endif
                L0054_i_ChampionIndex = F0285_CHAMPION_GetIndexInCell(M021_NORMALIZE(L0052_ui_ChampionIconIndex + G0308_i_PartyDirection));
#ifdef MEDIA099_S10EA_S10EB_S11E_S12E_S12G_S13FA_S13FB_S20E_S21E_G14ED_G20E_G21E_F20E_F20J_X30J_P20JA_P20JB_I34E_I34M_A36M_A31E_A31M_A33M_A35E_A35M_F31E_F31J_X31J_P31J
                M516_CHAMPIONS[L0054_i_ChampionIndex].Direction = G0308_i_PartyDirection;
#endif
#ifdef MEDIA529_F20E_F20J_X30J_P20JA_P20JB_I34E_I34M_A36M_A31E_A31M_A33M_A35E_A35M_F31E_F31J_X31J_P31J
                M008_SET(M516_CHAMPIONS[L0054_i_ChampionIndex].Attributes, MASK0x0400_ICON);
#endif
                if (L0052_ui_ChampionIconIndex == P0094_ui_ChampionIconIndex) {
#ifdef MEDIA009_S10EA_S10EB_S11E_S12E_S12G_S13FA_S13FB_S20E_S21E_G14ED_G20E_G21E_A20ED_A20E_A20F_A20G_A21E_A22E_A22G
                        M008_SET(M516_CHAMPIONS[L0054_i_ChampionIndex].Attributes, MASK0x0400_ICON);
#endif
#ifdef MEDIA496_F20E_F20J_P20JA_P20JB_I34E_I34M_F31E_F31J_P31J
                        F0700_TriggerImmediateMouseEvent();
#endif
                        F0292_CHAMPION_DrawState(L0054_i_ChampionIndex);
                } else {
                        L0053_i_ChampionIndex = F0285_CHAMPION_GetIndexInCell(M021_NORMALIZE(P0094_ui_ChampionIconIndex + G0308_i_PartyDirection));
#ifdef MEDIA094_S10EA_S10EB_S11E_S12E_S12G_S13FA_S13FB_S20E_S21E_G14ED_G20E_G21E_F20E_F20J_P20JA_P20JB_I34E_I34M_F31E_F31J_P31J
                        F0077_MOUSE_EnableScreenUpdate_CPSE(); /* ANOMALY_ASSEMBLY_COMPILATION_DIFFERENCE nop */
#endif
                        if (L0053_i_ChampionIndex >= 0) {
                                M516_CHAMPIONS[L0053_i_ChampionIndex].Cell = M021_NORMALIZE(L0052_ui_ChampionIconIndex + G0308_i_PartyDirection);
                                M008_SET(M516_CHAMPIONS[L0053_i_ChampionIndex].Attributes, MASK0x0400_ICON);
                                F0292_CHAMPION_DrawState(L0053_i_ChampionIndex);
                        } else {
#ifdef MEDIA009_S10EA_S10EB_S11E_S12E_S12G_S13FA_S13FB_S20E_S21E_G14ED_G20E_G21E_A20ED_A20E_A20F_A20G_A21E_A22E_A22G
                                M524_FillScreenBox(&G0054_ai_Graphic562_Box_ChampionIcons[L0052_ui_ChampionIconIndex << 2], C00_COLOR_BLACK);
#endif
#ifdef MEDIA496_F20E_F20J_P20JA_P20JB_I34E_I34M_F31E_F31J_P31J
                                F0733_FillZoneByIndex(C113_ZONE_CHAMPION_ICON_TOP_LEFT + L0052_ui_ChampionIconIndex, C00_COLOR_BLACK);
#endif
#ifdef MEDIA613_X30J_A36M_A31E_A31M_A33M_A35E_A35M_X31J
                                F0733_FillZoneByIndex(C113_ZONE_CHAMPION_ICON_TOP_LEFT + P0094_ui_ChampionIconIndex, C00_COLOR_BLACK);
#endif
                        }
                        M516_CHAMPIONS[L0054_i_ChampionIndex].Cell = M021_NORMALIZE(P0094_ui_ChampionIconIndex + G0308_i_PartyDirection);
#ifdef MEDIA009_S10EA_S10EB_S11E_S12E_S12G_S13FA_S13FB_S20E_S21E_G14ED_G20E_G21E_A20ED_A20E_A20F_A20G_A21E_A22E_A22G
                        M008_SET(M516_CHAMPIONS[L0054_i_ChampionIndex].Attributes, MASK0x0400_ICON);
#endif
#ifdef MEDIA496_F20E_F20J_P20JA_P20JB_I34E_I34M_F31E_F31J_P31J
                        F0700_TriggerImmediateMouseEvent();
#endif
                        F0292_CHAMPION_DrawState(L0054_i_ChampionIndex);
#ifdef MEDIA094_S10EA_S10EB_S11E_S12E_S12G_S13FA_S13FB_S20E_S21E_G14ED_G20E_G21E_F20E_F20J_P20JA_P20JB_I34E_I34M_F31E_F31J_P31J
                        F0078_MOUSE_DisableScreenUpdate(); /* ANOMALY_ASSEMBLY_COMPILATION_DIFFERENCE nop */
#endif
                }
        }
#ifdef MEDIA613_X30J_A36M_A31E_A31M_A33M_A35E_A35M_X31J
        F0700_TriggerImmediateMouseEvent();
#endif
#ifdef MEDIA413_A20ED_A20E_A20F_A20G_A21E_A22E_A22G
        G1094_B_PreventBuildPointerScreenArea = C0_FALSE;
        F0073_MOUSE_BuildPointerScreenArea(G0589_i_MousePointerHotspotX, G0590_i_MousePointerHotspotY);
#endif
}

#ifdef MEDIA137_S10EA_S10EB_S11E_S12E_S12G_S13FA_S13FB_S20E_S21E_A20ED_A20E_A20F_A20G_A21E_A22E_A22G
void F0071_MOUSE_DropChampionIcon(
)
{
        REGISTER BOOLEAN L0057_B_UseByteBoxCoordinatesBackup;
        REGISTER unsigned int16_t L0058_ui_ChampionIconIndex;


#ifdef MEDIA413_A20ED_A20E_A20F_A20G_A21E_A22E_A22G
        G1094_B_PreventBuildPointerScreenArea = C1_TRUE;
#endif
        L0058_ui_ChampionIconIndex = M001_ORDINAL_TO_INDEX(G0599_ui_UseChampionIconOrdinalAsMousePointerBitmap);
        G0599_ui_UseChampionIconOrdinalAsMousePointerBitmap = M000_INDEX_TO_ORDINAL(CM1_CHAMPION_NONE);
        G0598_B_MousePointerBitmapUpdated = C1_TRUE;
#ifdef MEDIA007_S10EA_S10EB_S11E_S12E_S12G_S13FA_S13FB_S20E_S21E
        G0587_i_HideMousePointerRequestCount++;
        if (G0587_i_HideMousePointerRequestCount == 1) {
                G0594_B_BuildMousePointerScreenAreaRequestedInMouseException = C0_FALSE;
                G0592_B_BuildMousePointerScreenAreaRequested = C0_FALSE;
                G0593_B_BuildMousePointerScreenAreaCompleted = C0_FALSE;
                if (G0595_B_MousePointerVisible != C0_FALSE) {
                        G0595_B_MousePointerVisible = C0_FALSE;
                        S0072_MOUSE_DrawPointerHiddenScreenArea();
                }
        }
#endif
        L0057_B_UseByteBoxCoordinatesBackup = G0578_B_UseByteBoxCoordinates;
        M520_F0021_MAIN_BlitToScreen(G0613_puc_Bitmap_MousePointerOriginalColorsChampionIcon, &G0054_ai_Graphic562_Box_ChampionIcons[L0058_ui_ChampionIconIndex << 2], C016_BYTE_WIDTH, C12_COLOR_DARKEST_GRAY, 18);
        G0578_B_UseByteBoxCoordinates = L0057_B_UseByteBoxCoordinatesBackup;
#ifdef MEDIA007_S10EA_S10EB_S11E_S12E_S12G_S13FA_S13FB_S20E_S21E
        G0587_i_HideMousePointerRequestCount--;
        asm {
                bne.s   T0071002_Return         /* Branch if G0587_i_HideMousePointerRequestCount is not 0 */
        }
        G0592_B_BuildMousePointerScreenAreaRequested = C1_TRUE;
        G0594_B_BuildMousePointerScreenAreaRequestedInMouseException = C1_TRUE;
        T0071002_Return: ;
#endif
#ifdef MEDIA413_A20ED_A20E_A20F_A20G_A21E_A22E_A22G
        WaitBlit();
        G1094_B_PreventBuildPointerScreenArea = C0_FALSE;
#endif
}
#endif

#ifdef MEDIA007_S10EA_S10EB_S11E_S12E_S12G_S13FA_S13FB_S20E_S21E
asm { /* This asm section compiles correctly but the Megamax C disassembler fails inside this code and enters an infinite loop */
        S0072_MOUSE_DrawPointerHiddenScreenArea:
                movem.l D0-D5/A0-A1,-(A7)
                movea.l G0617_puc_Bitmap_MousePointerScreenArea(A4),A0
                movea.l G0618_puc_Bitmap_MousePointerHiddenScreenArea(A4),A1  /* This is a 432 bytes buffer. The hidden pixels area has 18 lines of 48 pixels = 18 * 24 = 432 bytes. The width is 48 pixels because the mouse pointer is 18x18 pixels large so it it possible that it is across three units (each unit is 16 pixels = 8 bytes) */
                movem.l (A1)+,D0-D5 /* Here are 18 copy operations of 24 bytes (6 registers of 4 bytes each) = 432 bytes */
                movem.l D0-D5,(A0)  /* BUG0_01 Memory located after the screen memory area is overwritten when drawing the mouse pointer when it is located at the bottom of the screen. This has no consequence because the screen memory is located at the end of the RAM */
                movem.l (A1)+,D0-D5
                movem.l D0-D5,160(A0)
                movem.l (A1)+,D0-D5
                movem.l D0-D5,320(A0)
                movem.l (A1)+,D0-D5
                movem.l D0-D5,480(A0)
                movem.l (A1)+,D0-D5
                movem.l D0-D5,640(A0)
                movem.l (A1)+,D0-D5
                movem.l D0-D5,800(A0)
                movem.l (A1)+,D0-D5
                movem.l D0-D5,960(A0)
                movem.l (A1)+,D0-D5
                movem.l D0-D5,1120(A0)
                movem.l (A1)+,D0-D5
                movem.l D0-D5,1280(A0)
                movem.l (A1)+,D0-D5
                movem.l D0-D5,1440(A0)
                movem.l (A1)+,D0-D5
                movem.l D0-D5,1600(A0)
                movem.l (A1)+,D0-D5
                movem.l D0-D5,1760(A0)
                movem.l (A1)+,D0-D5
                movem.l D0-D5,1920(A0)
                movem.l (A1)+,D0-D5
                movem.l D0-D5,2080(A0)
                movem.l (A1)+,D0-D5
                movem.l D0-D5,2240(A0)
                movem.l (A1)+,D0-D5
                movem.l D0-D5,2400(A0)
                movem.l (A1)+,D0-D5
                movem.l D0-D5,2560(A0)
                movem.l (A1)+,D0-D5
                movem.l D0-D5,2720(A0)
                movem.l (A7)+,D0-D5/A0-A1
                rts
}

void F0073_MOUSE_BuildPointerScreenArea(
)
{
        REGISTER unsigned long L0059_ul_X;
        REGISTER unsigned long L0060_ul_Y;
        REGISTER int16_t L0061_i_Height;
        REGISTER int16_t L0062_i_PixelWidth;
        REGISTER unsigned char* L0063_puc_Bitmap_ModifiedColors;
        REGISTER unsigned char* L0064_puc_Bitmap_OriginalColors;
        unsigned char L0065_auc_Box[4];
        BOOLEAN L0066_B_UseByteBoxCoordinatesBackup;
        int16_t L0067_i_MousePointerRightPadding;
        unsigned char* L0068_puc_Bitmap;


        G0611_puc_Bitmap_MousePointerArea = G0612_puc_Bitmap_MousePointerAreaCustom;
        L0066_B_UseByteBoxCoordinatesBackup = G0578_B_UseByteBoxCoordinates;
        G0578_B_UseByteBoxCoordinates = C1_TRUE;
        L0059_ul_X = G0591_l_MousePointerYX; /* The least significant word is the X coordinate. The most significant word is the Y coordinate */
        L0060_ul_Y = L0059_ul_X;
        asm {
                        swap    L0060_ul_Y
                        move.w  L0059_ul_X,G0607_i_MousePointerScreenAreaNextX(A4)
                        move.w  L0060_ul_Y,G0608_i_MousePointerScreenAreaNextY(A4)
                        tst.w   G0599_ui_UseChampionIconOrdinalAsMousePointerBitmap(A4)
                        bne     T0073008                                                                /* If a champion icon is being dragged and dropped */
                        lea     G0042_auc_Graphic562_Bitmap_ArrowPointer(A4),L0063_puc_Bitmap_ModifiedColors
                        move.w  #6,L0067_i_MousePointerRightPadding(A6)                                 /* The arrow mouse pointer visible width is 10 pixels. 6 pixels of padding on the right in the source 16x16 bitmap */
                        move.w  #C0_FALSE,G0602_B_CurrentMousePointerIsObject(A4)
                        cmpi.w  #169,L0060_ul_Y
                        bge.s   T0073003                                                                /* Branch if L0060_ul_Y >= 169 (signed comparison). If mouse pointer is over the message area on the bottom of the screen (Arrow mouse pointer is used over this area) */
                        cmpi.w  #274,L0059_ul_X
                        bge.s   T0073003                                                                /* Branch if L0059_ul_X >= 274 (signed comparison). If mouse pointer is over the champion icons at the top right corner of the screen  (Arrow mouse pointer is used over this area) */
                        cmpi.w  #28,L0060_ul_Y
                        ble.s   T0073001                                                                /* Branch if L0060_ul_Y <= 28 (signed comparison). If mouse pointer is over the champion status boxes on top of the screen  (Hand mouse pointer is used over this area, except over champion names) */
                        cmpi.w  #224,L0059_ul_X
                        bge.s   T0073003                                                                /* Branch if L0059_ul_X >= 224 (signed comparison). If mouse pointer is over the menus area at the right of the viewport (Arrow mouse pointer is used over this area) */
                        bra.s   T0073002                                                                /* If no conditions were true, the Arrow mouse pointer is used */
                T0073001:
                        moveq   #0,L0062_i_PixelWidth
                        move.w  L0059_ul_X,L0062_i_PixelWidth                                           /* Mouse pointer X coordinate */
                        divu    #C69_CHAMPION_STATUS_BOX_SPACING,L0062_i_PixelWidth                     /* L0062_i_PixelWidth is now the champion status box index over which the mouse pointer is located */
                        move.w  L0062_i_PixelWidth,L0061_i_Height
                        cmp.w   G0305_ui_PartyChampionCount(A4),L0061_i_Height
                        bge.s   T0073002                                                                /* If the mouse pointer is over an area without any champion status box (then use Hand mouse pointer) */
                        swap    L0062_i_PixelWidth                                                      /* Swap the quotient and remainder words */
                        cmpi.w  #42,L0062_i_PixelWidth
                        bgt.s   T0073002                                                                /* If remainder of division > 42 (then use Arrow mouse pointer, else use Hand mouse pointer). The width of a champion name is 42 pixels on the champion panel */
                        addq.w  #1,L0061_i_Height
                        cmp.w   G0423_i_InventoryChampionOrdinal(A4),L0061_i_Height
                        beq.s   T0073003
                        cmpi.w  #6,L0060_ul_Y
                        ble.s   T0073003                                                                /* If mouse pointer is over a champion name. The height of a champion name in a champion panel is 6 pixels */
                T0073002:
                        tst.w   G0600_B_UseObjectAsMousePointerBitmap(A4)
                        bne     T0073006                                                                /* If the mouse pointer is a custom bitmap */
                        tst.w   G0601_B_UseHandAsMousePointerBitmap(A4)
                        beq.s   T0073003                                                                /* If the mouse pointer is the arrow */
                        lea     G0043_auc_Graphic562_Bitmap_HandPointer(A4),L0063_puc_Bitmap_ModifiedColors
                        move.w  #0,L0067_i_MousePointerRightPadding(A6)                                 /* The hand mouse pointer visible width is 16 pixels. No padding on the right in the source 16x16 pixels bitmap */
        }
        T0073003:
        G0609_i_MousePointerAreaLastLineIndex = 15;
        G0605_i_MousePointerBitmapHotspotX = 0;
        G0606_i_MousePointerBitmapHotspotY = 0;
        asm {
                        andi.w  #0x000F,L0059_ul_X
                        beq.s   T0073004                                                                /* If X coordinate of mouse pointer is aligned on a unit (16 pixels) */
                        move.w  #2,G0610_ui_MousePointerAreaUnitWidth(A4)
                        cmp.w   L0067_i_MousePointerRightPadding(A6),L0059_ul_X
                        bgt.s   T0073005                                                                /* If new mouse X coordinate in the mouse pointer area is far enough on the right, the mouse pointer is over two units (16 pixels = 8 bytes) */
                        move.w  #1,G0610_ui_MousePointerAreaUnitWidth(A4)
                        bra.s   T0073005
                T0073004:
                        move.w  #1,G0610_ui_MousePointerAreaUnitWidth(A4)
                        move.l  L0063_puc_Bitmap_ModifiedColors,G0611_puc_Bitmap_MousePointerArea(A4)    /* Arrow or Hand mouse pointer bitmap */
                        bra     T0073016
        }
        T0073005:
        F0134_VIDEO_FillBitmap(G0612_puc_Bitmap_MousePointerAreaCustom, C12_COLOR_DARKEST_GRAY, G0610_ui_MousePointerAreaUnitWidth << 4);
        M769_BOX_RIGHT(L0065_auc_Box) = (M768_BOX_LEFT(L0065_auc_Box) = L0059_ul_X) + 15;
        M770_BOX_TOP(L0065_auc_Box) = 0;
        M771_BOX_BOTTOM(L0065_auc_Box) = 15;
        F0132_VIDEO_Blit(L0063_puc_Bitmap_ModifiedColors, G0612_puc_Bitmap_MousePointerAreaCustom, L0065_auc_Box, 0, 0, C008_BYTE_WIDTH, G0610_ui_MousePointerAreaUnitWidth << 3, CM1_COLOR_NO_TRANSPARENCY);
        goto T0073016;
        T0073006:
        G0602_B_CurrentMousePointerIsObject = C1_TRUE;
        G0609_i_MousePointerAreaLastLineIndex = 17;
        G0610_ui_MousePointerAreaUnitWidth = 2;
        G0605_i_MousePointerBitmapHotspotX = 8;
        G0606_i_MousePointerBitmapHotspotY = 8;
        asm {
                        moveq   #18,L0061_i_Height      /* Height of mouse pointer bitmap */
                        moveq   #17,L0062_i_PixelWidth  /* Width of mouse pointer bitmap - 1 */
        }
        L0063_puc_Bitmap_ModifiedColors = G0616_puc_Bitmap_MousePointerModifiedColorsObject;
        L0064_puc_Bitmap_OriginalColors = G0615_puc_Bitmap_MousePointerOriginalColorsObject;
        L0068_puc_Bitmap = L0064_puc_Bitmap_OriginalColors;
        asm {
                        subq.w  #8,L0059_ul_X
                        andi.w  #0x000F,L0059_ul_X
                        cmpi.w  #15,L0059_ul_X
                        bne.s   T0073007
                        move.w  #3,G0610_ui_MousePointerAreaUnitWidth(A4)
                T0073007:
                        subi.w  #19,L0060_ul_Y
                        ble     T0073014                /* If mouse pointer is not over the middle of the screen */
                        bra.s   T0073010
        }
        T0073008:
        G0609_i_MousePointerAreaLastLineIndex = 15;
        G0610_ui_MousePointerAreaUnitWidth = 2;
        G0605_i_MousePointerBitmapHotspotX = 9;
        G0606_i_MousePointerBitmapHotspotY = 7;
        L0061_i_Height = 16;
        L0062_i_PixelWidth = 20;
        L0063_puc_Bitmap_ModifiedColors = G0614_puc_Bitmap_MousePointerModifiedColorsChampionIcon;
        L0064_puc_Bitmap_OriginalColors = G0613_puc_Bitmap_MousePointerOriginalColorsChampionIcon;
        L0068_puc_Bitmap = L0064_puc_Bitmap_OriginalColors;
        asm {
                        subi.w  #9,L0059_ul_X
                        andi.w  #0x000F,L0059_ul_X
                        cmpi.w  #12,L0059_ul_X
                        blt.s   T0073009                                                /* Mouse pointer visible width is 21 pixels */
                        move.w  #3,G0610_ui_MousePointerAreaUnitWidth(A4)
                T0073009:
                        subi.w  #20,L0060_ul_Y
                        ble     T0073014
                T0073010:
                        tst.w   G0322_B_PaletteSwitchingEnabled(A4)                      /* Start here if mouse pointer is over the middle of the screen */
                        beq     T0073014                                                /* If palette switching is disabled (dungeon view is not on screen) */
                        cmp.w   L0061_i_Height,L0060_ul_Y
                        blt.s   T0073011_MousePointerAcrossPaletteAreas
                        move.l  L0063_puc_Bitmap_ModifiedColors,L0068_puc_Bitmap(A6)
                        bra     T0073014
        }
        T0073011_MousePointerAcrossPaletteAreas: /* The mouse pointer is a mix of original colors and modified colors */
        if (!(int16_t)L0059_ul_X) {
                L0059_ul_X = (L0061_i_Height - (int16_t)L0060_ul_Y) << 4;
                F0007_MAIN_CopyBytes(L0064_puc_Bitmap_OriginalColors, G0612_puc_Bitmap_MousePointerAreaCustom, (int16_t)L0059_ul_X);
                F0007_MAIN_CopyBytes((unsigned long)L0063_puc_Bitmap_ModifiedColors + (int16_t)L0059_ul_X, (unsigned long)G0612_puc_Bitmap_MousePointerAreaCustom + (int16_t)L0059_ul_X, (int16_t)L0060_ul_Y << 4);
        } else {
                F0134_VIDEO_FillBitmap(G0612_puc_Bitmap_MousePointerAreaCustom, C12_COLOR_DARKEST_GRAY, G0610_ui_MousePointerAreaUnitWidth * L0061_i_Height);
                L0060_ul_Y = L0061_i_Height - (int16_t)L0060_ul_Y;
                M769_BOX_RIGHT(L0065_auc_Box) = (M768_BOX_LEFT(L0065_auc_Box) = L0059_ul_X) + L0062_i_PixelWidth;
                M770_BOX_TOP(L0065_auc_Box) = 0;
                M771_BOX_BOTTOM(L0065_auc_Box) = (int16_t)L0060_ul_Y - 1;
                F0132_VIDEO_Blit(L0064_puc_Bitmap_OriginalColors, G0612_puc_Bitmap_MousePointerAreaCustom, L0065_auc_Box, 0, 0, C016_BYTE_WIDTH, G0610_ui_MousePointerAreaUnitWidth << 3, CM1_COLOR_NO_TRANSPARENCY);
                M770_BOX_TOP(L0065_auc_Box) = L0060_ul_Y;
                M771_BOX_BOTTOM(L0065_auc_Box) = L0061_i_Height - 1;
                F0132_VIDEO_Blit(L0063_puc_Bitmap_ModifiedColors, G0612_puc_Bitmap_MousePointerAreaCustom, L0065_auc_Box, 0, (int16_t)L0060_ul_Y, C016_BYTE_WIDTH, G0610_ui_MousePointerAreaUnitWidth << 3, CM1_COLOR_NO_TRANSPARENCY);
        }
        goto T0073016;
        T0073014:
        if (!(int16_t)L0059_ul_X) {
                G0611_puc_Bitmap_MousePointerArea = L0068_puc_Bitmap;
        } else {
                M769_BOX_RIGHT(L0065_auc_Box) = (M768_BOX_LEFT(L0065_auc_Box) = L0059_ul_X) + L0062_i_PixelWidth;
                M770_BOX_TOP(L0065_auc_Box) = 0;
                M771_BOX_BOTTOM(L0065_auc_Box) = L0061_i_Height - 1;
                F0134_VIDEO_FillBitmap(G0612_puc_Bitmap_MousePointerAreaCustom, C12_COLOR_DARKEST_GRAY, G0610_ui_MousePointerAreaUnitWidth * L0061_i_Height);
                F0132_VIDEO_Blit(L0068_puc_Bitmap, G0612_puc_Bitmap_MousePointerAreaCustom, L0065_auc_Box, 0, 0, C016_BYTE_WIDTH, G0610_ui_MousePointerAreaUnitWidth << 3, CM1_COLOR_NO_TRANSPARENCY);
        }
        T0073016:
        G0578_B_UseByteBoxCoordinates = L0066_B_UseByteBoxCoordinatesBackup;
}

void F0074_MOUSE_DrawPointerScreenArea(
)
{
        asm {
                S0074_MOUSE_DrawPointerScreenArea:
                        movem.l D0-D7/A0-A2,-(A7)
                        move.w  #C1_TRUE,G0595_B_MousePointerVisible(A4)
                        move.w  G0607_i_MousePointerScreenAreaNextX(A4),D6
                        move.w  G0608_i_MousePointerScreenAreaNextY(A4),D7
                        move.w  D6,G0603_i_MousePointerScreenAreaCurrentX(A4)
                        move.w  D7,G0604_i_MousePointerScreenAreaCurrentY(A4)
                        moveq   #0,D2
                        sub.w   G0605_i_MousePointerBitmapHotspotX(A4),D6
                        bpl.s   T0074001
                        moveq   #0,D6                                                   /* Minimum X coordinate allowed for the mouse pointer screen area, in bytes */
                        moveq   #0,D1
                        moveq   #1,D2
                        bra.s   T0074003
                T0074001:
                        cmpi.w  #272,D6
                        bmi.s   T0074002                                                /* If mouse pointer area is fully visible horizontally on screen 272 + 48 = 320 */
                        move.w  #136,D1                                                 /* Maximum X coordinate allowed for the mouse pointer screen area, in bytes (136 * 2 = 272) */
                        bra.s   T0074004
                T0074002:
                        move.w  D6,D1
                T0074003:
                        andi.w  #0xFFF0,D1                                              /* X coordinate of the first 16 pixels block containing the resulting coordinate */
                        lsr.w   #1,D1                                                   /* X coordinate, in bytes, of the first 16 pixels block containing the resulting coordinate */
                T0074004:
                        swap    D2
                        sub.w   G0606_i_MousePointerBitmapHotspotY(A4),D7
                        bpl.s   T0074005
                        move.w  D7,D2
                        moveq   #0,D7                                                   /* Minimum Y coordinate allowed for the mouse pointer screen area, in bytes */
                        neg.w   D2
                        bra.s   T0074007
                T0074005:
                        cmpi.w  #182,D7
                        bmi.s   T0074006                                                /* Branch if D7 < 182. If mouse pointer area is fully visible vertically on screen 182 + 18 = 200 */
                        addi.w  #29120,D1                                               /* Maximum Y coordinate allowed for the mouse pointer screen area, in bytes (182 * 160 = 29120) */
                        bra.s   T0074007
                T0074006:
                        move.w  D7,D0
                        lsl.w   #5,D0
                        add.w   D0,D1
                        add.w   D0,D0
                        add.w   D0,D0
                        add.w   D0,D1                                                   /* D1 = D1 + (D7 * 160) */
                T0074007:
                        movea.l D2,A2                                                   /* Backup D2 into A2 */
                        movea.w D1,A0
                        adda.l  G0348_Bitmap_Screen(A4),A0
                        move.l  A0,G0617_puc_Bitmap_MousePointerScreenArea(A4)
                        movea.l G0618_puc_Bitmap_MousePointerHiddenScreenArea(A4),A1    /* This is a 432 bytes buffer. Below are 18 copy operations of 24 bytes (6 registers of 4 bytes each) = 432 bytes */
                        lea     432(A1),A1                                              /* Copy screen area to G0618_puc_Bitmap_MousePointerHiddenScreenArea */
                        movem.l 2720(A0),D0-D5                                          /* BUG0_01 Memory located after the screen memory area is overwritten when drawing the mouse pointer when it is located at the bottom of the screen. This has no consequence because the screen memory is located at the end of the RAM */
                        movem.l D0-D5,-(A1)
                        movem.l 2560(A0),D0-D5
                        movem.l D0-D5,-(A1)
                        movem.l 2400(A0),D0-D5
                        movem.l D0-D5,-(A1)
                        movem.l 2240(A0),D0-D5
                        movem.l D0-D5,-(A1)
                        movem.l 2080(A0),D0-D5
                        movem.l D0-D5,-(A1)
                        movem.l 1920(A0),D0-D5
                        movem.l D0-D5,-(A1)
                        movem.l 1760(A0),D0-D5
                        movem.l D0-D5,-(A1)
                        movem.l 1600(A0),D0-D5
                        movem.l D0-D5,-(A1)
                        movem.l 1440(A0),D0-D5
                        movem.l D0-D5,-(A1)
                        movem.l 1280(A0),D0-D5
                        movem.l D0-D5,-(A1)
                        movem.l 1120(A0),D0-D5
                        movem.l D0-D5,-(A1)
                        movem.l 960(A0),D0-D5
                        movem.l D0-D5,-(A1)
                        movem.l 800(A0),D0-D5
                        movem.l D0-D5,-(A1)
                        movem.l 640(A0),D0-D5
                        movem.l D0-D5,-(A1)
                        movem.l 480(A0),D0-D5
                        movem.l D0-D5,-(A1)
                        movem.l 320(A0),D0-D5
                        movem.l D0-D5,-(A1)
                        movem.l 160(A0),D0-D5
                        movem.l D0-D5,-(A1)
                        movem.l (A0),D0-D5
                        movem.l D0-D5,-(A1)
                        move.w  G0609_i_MousePointerAreaLastLineIndex(A4),D0
                        move.w  G0610_ui_MousePointerAreaUnitWidth(A4),D1
                        movea.l G0611_puc_Bitmap_MousePointerArea(A4),A1
                        move.w  A2,D2                                                   /* Restore D2 from A2 */
                        beq.s   T0074008
                        sub.w   D2,D0
                        mulu.w  D1,D2
                        lsl.w   #3,D2
                        adda.w  D2,A1
                        bra.s   T0074009
                T0074008:
                        move.w  D0,D3
                        add.w   D7,D3
                        subi.w  #200,D3
                        bmi.s   T0074009
                        sub.w   D3,D0
                T0074009:
                        move.l  A2,D2
                        swap    D2
                        tst.w   D2
                        beq.s   T0074012
                T0074010:
                        subq.w  #2,D1
                        bne.s   T0074011
                        lea     T0074020(PC),A2
                        move.w  #152,D5
                        bra.s   T0074016
                T0074011:
                        lea     T0074018(PC),A2
                        move.w  #144,D5
                        bra.s   T0074016
                T0074012:
                        move.w  D1,D3
                        lsl.w   #4,D3
                        add.w   D6,D3
                        subi.w  #336,D3
                        bmi.s   T0074013
                        subq.l  #8,A1
                        bra.s   T0074010
                T0074013:
                        subq.w  #2,D1
                        bpl.s   T0074014
                        lea     T0074021(PC),A2
                        move.w  #152,D5
                        bra.s   T0074016
                T0074014:
                        bne.s   T0074015
                        lea     T0074019(PC),A2
                        move.w  #144,D5
                        bra.s   T0074016
                T0074015:
                        lea     T0074017(PC),A2
                        move.w  #136,D5
                T0074016:
                        andi.w  #0xFFF0,D6
                        lsr.w   #1,D6
                        lsl.w   #5,D7
                        add.w   D7,D6
                        add.w   D7,D7
                        add.w   D7,D7
                        add.w   D7,D6                                                   /* D6 = D6 + 160 * D7 */
                        movea.w D6,A0
                        adda.l  G0348_Bitmap_Screen(A4),A0
                        move.w  D0,D7
                        jmp     (A2)
                T0074017:
                        movem.w (A1),D0-D3
                        move.w  D2,D4
                        and.w   D3,D4
                        not.w   D4
                        or.w    D0,D4
                        or.w    D1,D4
                        swap    D0
                        move.w  D1,D0
                        swap    D2
                        move.w  D3,D2
                        move.w  D4,D3
                        swap    D4
                        move.w  D3,D4
                        and.l   D4,D0
                        and.l   D4,D2
                        not.l   D4
                        and.l   D4,(A0)
                        or.l    D0,(A0)+
                        and.l   D4,(A0)
                        or.l    D2,(A0)+
                T0074018:
                        addq.l  #8,A1
                T0074019:
                        movem.w (A1),D0-D3
                        move.w  D2,D4
                        and.w   D3,D4
                        not.w   D4
                        or.w    D0,D4
                        or.w    D1,D4
                        swap    D0
                        move.w  D1,D0
                        swap    D2
                        move.w  D3,D2
                        move.w  D4,D3
                        swap    D4
                        move.w  D3,D4
                        and.l   D4,D0
                        and.l   D4,D2
                        not.l   D4
                        and.l   D4,(A0)
                        or.l    D0,(A0)+
                        and.l   D4,(A0)
                        or.l    D2,(A0)+
                T0074020:
                        addq.l  #8,A1
                T0074021:
                        movem.w (A1)+,D0-D3
                        move.w  D2,D4
                        and.w   D3,D4
                        not.w   D4
                        or.w    D0,D4
                        or.w    D1,D4
                        swap    D0
                        move.w  D1,D0
                        swap    D2
                        move.w  D3,D2
                        move.w  D4,D3
                        swap    D4
                        move.w  D3,D4
                        and.l   D4,D0
                        and.l   D4,D2
                        not.l   D4
                        and.l   D4,(A0)
                        or.l    D0,(A0)+
                        and.l   D4,(A0)
                        or.l    D2,(A0)+
                        adda.w  D5,A0
                        subq.w  #1,D7
                        bmi.s   T0074022_Return
                        jmp     (A2)
                T0074022_Return:
                        movem.l (A7)+,D0-D7/A0-A2
                        rts
        }
}

void F0075_MOUSE_Exception70Handler_IKBD_MIDI_MouseStatus(
)
{
        asm {
                S0075_MOUSE_Exception70Handler_IKBD_MIDI_MouseStatus:
                        movem.l D0/A4,-(A7)
                        movea.l V0011000_A4RegisterBackup(PC),A4                                /* Restore A4 */
                        move.b  (A0),D0                                                         /* Get current mouse status (from the IKBD keyboard controller) */
                        andi.w  #0x0003,D0                                                      /* These bits give the status of each mouse button (bit 0 for right button, bit 1 for left button) */
                        cmp.w   G0588_i_MouseButtonsStatus(A4),D0
                        beq.s   T0075001                                                        /* If the state of mouse buttons has not changed since last time */
                        move.l  A5,-(A7)
                        movea.l V0012000_A5RegisterBackup(PC),A5                                /* Restore A5 (address of the JUMPTABLE) */
                        jsr     S0076_MOUSE_OnMouseButtonsStatusChange(PC)
                        movea.l (A7)+,A5
                T0075001:
                        tst.w   G0597_B_IgnoreMouseMovements(A4)
                        bne.s   T0075008_Return
                        move.b  1(A0),D0                                                        /* DeltaX. A signed byte from the IKBD keyboard controller describing the accumulated motion */
                        ext.w   D0
                        beq.s   T0075004                                                        /* If there was no motion on the X axis since last time */
                        add.w   G0589_i_MousePointerHotspotX(A4),D0
                        bpl.s   T0075002
                        clr.w   D0                                                              /* The minimum possible value is 0 */
                T0075002:
                        cmpi.w  #319,D0
                        ble.s   T0075003
                        move.w  #319,D0                                                         /* The maximum possible value is 319 */
                T0075003:
                        move.w  D0,G0589_i_MousePointerHotspotX(A4)
                T0075004:
                        move.b  2(A0),D0                                                        /* DeltaY. A signed byte from the IKBD keyboard controller describing the accumulated motion */
                        ext.w   D0
                        beq.s   T0075007
                        add.w   G0590_i_MousePointerHotspotY(A4),D0
                        bpl.s   T0075005
                        clr.w   D0                                                              /* The minimum possible value is 0 */
                T0075005:
                        cmpi.w  #199,D0
                        ble.s   T0075006
                        move.w  #199,D0                                                         /* The maximum possible value is 199 */
                T0075006:
                        move.w  D0,G0590_i_MousePointerHotspotY(A4)
                T0075007:
                        tst.w   G0594_B_BuildMousePointerScreenAreaRequestedInMouseException(A4)
                        beq.s   T0075008_Return
                        move.w  #C1_TRUE,G0592_B_BuildMousePointerScreenAreaRequested(A4)
                T0075008_Return:
                        movem.l (A7)+,D0/A4
                        rts
        }
}

void F0076_MOUSE_OnMouseButtonsStatusChange(
)
{
        static BOOLEAN G0623_B_Mouse_OnButtonsStatusChangeSemaphore = C0_FALSE;


        asm {
                S0076_MOUSE_OnMouseButtonsStatusChange:
                        tas     G0623_B_Mouse_OnButtonsStatusChangeSemaphore(A4)         /* This instruction makes sure that a click on a button will be processed only once */
                        beq.s   T0076001                                                /* Branch if the value WAS 0 before the tas instruction. If a mouse click is not already being processed */
                        rts
                T0076001:
                        movem.l D0-D3/A0-A1,-(A7)
                        tst.w   G0588_i_MouseButtonsStatus(A4)
                        beq.s   T0076002                                                /* If no buttons were pressed in the previous status (as the status has changed, it means a button was pressed) */
                        tst.w   D0
                        bne.s   T0076005                                                /* If a button is pressed in the current status */
                T0076002:
                        move.w  D0,G0588_i_MouseButtonsStatus(A4)                        /* Update variable with new buttons status */
                        beq.s   T0076003                                                /* If no buttons are pressed in the current status (as the status has changed, it means a button was released) */
                        move.l  G0590_i_MousePointerHotspotY(A4),D1                      /* Current mouse pointer absolute coordinates (moving a long moves both words for X and Y coordinates) The least significant word of D1 contains the X coordinate */
                        move.l  D1,D2
                        swap    D2                                                      /* The least significant word of D2 now contains the Y coordinates */
                        move.w  D0,-(A7)
                        move.w  D2,-(A7)
                        move.w  D1,-(A7)
                        jsr     F0359_COMMAND_ProcessClick_CPSC(PC)
                        addq.l  #6,A7
                        bra.s   T0076005
                T0076003:
                        tst.w   G0331_B_PressingEye(A4)
                        beq.s   T0076004                                                /* If the player is not pressing the Eye icon */
#ifdef MEDIA006_S10EA_S10EB_S11E_S12E_S12G_S13FA_S13FB /* CHANGE7_02_FIX Do not clear G0331_B_PressingEye immediately when the mouse button is released so that its value cannot change while processing F0380_COMMAND_ProcessQueue_CPSC. G0331_B_PressingEye is now cleared in F0002_MAIN_GameLoop_CPSDF */
                        clr.w   G0331_B_PressingEye(A4)
#endif
                        clr.w   G0597_B_IgnoreMouseMovements(A4)                         /* As the button has been released, mouse movements should not be ignored anymore */
                        move.w  #C1_TRUE,G0332_B_StopPressingEye(A4)                        /* This will instruct the main loop to stop pressing eye */
                        bra.s   T0076005
                T0076004:
                        tst.w   G0333_B_PressingMouth(A4)
                        beq.s   T0076005                                                /* If the player is not pressing the Mouth icon */
#ifdef MEDIA006_S10EA_S10EB_S11E_S12E_S12G_S13FA_S13FB /* CHANGE7_02_FIX Do not clear G0333_B_PressingMouth immediately when the mouse button is released so that its value cannot change while processing F0380_COMMAND_ProcessQueue_CPSC. G0333_B_PressingMouth is now cleared in F0002_MAIN_GameLoop_CPSDF */
                        clr.w   G0333_B_PressingMouth(A4)
#endif
                        clr.w   G0597_B_IgnoreMouseMovements(A4)                         /* As the button has been released, mouse movements should not be ignored anymore */
                        move.w  #C1_TRUE,G0334_B_StopPressingMouth(A4)                      /* This will instruct the main loop to stop pressing mouth */
                T0076005:
                        clr.w   G0623_B_Mouse_OnButtonsStatusChangeSemaphore(A4)         /* Clear semaphore to mark the end of the processing of the buttons status change */
                        movem.l (A7)+,D0-D3/A0-A1
                        rts
        }
}
#endif

#ifdef MEDIA351_G14ED_G20E_G21E
int16_t F2166_(
)
{
        F0070_MOUSE_ProcessCommands125To128_ClickOnChampionIcon(G2164_i_MousePointerChampionIndex);
}

/* For mouse cursor format, see Cursor section in Chapter 16 of Apple IIGS Toolbox Reference Volume 2
A cursor is defined by n slices of m words */
void F2167_BuildAppleIIGSMouseCursor(
P6066_ui_SliceCount, P6067_ui_WordCound, P6068_pui_CursorBitmap, P6069_pui_CursorMask, P6070_ui_HotspotX, P6071_ui_HotspotY, P6072_pui_CursorBuffer)
unsigned int16_t  P6066_ui_SliceCount    SEPARATOR
unsigned int16_t  P6067_ui_WordCound     SEPARATOR
unsigned int16_t* P6068_pui_CursorBitmap SEPARATOR
unsigned int16_t* P6069_pui_CursorMask   SEPARATOR
unsigned int16_t  P6070_ui_HotspotX      SEPARATOR
unsigned int16_t  P6071_ui_HotspotY      SEPARATOR
unsigned int16_t* P6072_pui_CursorBuffer FINAL_SEPARATOR
{
        unsigned int16_t L6417_ui_CursorBitmapByteCount;
        unsigned int16_t L6419_;
        unsigned int16_t L6418_;


        L6417_ui_CursorBitmapByteCount = P6066_ui_SliceCount + (P6066_ui_SliceCount * P6067_ui_WordCound);
        *P6072_pui_CursorBuffer = P6066_ui_SliceCount;
        *(P6072_pui_CursorBuffer + 1) = P6067_ui_WordCound + 1; /* Last word in each slice must be 0, so one more word added */
        L6418_ = 0;
        do {
                L6419_ = P6067_ui_WordCound;
                do {
                        P6072_pui_CursorBuffer[2 + L6418_] = *P6068_pui_CursorBitmap;
                        P6068_pui_CursorBitmap++;
                        P6072_pui_CursorBuffer[2 + L6417_ui_CursorBitmapByteCount + L6418_] = *P6069_pui_CursorMask;
                        P6069_pui_CursorMask++;
                        L6418_++;
                        L6419_--;
                } while (L6419_);
                P6072_pui_CursorBuffer[2 + L6418_] = 0; /* Write last word of bitmap slice */
                P6072_pui_CursorBuffer[2 + L6417_ui_CursorBitmapByteCount + L6418_] = 0; /* Write last word of mask slice */
                L6418_++;
                P6066_ui_SliceCount--;
        } while (P6066_ui_SliceCount);
        L6417_ui_CursorBitmapByteCount <<= 1;
        P6072_pui_CursorBuffer[2 + L6417_ui_CursorBitmapByteCount] = P6070_ui_HotspotX;
        P6072_pui_CursorBuffer[3 + L6417_ui_CursorBitmapByteCount] = P6071_ui_HotspotY;
}
#endif

#ifdef MEDIA529_F20E_F20J_X30J_P20JA_P20JB_I34E_I34M_A36M_A31E_A31M_A33M_A35E_A35M_F31E_F31J_X31J_P31J
void F0703_ReleaseChampionIcon(
void
)
{
        if (G0599_ui_UseChampionIconOrdinalAsMousePointerBitmap) {
                F0070_MOUSE_ProcessCommands125To128_ClickOnChampionIcon(G2164_i_MousePointerChampionIndex);
        }
}
#endif

#ifdef MEDIA551_F20E_F20J_F31E_F31J
BOOLEAN F0712_AnyKeyboardOrMouseInput(
void
)
{
        return (G0588_i_MouseButtonsStatus || F0539_INPUT_Cconis());
}
#endif

#ifdef MEDIA613_X30J_A36M_A31E_A31M_A33M_A35E_A35M_X31J
int16_t F1041_GetMousePointerType(
register int16_t P2775_i_X SEPARATOR
register int16_t P2776_i_Y FINAL_SEPARATOR
{
        static BOOLEAN G3106_B_;
#ifdef MEDIA626_A31E_A31M_A33M_A35E_A35M
        static int16_t G3245_Unreferenced;
#endif
        register int16_t L2921_i_;
        int16_t L2922_i_;
        register int16_t L2923_i_;
        register int16_t L2924_i_;


        if (G0587_i_HideMousePointerRequestCount > 0) {
                return CM1_POINTER_NONE;
        }
#ifdef MEDIA577_X30J
        if (!G0601_B_UseHandAsMousePointerBitmap && !G0600_B_UseObjectAsMousePointerBitmap) {
                return C0_POINTER_ARROW;
        }
#endif
        if (L2923_i_ = (G3102_B_MouseBounded && ((P2775_i_X < M704_ZONE_LEFT(G3104_ai_XYZ_MouseBound)) || (P2775_i_X > M705_ZONE_RIGHT(G3104_ai_XYZ_MouseBound)) || (P2776_i_Y < M706_ZONE_TOP(G3104_ai_XYZ_MouseBound)) || (P2776_i_Y > M707_ZONE_BOTTOM(G3104_ai_XYZ_MouseBound))))) {
                if (G3103_i_MouseBoundButtonsStatus) {
                        F0359_COMMAND_ProcessClick_CPSC(P2775_i_X, P2776_i_Y, G3103_i_MouseBoundButtonsStatus);
                        G3103_i_MouseBoundButtonsStatus = 0;
                }
        }
        if (G0599_ui_UseChampionIconOrdinalAsMousePointerBitmap) {
                return C3_POINTER_CHAMPION_ICON;
        }
#ifdef MEDIA749_A36M_A31E_A31M_A33M_A35E_A35M_X31J
        if (!G0601_B_UseHandAsMousePointerBitmap && !G0600_B_UseObjectAsMousePointerBitmap) {
                return C0_POINTER_ARROW;
        }
#endif
        if (L2923_i_ || G3105_B_ || G3106_B_) {
#ifdef MEDIA749_A36M_A31E_A31M_A33M_A35E_A35M_X31J
                G3105_B_ = C0_FALSE;
#endif
                for (L2921_i_ = 0; L2921_i_ < 16; L2921_i_++) {
                        if ((P2775_i_X < M704_ZONE_LEFT(G2052_as_MousePointerScreenRegions[L2921_i_].XYZ)) || (P2775_i_X > M705_ZONE_RIGHT(G2052_as_MousePointerScreenRegions[L2921_i_].XYZ)) || (P2776_i_Y < M706_ZONE_TOP(G2052_as_MousePointerScreenRegions[L2921_i_].XYZ)) || (P2776_i_Y > M707_ZONE_BOTTOM(G2052_as_MousePointerScreenRegions[L2921_i_].XYZ))) {
                                continue;
                        }
                        G3106_B_ = C0_FALSE;
                        if (G2052_as_MousePointerScreenRegions[L2921_i_].ChampionOrdinal == M000_INDEX_TO_ORDINAL(CM1_CHAMPION_NONE)) {
                                F1040_SetMouseBoundEvent(G2052_as_MousePointerScreenRegions[L2921_i_].XYZ, G3103_i_MouseBoundButtonsStatus);
                                if (G0600_B_UseObjectAsMousePointerBitmap) {
                                        if (G2052_as_MousePointerScreenRegions[L2921_i_].PointerType == 1) {
                                                return C2_POINTER_OBJECT_ICON;
                                        }
                                }
                                return G2052_as_MousePointerScreenRegions[L2921_i_].PointerType;
                        }
                        L2924_i_ = M001_ORDINAL_TO_INDEX(G2052_as_MousePointerScreenRegions[L2921_i_].ChampionOrdinal & 7);
#ifdef MEDIA607_X30J_X31J
                        L2922_i_ = G2052_as_MousePointerScreenRegions[L2921_i_].ChampionOrdinal >> 3;
#endif
#ifdef MEDIA746_A36M_A31E_A31M_A33M_A35E_A35M
                        L2922_i_ = (int16_t)G2052_as_MousePointerScreenRegions[L2921_i_].ChampionOrdinal >> 3;
#endif
                        F1040_SetMouseBoundEvent(G2052_as_MousePointerScreenRegions[L2921_i_].XYZ, G3103_i_MouseBoundButtonsStatus);
                        if (L2924_i_ < G0305_ui_PartyChampionCount) {
                                if (M516_CHAMPIONS[L2924_i_].CurrentHealth) {
                                        if ((L2924_i_ == M001_ORDINAL_TO_INDEX(G0423_i_InventoryChampionOrdinal)) || L2922_i_) {
                                                return C0_POINTER_ARROW;
                                        }
                                }
                        }
                        return G0600_B_UseObjectAsMousePointerBitmap ? C2_POINTER_OBJECT_ICON : C1_POINTER_HAND;
                }
        }
        if ((P2775_i_X < 0) || (P2775_i_X >= G2071_C320_ScreenPixelWidth) || (P2776_i_Y < 0) || (P2776_i_Y >= G2072_C200_ScreenPixelHeight)) {
                G3106_B_ = C1_TRUE;
                return C0_POINTER_ARROW;
        }
        return G3107_i_GetMousePointerType;
}
#endif

#ifdef MEDIA349_G14ED
void F0078_MOUSE_DisableScreenUpdate(
)
{
        ShowCursor();
}
#endif

#ifdef MEDIA078_S10EA_S10EB_S11E_S12E_S12G_S13FA_S13FB_S20E_S21E_G14ED_G20E_G21E_A20ED_A20E_A20F_A20G_A21E_A22E_A22G_X30J_A36M_A31E_A31M_A33M_A35E_A35M_X31J
void F0077_MOUSE_EnableScreenUpdate_CPSE(
#ifdef MEDIA529_F20E_F20J_X30J_P20JA_P20JB_I34E_I34M_A36M_A31E_A31M_A33M_A35E_A35M_F31E_F31J_X31J_P31J
void
#endif
)
{
#ifdef MEDIA114_S10EA_S10EB_S11E_S12E_S12G_S13FA_S13FB_S20E_S21E_G20E_G21E_A20ED_A20E_A20F_A20G_A21E_A22E_A22G
        if (G0587_i_HideMousePointerRequestCount++ == 0) {
#endif
#ifdef MEDIA007_S10EA_S10EB_S11E_S12E_S12G_S13FA_S13FB_S20E_S21E
                G0596_B_NoDrawInVerticalBlankWhileHidingMousePointer = C1_TRUE;
#endif
#ifdef MEDIA137_S10EA_S10EB_S11E_S12E_S12G_S13FA_S13FB_S20E_S21E_A20ED_A20E_A20F_A20G_A21E_A22E_A22G
                G0594_B_BuildMousePointerScreenAreaRequestedInMouseException = C0_FALSE;
                G0592_B_BuildMousePointerScreenAreaRequested = C0_FALSE;
                G0593_B_BuildMousePointerScreenAreaCompleted = C0_FALSE;
#endif
#ifdef MEDIA351_G14ED_G20E_G21E
                HideCursor();
#endif
#ifdef MEDIA007_S10EA_S10EB_S11E_S12E_S12G_S13FA_S13FB_S20E_S21E
                if (G0595_B_MousePointerVisible != C0_FALSE) {
                        G0595_B_MousePointerVisible = C0_FALSE;
                        S0072_MOUSE_DrawPointerHiddenScreenArea();
                }
                G0596_B_NoDrawInVerticalBlankWhileHidingMousePointer = C0_FALSE;
#endif
#ifdef MEDIA114_S10EA_S10EB_S11E_S12E_S12G_S13FA_S13FB_S20E_S21E_G20E_G21E_A20ED_A20E_A20F_A20G_A21E_A22E_A22G
        }
#endif
#ifdef MEDIA075_S10EA_S10EB_S11E_S12E_S12G_S13FA_S13FB_S20E_S21E_G14ED_G20E_G21E_A20ED_A20E_A20F_A20G_A21E_A22E_A22G_X30J_A31E_A31M_A33M_A35E_A35M_X31J
#ifndef NOCOPYPROTECTION
        if ((G0488_i_Graphic560_RequestCheckFuzzyBitCount_CPSE != C12777_FALSE) && !F0356_CPSE_IsFuzzySectorValid_ByteValuesAndFuzzyBitCount(M517_FuzzySectorReadingBuffer_CPSE)) {
                G0189_i_Graphic558_StopAddingEvents_CPSE = C01113_TRUE;
        }
#endif
#endif
}
#endif

#ifdef MEDIA116_S10EA_S10EB_S11E_S12E_S12G_S13FA_S13FB_S20E_S21E_G20E_G21E_A20ED_A20E_A20F_A20G_A21E_A22E_A22G_X30J_A36M_A31E_A31M_A33M_A35E_A35M_X31J
void F0078_MOUSE_DisableScreenUpdate(
#ifdef MEDIA529_F20E_F20J_X30J_P20JA_P20JB_I34E_I34M_A36M_A31E_A31M_A33M_A35E_A35M_F31E_F31J_X31J_P31J
void
#endif
)
{
#ifdef MEDIA114_S10EA_S10EB_S11E_S12E_S12G_S13FA_S13FB_S20E_S21E_G20E_G21E_A20ED_A20E_A20F_A20G_A21E_A22E_A22G
        if (G0587_i_HideMousePointerRequestCount-- == 1) {
#endif
#ifdef MEDIA137_S10EA_S10EB_S11E_S12E_S12G_S13FA_S13FB_S20E_S21E_A20ED_A20E_A20F_A20G_A21E_A22E_A22G
                G0592_B_BuildMousePointerScreenAreaRequested = G0594_B_BuildMousePointerScreenAreaRequestedInMouseException = C1_TRUE;
#endif
#ifdef MEDIA388_G20E_G21E
                ShowCursor();
#endif
#ifdef MEDIA114_S10EA_S10EB_S11E_S12E_S12G_S13FA_S13FB_S20E_S21E_G20E_G21E_A20ED_A20E_A20F_A20G_A21E_A22E_A22G
        }
#endif
}
#endif


#ifdef MEDIA351_G14ED_G20E_G21E
asm(F2182_) {
                REP     #0x30
                LDA     0xe100ff
                AND     #0xff
                BEQ     L082F86
                PHA
                LDA     #^F2183_
                PHA
                LDA     #F2183_
                PHA
                LDX     #0x907          /* SchAddTask */
                JSL     0xe10000
                PLA
                BRA     L082F8A
        L082F86:
                JSL     >F2183_
        L082F8A:
                SEP     #0x30
                STA     0xc047          /* CLRVBLINT */
                CLC
                RTL
}

asm(F2183_) {
#ifdef MEDIA350_G14ED_G20E /* Read mouse position directly in memory */
                SEP     #0x30
                LDA     0x47c           /* Low byte of absolute X position */
                STA     >G4042_i_
                LDA     0x57c           /* High byte of absolute X position */
                STA     >G4042_i_+1
                LDA     0x4fc           /* Low byte of absolute Y position */
                STA     >G4044_i_
                LDA     0x5fc           /* High byte of absolute Y position */
                STA     >G4044_i_+1
                REP     #0x30
#endif
#ifdef MEDIA409_G21E /* Call ReadMouse to get mouse position */
                REP     #0x30
                LDA     #0x0000
                PHA
                PHA
                PHA
                LDX     #0x1703         /* ReadMouse */
                JSL     0xe10000
                PLA                     /* status / mode */
                PLA                     /* Y */
                STA     >G4044_i_
                PLA                     /* X */
                STA     >G4042_i_
#endif
                LDA     >G0599_ui_UseChampionIconOrdinalAsMousePointerBitmap
                BEQ     L082FDC
                LDA     >G4018_B_
                BNE     L082FDC
                LDA     >G4042_i_
                CMP     #0x112
                BCC     L082FD5
                LDA     >G4044_i_
                CMP     #0x1c
                BCS     L082FD5
                LDA     #0x04
                BRL     L08303C
        L082FD5:
                LDA     #0x01
                STA     >G4018_B_
        L082FDC:
                LDA     >G0600_
                BEQ     L083011
                LDA     >G4042_i_
                CMP     #0x112
                BCS     L082FFA
                LDA     >G4044_i_
                CMP     #0x1f
                BCS     L082FFA
                LDA     #0x02
                BRL     L08303C
        L082FFA:
                LDA     >G4042_i_
                CMP     #0xdf
                BCS     L083011
                LDA     >G4044_i_
                CMP     #0x1f
                BCC     L083011
                LDA     #0x03
                BRA     L08303C
        L083011:
                LDA     >G0601_
                BEQ     L083039
                LDA     >G4044_i_
                CMP     #0x1f
                BCS     L08302B
                LDA     >G4042_i_
                CMP     #0x112
                BCC     L083034
                BCS     L083039
        L08302B:
                LDA     >G4042_i_
                CMP     #0xdf
                BCS     L083039
        L083034:
                LDA     #0x01
                BRA     L08303C
        L083039:
                LDA     #0x00
        L08303C:
                PHA
                LDA     >G0598_B_MousePointerBitmapUpdated
                BEQ     L08304D
                LDA     #0x00
                STA     >G0598_B_MousePointerBitmapUpdated
                PLA
                BRA     L083057
        L08304D:
                PLA
                CMP     >G4046_i_
                BNE     L083057
                BRL     L0830C0
        L083057:
                STA     >G4046_i_
#ifdef MEDIA388_G20E_G21E
                LDA     >G4025_B_
                BNE     L083064
                BRL     L0830C0
        L083064:
                LDA     >G4046_i_
#endif
                CMP     #0x00
                BNE     L083079
                LDA     >G4019_pui_+2
                PHA
                LDA     >G4019_pui_
                BRL     L0830B8
        L083079:
                CMP     #0x01
                BNE     L08308A
                LDA     >G4020_pui_+2
                PHA
                LDA     >G4020_pui_
                BRL     L0830B8
        L08308A:
                CMP     #0x02
                BNE     L08309A
                LDA     >G4014_pc_+2
                PHA
                LDA     >G4014_pc_
                BRA     L0830B8
        L08309A:
                CMP     #0x03
                BNE     L0830AA
                LDA     >G4012_pc_+2
                PHA
                LDA     >G4012_pc_
                BRA     L0830B8
        L0830AA:
                CMP     #0x04
                BNE     L0830C0
                LDA     >G4017_puc_+2
                PHA
                LDA     >G4017_puc_
        L0830B8:
                PHA
                LDX     #0x8e04         /* SetCursor */
                JSL     0xe10000
        L0830C0:
                RTL
}
#endif

#ifdef MEDIA421_A20ED_A20E_A20F_A20G_A21E_A22E_A22G_X30J_A36M_A31E_A31M_A33M_A35E_A35M_X31J
void F0548_MOUSE_HidePointer(
#ifdef MEDIA529_F20E_F20J_X30J_P20JA_P20JB_I34E_I34M_A36M_A31E_A31M_A33M_A35E_A35M_F31E_F31J_X31J_P31J
void
#endif
)
{
#ifdef MEDIA433_A20E_A20F_A20G_A21E_A22E_A22G
        G1095_B_--;
        if (G1095_B_ == 0) {
#endif
#ifdef MEDIA413_A20ED_A20E_A20F_A20G_A21E_A22E_A22G
                F0077_MOUSE_EnableScreenUpdate_CPSE();
                F0510_AMIGA_WaitBottomOfViewPort();
                custom.dmacon = 0x20; /* 0x8000: clear other specified bits without affecting other bits. 0x0020: Sprite DMA disable */
#endif
#ifdef MEDIA433_A20E_A20F_A20G_A21E_A22E_A22G
        }
#endif
#ifdef MEDIA607_X30J_X31J
        if (G0587_i_HideMousePointerRequestCount++ == 0) {
                asm {
                        move.l  #0xC2,d0         /* SP_OFF */
                        trap    #0xF             /* TRAP 15 (IOCS CALL) */
                }
        }
#endif
#ifdef MEDIA746_A36M_A31E_A31M_A33M_A35E_A35M
        G0587_i_HideMousePointerRequestCount++;
        F0700_TriggerImmediateMouseEvent();
#endif
}

void F0549_MOUSE_ShowPointer(
#ifdef MEDIA529_F20E_F20J_X30J_P20JA_P20JB_I34E_I34M_A36M_A31E_A31M_A33M_A35E_A35M_F31E_F31J_X31J_P31J
void
#endif
)
{
#ifdef MEDIA433_A20E_A20F_A20G_A21E_A22E_A22G
        if (G1095_B_ == 0) {
#endif
#ifdef MEDIA413_A20ED_A20E_A20F_A20G_A21E_A22E_A22G
                custom.dmacon = 0x8020; /* 0x8000: set other specified bits without affecting other bits. 0x0020: Sprite DMA enable */
                F0078_MOUSE_DisableScreenUpdate();
#endif
#ifdef MEDIA433_A20E_A20F_A20G_A21E_A22E_A22G
        }
        G1095_B_++;
#endif
#ifdef MEDIA607_X30J_X31J
        if (G0587_i_HideMousePointerRequestCount-- == 1) {
                asm {
                        move.l  #0xC1,d0         /* SP_ON */
                        trap    #0xF             /* TRAP 15 (IOCS CALL) */
                }
        }
#endif
#ifdef MEDIA746_A36M_A31E_A31M_A33M_A35E_A35M
        G0587_i_HideMousePointerRequestCount--;
        F0700_TriggerImmediateMouseEvent();
#endif
}
#endif

#ifdef MEDIA463_P20JA_P20JB_I34E_I34M_P31J
void F0078_MOUSE_DisableScreenUpdate(
void
)
{
#ifdef MEDIA707_I34E_I34M
        G0587_i_HideMousePointerRequestCount--;
#endif
        (*(G2161_IODriver->IODRV_07_ShowMousePointer))();
}

void F0077_MOUSE_EnableScreenUpdate_CPSE(
void
)
{
#ifdef MEDIA707_I34E_I34M
        G0587_i_HideMousePointerRequestCount++;
#endif
        (*(G2161_IODriver->IODRV_08_HideMousePointer))();
}

void F0704_(
void
)
{
        (*(G2161_IODriver->IODRV_03_))();
}

void F0705_(
void
)
{
        (*(G2161_IODriver->IODRV_04_))();
}

void F0785_SetMousePointerCoordinates(
int16_t P2386_i_,
int16_t P2387_i_)
{
        (*(G2161_IODriver->IODRV_12_SetMousePointerCoordinates))(P2386_i_, P2387_i_);
}

void F0706_GetMouseState(
int16_t* P2388_pi_,
int16_t* P2389_pi_,
int16_t* P2390_pi_)
{
        (*(G2161_IODriver->IODRV_13_GetMouseState))(P2388_pi_, P2389_pi_, P2390_pi_);
}
#endif

#ifdef MEDIA692_X31J
void F0710_WaitSoundPlayComplete(
void
)
{
        asm {
                @Tloc_1F872
                moveq   #0x66,d0
                trap    #15
                tst.w   d0
                bne.s   @Tloc_1F872
        }
}
#endif

#ifdef MEDIA483_P20JB_I34E_I34M_X31J_P31J
BOOLEAN F0707_ResetSoundBufferAddress(
int16_t P2391_i_ FINAL_SEPARATOR
{
        if ((P2391_i_ < 0) || (G0060_as_Graphic562_Sounds[P2391_i_].GraphicIndex < 0)
#ifdef MEDIA472_P20JB_P31J
            || G2350_
#endif
           ) {
                return C0_FALSE;
        }
        G0060_as_Graphic562_Sounds[P2391_i_].Buffer = NULL;
        return C1_TRUE;
}
#endif

#ifdef MEDIA463_P20JA_P20JB_I34E_I34M_P31J
void F0060_SOUND_Play_CPSX(
unsigned char* P0084_puc_SoundData,
unsigned int16_t P0085_i_Period,
int16_t P0086_i_SoundVolume)
{
        int16_t L2925_i_;
#ifdef MEDIA457_P20JA
        register unsigned int16_t L2926_i_;


        L2926_i_ = P0085_i_Period;
#endif
#ifdef MEDIA707_I34E_I34M
        if (P0084_puc_SoundData != NULL) {
#endif
                L2925_i_ = (*P0084_puc_SoundData << 8) | *(P0084_puc_SoundData + 1);
#ifdef MEDIA457_P20JA
                (*(G2161_IODriver->IODRV_15_))(P0084_puc_SoundData + 2, L2925_i_, P0086_i_SoundVolume);
#endif
#ifdef MEDIA480_P20JB_I34E_I34M_P31J
                if (L2925_i_) {
                        (*(G2161_IODriver->IODRV_15_))(P0084_puc_SoundData + 2, L2925_i_, P0085_i_Period, P0086_i_SoundVolume);
                }
#endif
#ifdef MEDIA707_I34E_I34M
        }
#endif
}
#endif

#ifdef MEDIA480_P20JB_I34E_I34M_P31J
BOOLEAN F0786_(
unsigned char* P2392_puc_,
int16_t P2393_i_B,
int16_t P2394_i_C)
{
        int16_t L2927_i_;


        L2927_i_ = (*P2392_puc_ << 8) | *(P2392_puc_ + 1);
        return (*(G2162_IODriver->IODRV_24_))(P2392_puc_ + 2, L2927_i_, P2393_i_B, P2394_i_C);
}
#endif

#ifdef MEDIA483_P20JB_I34E_I34M_X31J_P31J
void F0709_StartSound(
int16_t P2395_i_SoundIndex SEPARATOR
int16_t P2396_i_SoundVolume           FINAL_SEPARATOR
{
#ifdef MEDIA480_P20JB_I34E_I34M_P31J
        unsigned char* L2928_puc_;


        if ((P2395_i_SoundIndex < 0) || (G0060_as_Graphic562_Sounds[P2395_i_SoundIndex].GraphicIndex >= 0)) {
                L2928_puc_ = G0060_as_Graphic562_Sounds[P2395_i_SoundIndex].Buffer;
                F0060_SOUND_Play_CPSX(L2928_puc_, P2396_i_SoundVolume, 6000);
        }
#endif
#ifdef MEDIA692_X31J
        register unsigned int16_t* L2929_pui_;
        register int16_t L2930_i_;


        L2929_pui_ = (unsigned int16_t*)G0060_as_Graphic562_Sounds[P2395_i_SoundIndex].Buffer;
        L2930_i_ = G0060_as_Graphic562_Sounds[P2395_i_SoundIndex].Period;
        if (*L2929_pui_) {
                asm {
                        moveq   #0,d1
                        moveq   #0x67,d0
                        trap    #15
                        movea.l a4,a1
                        moveq   #0,d2
                        move.w  (a1)+,d2
                        addq.w  #1,d2
                        lsr.w   #1,d2
                        lsl.w   #8,d7
                        addq.w  #3,d7
                        move.w  d7,d1
                        moveq   #0x60,d0
                        trap    #15
                }
        }
#endif
}
#endif

#ifdef MEDIA463_P20JA_P20JB_I34E_I34M_P31J
void F0710_WaitSoundPlayComplete(
void
)
{
        (*(G2161_IODriver->IODRV_16_WaitSoundPlayComplete))();
}

#include "IO2.C"

void F0713_InitIOInterrupt(
void
)
{
#ifdef MEDIA459_P20JA_P20JB_P31J
        G2162_IODriver = G2161_IODriver = (IO_DRIVER*)getvect(C254_DM_IO_INTERRUPT);
        if (F0716_CallRazAXInIBMIO(-1)) {
                G2359_B_FormatFloppyAllowed = C1_TRUE;
        }
#endif
#ifdef MEDIA707_I34E_I34M
        G2161_IODriver = (IO_DRIVER*)getvect(C254_DM_IO_INTERRUPT);
        G2162_IODriver = G2161_IODriver;
#endif
#ifdef MEDIA709_I34E_I34M_P31J
        G2163_ = (*(G2162_IODriver->IODRV_14_SetCustomVerticalBlankRoutine))(F0782_);
#endif
        asm     mov     ax, ds
        asm     mov     cs:V0713000_DSRegisterBackup, ax
        return;
        V0713000_DSRegisterBackup:
        asm     V0713000_DSRegisterBackup      dw      0
}

int16_t F0714_GetReadFirstSectorResult(
int16_t P2398_i_DriveOrdinal FINAL_SEPARATOR
{
#ifdef MEDIA458_P20JA_P20JB
        return (*(G2162_IODriver->IODRV_18))(P2398_i_DriveOrdinal);
#endif
#ifdef MEDIA709_I34E_I34M_P31J
        int16_t L2931_i_;


        L2931_i_ = (*(G2162_IODriver->IODRV_18))(P2398_i_DriveOrdinal);
        return L2931_i_;
#endif
}

int16_t F0715_GetConvertedDeviceType(
int16_t P2399_i_ FINAL_SEPARATOR
{
        return (*(G2162_IODriver->IODRV_20_))(P2399_i_);
}

int16_t F0716_CallRazAXInIBMIO(
int16_t P2400_i_ FINAL_SEPARATOR
{
        (*(G2162_IODriver->IODRV_17_))(P2400_i_);
}

void F0717_GetVolumeName(
int16_t P2401_i_  SEPARATOR
char*   P2402_pc_ FINAL_SEPARATOR
{
        (*(G2161_IODriver->IODRV_19_GetVolumeName))(P2401_i_, P2402_pc_);
}

int16_t F0718_GetTime(
void
)
{
        return (*(G2162_IODriver->IODRV_21_))();
}
#endif

#ifdef MEDIA480_P20JB_I34E_I34M_P31J
void F0719_PlayMusicTrack(
int16_t P2403_i_TrackNumber FINAL_SEPARATOR
{
#ifdef MEDIA707_I34E_I34M
        if (G2024_B_PendingMusicOn) {
#endif
                (*(G2161_IODriver->IODRV_23_PlayAudioCDTrack))(P2403_i_TrackNumber);
#ifdef MEDIA707_I34E_I34M
        }
#endif
}
#endif

#ifdef MEDIA458_P20JA_P20JB
#ifndef NOCOPYPROTECTION
long F0527_FLOPPY_ReadFuzzySector_CPSX(
void
)
{
        (*(G2161_IODriver->IODRV_22_ReadFloppySector))(M517_FuzzySectorReadingBuffer_CPSE, 1, 1, 9, 1, sizeof(M517_FuzzySectorReadingBuffer_CPSE));
}
#endif

#include "COPYPRO6.C"
#include "COPYPRO7.C"
#include "COPYPRO5.C"
#endif

#ifdef MEDIA667_P31J
#ifndef NOCOPYPROTECTION
void F0808_SeekToCylinder0_Unreferenced(
void
)
{
        char L2932_c_PhysicalDeviceAddress;


        L2932_c_PhysicalDeviceAddress = peekb(0, 0x0584); /* DISK_BOOT */
        asm     mov     ah, 0x10        /* Seek */
        asm     mov     al, L2932_c_PhysicalDeviceAddress
        asm     mov     cl, 0           /* Cylinder number */
        asm     int     0x1B            /* PC98 DISK BIOS */
        asm     mov     ah, 7           /* Recalibrate (seek to cylinder 0) */
        asm     mov     al, L2932_c_PhysicalDeviceAddress
        asm     int     0x1B            /* PC98 DISK BIOS */
}

BOOLEAN F0809_CheckCopyProtectionSide0Track0_CPSX(
unsigned char* P2404_puc_ FINAL_SEPARATOR
{
        char L2933_c_PhysicalDeviceAddress;
        unsigned char L2934_uc_Checksum;
        int16_t L2936_i_Unreferenced;
        int16_t L2937_i_ByteIndex;


        L2933_c_PhysicalDeviceAddress = peekb(0, 0x0584); /* DISK_BOOT */
        /* Make sure the specified buffer can store 5840 bytes in the same segment, not across two segments */
        if (((long)((FP_SEG(P2404_puc_) << 4) + (FP_OFF(P2404_puc_) & 0xFFFF)) + 5840) & 0xFFFF0000) {
                P2404_puc_ += 5840;
        }
        asm     push    es
        asm     push    bp
        asm     mov     ah, 0x52        /* Read diagnostic (Read the specified number of bytes starting from the first of the 1024 data bytes of the specified sector and ignore ID and data errors that Read Data would return), MFM/No retry/Seek */
        asm     mov     al, L2933_c_PhysicalDeviceAddress
        asm     mov     bx, 1088        /* Data length */
        asm     mov     ch, 7           /* Sector length (00h-03h) (00 = 128B, 01 = 256B, 02 = 512B, 03 = 1024B). 7 means size = 16384 (Size = 128 x 2^value) */
        asm     mov     dh, 0           /* Head number */
        asm     mov     dl, 1           /* Sector number */
        asm     les     bp, P2404_puc_  /* Data buffer */
        asm     mov     cl, 0           /* Cylinder number */
        asm     mov     si, 0
        asm     int     0x1B            /* PC98 DISK BIOS */
        asm     pop     bp
        asm     pop     es
        /* The 1088 bytes read by the Read diagnostic on an original disk are:
        Offset      Size Description
           0..1023  1024 Sector 1 data bytes
        1024..1025  2    Sector 1 CRC (16 bits)
        1026..1027  2    Abnormal gap data bytes. Should be 0x4E bytes but replaced with custom values for the copy protection
        1028..1087  60   Gap bytes (0x4E) + next sector ID + gap

        The checksum (sum of all byte values on 8 bit) of these 1088 bytes is 0x86 */
        L2934_uc_Checksum = 0;
        for (L2937_i_ByteIndex = 0; L2937_i_ByteIndex < 1088; L2937_i_ByteIndex++) {
                L2934_uc_Checksum += P2404_puc_[L2937_i_ByteIndex];
        }
        if ((L2934_uc_Checksum != 0x86) || (P2404_puc_[1026] != 0x31) || (P2404_puc_[1027] != 0x53)) { /* Bytes 1026 and 1027 are the two bytes located right after the CRC of the sector data on the floppy disk (the first two bytes of the gap between sectors 1 and 2). Normally these bytes would have value 0x4E (like the following bytes in the gap). */
                return C0_FALSE;
        } else {
                return C1_TRUE;
        }
}

BOOLEAN F0810_CheckCopyProtectionSide0Track2_CPSX(
unsigned char* P2405_puc_ FINAL_SEPARATOR
{
        char L2938_c_PhysicalDeviceAddress;
        unsigned char L2939_uc_Checksum;
        int16_t L2940_i_Unreferenced;
        int16_t L2941_i_ByteIndex;


        L2938_c_PhysicalDeviceAddress = peekb(0, 0x0584); /* DISK_BOOT */
        /* Make sure the specified buffer can store 5840 bytes in the same segment, not across two segments */
        if (((long)((FP_SEG(P2405_puc_) << 4) + (FP_OFF(P2405_puc_) & 0xFFFF)) + 5840) & 0xFFFF0000) {
                P2405_puc_ += 5840;
        }
        asm     push    bp
        asm     mov     ah, 0x52        /* Read diagnostic (Read the specified number of bytes starting from the first of the 1024 data bytes of the specified sector and ignore ID and data errors that Read Data would return), MFM/No retry/Seek */
        asm     mov     al, L2938_c_PhysicalDeviceAddress
        asm     mov     bx, 5840        /* Data length. Note the analysis performed below ignores the last 4 bytes read */
        asm     mov     ch, 7           /* Sector length (00h-03h) (00 = 128B, 01 = 256B, 02 = 512B, 03 = 1024B). 7 means size = 16384 (Size = 128 x 2^value) */
        asm     mov     dh, 0           /* Head number */
        asm     mov     dl, 1           /* Sector number */
        asm     les     bp, P2405_puc_
        asm     mov     cl, 2           /* Cylinder number */
        asm     mov     si, 0
        asm     int     0x1B            /* PC98 DISK BIOS */
        asm     pop     bp
        /* The 5840 bytes read by the Read diagnostic on an original disk are:
        Offset      Size Description
           0..1023  1024 Sector 1 data bytes
        1024..1025  2    Sector 1 CRC (16 bits)
        1026..1027  2    Abnormal gap data bytes. Should be 0x4E bytes but replaced with custom values for the copy protection
        1028..1201  174  Gap bytes (0x4E) + next sector ID + gap

        1202..2225  1024 Sector 2 data bytes
        2226..2227  2    Sector 2 CRC (16 bits)
        2228..2234  7    Abnormal gap data bytes. Should be 0x4E bytes but replaced with custom values for the copy protection
        2235..2403  169  Gap bytes (0x4E) + next sector ID + gap

        2404..3427  1024 Sector 3 data bytes
        3428..3429  2    Sector 3 CRC (16 bits)
        3430..3431  2    Abnormal gap data bytes. Should be 0x4E bytes but replaced with custom values for the copy protection
        3432..3605  174  Gap bytes (0x4E) + next sector ID + gap

        3606..4629  1024 Sector 4 data bytes
        4630..4631  2    Sector 4 CRC (16 bits)
        4632..4633  2    Abnormal gap data bytes. Should be 0x4E bytes but replaced with custom values for the copy protection
        4634..4807  174  Gap bytes (0x4E) + next sector ID + gap

        4808..5831  1024 Sector 5 data bytes
        5832..5833  2    Sector 5 CRC (16 bits)
        5834..5835  2    Abnormal gap data bytes. Should be 0x4E bytes but replaced with custom values for the copy protection
        5836..5839  4    Gap bytes not analysed in this function

        The checksum (sum of all byte values, except the last 4 bytes, on 8 bit) of these 5836 bytes is 0x26 */
        L2939_uc_Checksum = 0;
        for (L2941_i_ByteIndex = 0; L2941_i_ByteIndex < 5836; L2941_i_ByteIndex++) {
                L2939_uc_Checksum += P2405_puc_[L2941_i_ByteIndex];
        }
        if ((L2939_uc_Checksum != 0x26) || (P2405_puc_[1026] != G2351_Side0Track2Sector1PostCRCByte1_CPSX) || (P2405_puc_[1027] != G2352_Side0Track2Sector1PostCRCByte2_CPSX)) {
                return C0_FALSE;
        }
        for (L2941_i_ByteIndex = 0; L2941_i_ByteIndex < 7; L2941_i_ByteIndex++) {
                if (P2405_puc_[L2941_i_ByteIndex + 2228] != G2215_ac_Side0Track2Sector2PostCRCBytes_CPSX[L2941_i_ByteIndex]) {
                        return C0_FALSE;
                }
        }
        if ((P2405_puc_[3430] != G2353_Side0Track2Sector3PostCRCByte1_CPSX) || (P2405_puc_[3431] != G2354_Side0Track2Sector3PostCRCByte2_CPSX)) {
                return C0_FALSE;
        }
        if ((P2405_puc_[4632] != G2355_Side0Track2Sector4PostCRCByte1_CPSX) || (P2405_puc_[4633] != G2356_Side0Track2Sector4PostCRCByte2_CPSX)) {
                return C0_FALSE;
        }
        if ((P2405_puc_[5834] != G2357_Side0Track2Sector5PostCRCByte1_CPSX) || (P2405_puc_[5835] != G2358_Side0Track2Sector5PostCRCByte2_CPSX)) {
                return C0_FALSE;
        }
        return C1_TRUE;
}

BOOLEAN F0811_CheckCopyProtectionSide0Track0_Unreferenced(
void
)
{
        char L2942_c_PhysicalDeviceAddress;


        L2942_c_PhysicalDeviceAddress = peekb(0, 0x0584); /* DISK_BOOT */
        asm     mov     ah, 0x1A        /* Read ID (Return the first sector ID found), FM/Retry/Seek */
        asm     mov     al, L2942_c_PhysicalDeviceAddress
        asm     mov     dh, 0           /* Head number */
        asm     mov     cl, 0           /* Cylinder number */
        asm     int     0x1B            /* PC98 DISK BIOS */
        asm     mov     ah, 0x5A        /* Read ID (Return the first sector ID found), MFM/Retry/Seek */
        asm     mov     al, L2942_c_PhysicalDeviceAddress
        asm     mov     dh, 0           /* Head number */
        asm     mov     cl, 0           /* Cylinder number */
        asm     int     0x1B            /* PC98 DISK BIOS */
        asm     cmp     dl, 1           /* Returned sector number */
        asm     jnz     loc_34F32
        asm     cmp     cl, 0           /* Returned cylinder number */
        asm     jnz     loc_34F32
        asm     cmp     dh, 0           /* Returned head number */
        asm     jnz     loc_34F32
        asm     cmp     ch, 3           /* Returned sector length */
        asm     jnz     loc_34F32
        return C1_TRUE;
        loc_34F32:
        return C0_FALSE;
}

BOOLEAN F0812_CheckCopyProtectionSide0Track1_CPSX( /* Make sure sector 240 is found and not readable (on an original disk this sector header is located in the gap between sectors 3 and 4 and has no data) */
unsigned char* P2406_puc_ FINAL_SEPARATOR
{
        char L2943_c_PhysicalDeviceAddress;


        L2943_c_PhysicalDeviceAddress = peekb(0, 0x0584); /* DISK_BOOT */
        asm     push    bp
        asm     mov     ah, 0x76        /* BIOS command identification 0x06 = Read data, 0x70 = MFM/No retry/Seek */
        asm     mov     al, L2943_c_PhysicalDeviceAddress      /* Physical Device Address */
        asm     mov     bx, 256         /* Data length in bytes */
        asm     mov     ch, 7           /* Sector length (00h-03h) (00 = 128B, 01 = 256B, 02 = 512B, 03 = 1024B). 7 means size = 16384 (Size = 128 x 2^value) */
        asm     mov     cl, 1           /* Cylinder number (0-76) */
        asm     mov     dh, 0           /* Head number (0-1) */
        asm     mov     dl, 240         /* Sector number (1-26) */
        asm     les     bp, P2406_puc_  /* Data buffer address */
        asm     int     0x1B            /* PC98 DISK BIOS */
        asm     pop     bp
        return (_AH == 0xA0); /* 0xA0 means a CRC error was detected (but the sector ID does exist) */
}
#endif

void F0813_PlayMIDIMusic( /* Play midi music file enter.sng */
char* P2407_pc_ FINAL_SEPARATOR
{
        (*(G2161_IODriver->IODRV_27_))(0, P2407_pc_);
}

void F0814_TRansition_MIDIMusic(
void
)
{
        (*(G2161_IODriver->IODRV_27_))(2);
}

void F0815_StopMIDIMusic(
void
)
{
        (*(G2161_IODriver->IODRV_27_))(1);
}
#endif
#endif
#ifdef MEDIA772_SU1E
extern void F0359_COMMAND_ProcessClick_CPSC();

int16_t G3500_;
int16_t G3506_;
int16_t G3503_i_MouseX;
int16_t G3504_i_MouseY;
int16_t G3502_;
long* G3507_;
long* G3508_;
int16_t G3505_;
int16_t G3501_;


void F0077_MOUSE_EnableScreenUpdate_CPSE(
)
{
        if (G3500_++ == 0) {
                F1629_VDI_v_hide_c(G3501_);
        }
}

void F0078_MOUSE_DisableScreenUpdate(
)
{
        if (G3500_-- == 1) {
                F1628_VDI_v_show_c(G3501_, 1);
        }
}

void F1529_(
)
{
        F1628_VDI_v_show_c(G3501_, 0);
        G3500_ = 0;
}

void F1530_ShowMousePointerAsArrow(int16_t P5101_, int16_t P5102_) {
        F1578_AES_graf_mouse(0, P5102_); /* Set mouse to use arrow pointer */  /* BUGX_XX: second parameter should be a char* */
        F1628_VDI_v_show_c(P5101_, 0); /* Show mouse cursor */
}

void F1531_MouseHandler(int16_t P5103_, int16_t P5104_) {
        register char* L5219_;
        char L5217_[6];
        long L5218_;


        asm {
                lea     @Tdword_15B0,a0
                move.l  a5,(a0)
        }
        switch (P5103_) {
                case 1: /* Install routines */
                        F1630_VDI_vq_mouse(G3501_ = P5104_, L5217_, &G3503_i_MouseX, &G3504_i_MouseY);
                        asm {
                                lea     @Tloc_158E,a4
                        }
                        F1632_VDI_vex_motv(G3501_, L5219_, &G3507_);
                        asm {
                                lea     @Tloc_15B4,a4
                        }
                        F1631_VDI_vex_butv(G3501_, L5219_, &G3508_);
                        return;
                case 2: /* Uninstall routines */
                        F1632_VDI_vex_motv(G3501_, G3507_, &L5218_);
                        F1631_VDI_vex_butv(G3501_, G3508_, &L5218_);
                        return;
                default:
                        return;
        }
        asm {
                @Tloc_158E:
                        move.l  a5,-(sp)
                        movea.l @Tdword_15B0,a5
                        tst.w   G3502_(a5)
                        beq.s   @Tloc_15A4
                        move.w  G3503_i_MouseX(a5),d0
                        move.w  G3504_i_MouseY(a5),d1
                        bra.s   @Tloc_15AC
                @Tloc_15A4:
                        move.w  d0,G3503_i_MouseX(a5)
                        move.w  d1,G3504_i_MouseY(a5)
                @Tloc_15AC:
                        movea.l (sp)+,a5
                        rts
                @Tdword_15B0:
                        dc.l 0
                @Tloc_15B4:
                        movem.l d0-d3/a0-a1/a5,-(sp)
                        movea.l @Tdword_15B0,a5
                        tas     G3505_(a5)
                        bne.s   @Tloc_15EC
                        move.w  G3506_(a5),d3
                        beq.s   @Tloc_15D2
                        tst.w   d0
                        beq.s   @Tloc_15D2
                        move.w  d0,G3506_(a5)
                        bra.s   @Tloc_15E8
                @Tloc_15D2:
                        move.w  d0,G3506_(a5)
                        beq.s   @Tloc_15E8
                        move.w  d0,-(sp)
                        move.w  G3504_i_MouseY(a5),-(sp)
                        move.w  G3503_i_MouseX(a5),-(sp)
                        jsr     F0359_COMMAND_ProcessClick_CPSC
                        addq.l  #6,sp
                @Tloc_15E8:
                        clr.w   G3505_(a5)

                @Tloc_15EC:
                        movem.l (sp)+,d0-d3/a0-a1/a5
                        rts
        }
}
#endif
