#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 MEDIA413_A20ED_A20E_A20F_A20G_A21E_A22E_A22G
struct BitMap* G1056_ps_MessageAreaNewRowBitMap;
unsigned char G1103_auc_InterfaceAndScrollsFont[768]; /* Replaces G0357_puc_InterfaceAndScrollsFont */
#endif
#ifdef MEDIA009_S10EA_S10EB_S11E_S12E_S12G_S13FA_S13FB_S20E_S21E_G14ED_G20E_G21E_A20ED_A20E_A20F_A20G_A21E_A22E_A22G
char G0353_ac_StringBuildBuffer[128];
#endif
#ifdef MEDIA529_F20E_F20J_X30J_P20JA_P20JB_I34E_I34M_A36M_A31E_A31M_A33M_A35E_A35M_F31E_F31J_X31J_P31J
char G0353_ac_StringBuildBuffer[150];
#endif
#ifdef MEDIA351_G14ED_G20E_G21E
unsigned char G1103_auc_InterfaceAndScrollsFont[768]; /* Replaces G0357_puc_InterfaceAndScrollsFont */
#endif
#ifdef MEDIA173_S10EA_S10EB_S11E_S12E_S12G_S13FA_S13FB_S20E_S21E_A36M_A31E_A31M_A33M_A35E_A35M
int16_t G0354_i_MessageAreaScrollingLineCount = -1;
#endif
#ifdef MEDIA172_S10EA_S10EB_S11E_S12E_S12G_S13FA_S13FB_S20E_S21E_I34E_I34M_A36M_A31E_A31M_A33M_A35E_A35M_X31J_P31J
BOOLEAN G0355_B_ScrollMessageArea;
#endif
#ifdef MEDIA351_G14ED_G20E_G21E
BOOLEAN G0355_B_ScrollMessageArea = C0_FALSE;
#endif
#ifdef MEDIA515_F20E_F20J_X30J_P20JA_P20JB_F31E_F31J
BOOLEAN G0355_B_ScrollMessageArea = C0_FALSE;
#endif
#ifdef MEDIA159_S10EA_S10EB_S11E_S12E_S12G_S13FA_S13FB_S20E_S21E_P20JA_P20JB_I34E_I34M_P31J
unsigned char* G0356_puc_Bitmap_MessageAreaNewRow; /* Width = 320 pixels = 160 bytes, Height = 7 pixels */
#endif
#ifdef MEDIA162_S10EA_S10EB_S11E_S12E_S12G_S13FA_S13FB_S20E_S21E_F20E_F20J_X30J_P20JA_P20JB_I34E_I34M_A36M_A31E_A31M_A33M_A35E_A35M_F31E_F31J_X31J_P31J
unsigned char* G0357_puc_InterfaceAndScrollsFont;
#endif
#ifdef MEDIA413_A20ED_A20E_A20F_A20G_A21E_A22E_A22G
unsigned char* G0356_puc_Bitmap_MessageAreaNewRow = NULL; /* Width = 320 pixels = 160 bytes, Height = 7 pixels */
#endif
#ifdef MEDIA548_F20E_F20J_X30J_A36M_A31E_A31M_A33M_A35E_A35M_F31E_F31J_X31J
unsigned char* G0356_puc_Bitmap_MessageAreaNewRow; /* Width = 320 pixels = 160 bytes, Height = 7 pixels */
#endif
#ifdef MEDIA351_G14ED_G20E_G21E
unsigned char G3971_auc_Bitmap_MessageAreaNewRow[1120]; /* Width = 320 pixels = 160 bytes, Height = 7 pixels */
#endif
#ifdef MEDIA525_F20E_F20J_X30J_P20JA_P20JB_I34E_I34M_F31E_F31J_X31J_P31J
int16_t G2104_i_InterfaceAndScrollsFontCurrentTextColor = -1;
int16_t G2105_i_InterfaceAndScrollsFontCurrentBackgroundColor = -1;
#endif
#ifdef MEDIA496_F20E_F20J_P20JA_P20JB_I34E_I34M_F31E_F31J_P31J
unsigned char* G2148_puc_InterfaceAndScrollsFontCustomColors;
#endif
#ifdef MEDIA746_A36M_A31E_A31M_A33M_A35E_A35M
long G0064_al_Graphic562_PrintTextMasks2[4] = { 0xFFF0FFF0, 0xFFF8FFF8, 0xFFFCFFFC, 0xFFFEFFFE };
long G0065_al_Graphic562_PrintTextMasks1[4] = { 0x7FFF7FFF, 0x3FFF3FFF, 0x1FFF1FFF, 0x0FFF0FFF };
int16_t G3215_ai_XYZ[4];
BOOLEAN G3222_B_MessageAreaDataInitialized;
int16_t G3218_;
int16_t G3216_;
int16_t G3217_;
int16_t G3219_;
int16_t G3220_;
int16_t G3221_;
unsigned int16_t G3214_;
#endif
static int16_t G0358_i_MessageAreaCursorRow;
static int16_t G0359_i_MessageAreaCursorColumn;
long G0360_al_MessageAreaRowExpirationTime[M532_MESSAGE_AREA_ROW_COUNT];
#ifdef MEDIA413_A20ED_A20E_A20F_A20G_A21E_A22E_A22G
char G1029_ac_LineFeedCharacterString[2] = "\n";
#endif

#ifdef MEDIA459_P20JA_P20JB_P31J
static BOOLEAN F0818_IsJapaneseText(REGISTER unsigned char* P2189_pc_String);
#endif

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


#ifdef MEDIA497_F20E_F20J_P20JA_P20JB_I34E_I34M_A36M_A31E_A31M_A33M_A35E_A35M_F31E_F31J_P31J
#include "TEXT2.C"
#endif

#ifdef MEDIA607_X30J_X31J
#include "DRAWMSGA.C"
#endif

#ifdef MEDIA571_F20J_X30J_P20JA_P20JB_F31J_X31J_P31J
static BOOLEAN F0818_IsJapaneseText(
REGISTER unsigned char* P2189_pc_String FINAL_SEPARATOR
{
        REGISTER unsigned char L3445_uc_;


        if (*P2189_pc_String == 0x1B) {
                return C1_TRUE;
        }
        while (L3445_uc_ = *P2189_pc_String++) {
                if (L3445_uc_ & 0x80) {
                        return C1_TRUE;
                }
        }
        return C0_FALSE;
}
#endif

#ifdef MEDIA746_A36M_A31E_A31M_A33M_A35E_A35M
void F1029_InitializeMessageAreaData(
void
)
{
        register unsigned int16_t L3446_ui_;


        G3214_ = (int16_t)((G2071_C320_ScreenPixelWidth + 0xF) & 0xFFF0) >> 3;
        L3446_ui_ = (int16_t)((G2092_MessageAreaWidth + 0xF) & 0xFFF0) >> 3;
        F0638_GetZone(C015_ZONE_MESSAGE_AREA, G3215_ai_XYZ);
        G3218_ = G3217_ = G3216_ = G3215_ai_XYZ[1] * G3214_;
        G3216_ += G3214_;
        G3217_ += G3214_ * ((G2088_C7_TextLineHeight * 3) - 1);
        G3219_ = G3214_ * ((G2088_C7_TextLineHeight * 4) - 1);
        G3220_ = G2187_MessageAreaHeight_Unreferenced * L3446_ui_;
        G3221_ = G3214_ * G2072_C200_ScreenPixelHeight;
        G3222_B_MessageAreaDataInitialized = C1_TRUE;
}
#endif

#ifdef MEDIA529_F20E_F20J_X30J_P20JA_P20JB_I34E_I34M_A36M_A31E_A31M_A33M_A35E_A35M_F31E_F31J_X31J_P31J
BOOLEAN F0645_GetStringPixelDimensions(
REGISTER char* P2190_pc_String SEPARATOR
int16_t*       P2191_pi_Width  SEPARATOR
int16_t*       P2192_pi_Height FINAL_SEPARATOR
{
        REGISTER int16_t L3448_i_Width;
        REGISTER int16_t L3449__Height;
#ifdef MEDIA571_F20J_X30J_P20JA_P20JB_F31J_X31J_P31J
        REGISTER int16_t L3447_i_;
#endif


        if (P2190_pc_String == NULL) {
                return C0_FALSE;
        }
#ifdef MEDIA571_F20J_X30J_P20JA_P20JB_F31J_X31J_P31J
        if (F0818_IsJapaneseText(M774_CAST_PUC(P2190_pc_String))) {
                L3447_i_ = 0;
                L3448_i_Width = -G2339_;
                L3449__Height = 0;
                while (P2190_pc_String[L3447_i_] != '\0') {
                        L3447_i_ = F0952_JAPANESE_Print(M774_CAST_PUC(P2190_pc_String), L3447_i_, NULL, P2191_pi_Width, P2192_pi_Height, C00_COLOR_BLACK, C00_COLOR_BLACK);
                        L3449__Height = F0025_MAIN_GetMaximumValue(L3449__Height, *P2192_pi_Height);
                        if (*P2191_pi_Width) {
                                L3448_i_Width += *P2191_pi_Width + G2339_;
                        }
                }
        } else {
#endif
                L3448_i_Width = -G2084_C1_;
                L3449__Height = G2083_C6_ - G2086_C1_;
                while (*P2190_pc_String++) {
                        L3448_i_Width += G2087_C6_TextCharacterWidth;
                }
#ifdef MEDIA571_F20J_X30J_P20JA_P20JB_F31J_X31J_P31J
        }
#endif
        if (L3448_i_Width <= 0) {
                return C0_FALSE;
        }
        *P2191_pi_Width = L3448_i_Width;
        *P2192_pi_Height = L3449__Height;
        return C1_TRUE;
}

/* Returns the width of the largest sub string of P2193_pc_String that starts at character P2195_pi_CharacterIndex and fits in P2196_i_Width. The substring is copied to P2194_pc_String */
int16_t F0646_GetLargestPrintableSubString(
REGISTER char*    P2193_pc_String         SEPARATOR
REGISTER char*    P2194_pc_String         SEPARATOR
REGISTER int16_t* P2195_pi_CharacterIndex SEPARATOR
int16_t           P2196_i_Width           FINAL_SEPARATOR
{
#ifdef MEDIA613_X30J_A36M_A31E_A31M_A33M_A35E_A35M_X31J
        REGISTER int16_t L3450_i_;
        REGISTER int16_t L3451_i_;
        REGISTER int16_t L3452_i_;
        REGISTER unsigned int16_t L3453_i_SpaceCharacterIndex;
        REGISTER int16_t L3455_i_;
        int16_t L3456_i_;
#endif
#ifdef MEDIA707_I34E_I34M
        REGISTER int16_t L3450_i_;
        REGISTER int16_t L3451_i_;
        REGISTER int16_t L3452_i_;
        REGISTER unsigned int16_t L3453_i_SpaceCharacterIndex;
        REGISTER int16_t L3455_i_;
        int16_t L3456_i_;
#endif
#ifdef MEDIA669_F31E
        REGISTER int16_t L3450_i_;
        REGISTER int16_t L3451_i_;
        REGISTER int16_t L3452_i_;
        REGISTER unsigned int16_t L3453_i_SpaceCharacterIndex;
        REGISTER int16_t L3455_i_;
        int16_t L3456_i_;
#endif
#ifdef MEDIA686_F31J
        REGISTER int16_t L3450_i_;
        REGISTER int16_t L3451_i_;
        REGISTER int16_t L3452_i_;
        REGISTER unsigned int16_t L3453_i_SpaceCharacterIndex;
        REGISTER int16_t L3455_i_;
        int16_t L3456_i_;
#endif
#ifdef MEDIA607_X30J_X31J
        int16_t L3457_i_;
        int16_t L3458_i_;
        int16_t L3459_i_;
        int16_t L3460_i_;
#endif
#ifdef MEDIA686_F31J
        int16_t L3457_i_;
        int16_t L3458_i_;
        int16_t L3459_i_;
        int16_t L3460_i_;
#endif
#ifdef MEDIA487_F20E
        register int16_t L3452_i_;
        register int16_t L3451_i_;
        register int16_t L3450_i_;
        REGISTER unsigned int16_t L3453_i_SpaceCharacterIndex;
        REGISTER int16_t L3455_i_;
        int16_t L3456_i_;
#endif
#ifdef MEDIA564_F20J
        int16_t L3452_i_;
        int16_t L3451_i_;
        int16_t L3450_i_;
        int16_t L3458_i_;
        int16_t L3459_i_;
        int16_t L3460_i_;
        REGISTER unsigned int16_t L3453_i_SpaceCharacterIndex;
        REGISTER int16_t L3455_i_;
        int16_t L3456_i_;
#endif
#ifdef MEDIA459_P20JA_P20JB_P31J
        register int16_t L3450_i_; /* register required for PC98 versions */
        register int16_t L3451_i_; /* register required for PC98 versions */
        REGISTER int16_t L3452_i_;
        REGISTER unsigned int16_t L3453_i_SpaceCharacterIndex;
        REGISTER int16_t L3455_i_;
        int16_t L3456_i_;
        int16_t L3457_i_;
        int16_t L3458_i_;
        int16_t L3459_i_;
        int16_t L3460_i_;
#endif


        L3450_i_ = *P2195_pi_CharacterIndex;
        L3452_i_ = 0;
        L3451_i_ = 0;
#ifdef MEDIA464_P20JA_P20JB_I34E_I34M_F31E_F31J_P31J
        L3453_i_SpaceCharacterIndex = 0xFFFF;
#endif
#ifdef MEDIA613_X30J_A36M_A31E_A31M_A33M_A35E_A35M_X31J
        L3453_i_SpaceCharacterIndex = -1;
#endif
#ifdef MEDIA571_F20J_X30J_P20JA_P20JB_F31J_X31J_P31J
        if (F0818_IsJapaneseText(M774_CAST_PUC(P2193_pc_String))) {
                for (;;) { /*_Infinite loop_*/
                        P2194_pc_String[L3452_i_] = 0;
                        if ((P2193_pc_String[L3450_i_] == '\n') || (P2193_pc_String[L3450_i_] == '\0')) {
                                *P2195_pi_CharacterIndex = L3450_i_;
                                return L3451_i_;
                        }
#ifdef MEDIA585_X30J_P20JA_P20JB_F31J_X31J_P31J
                        if ((P2193_pc_String[L3450_i_] == '|')) {
                                L3450_i_++;
                                L3453_i_SpaceCharacterIndex = L3450_i_;
                                L3455_i_ = L3452_i_;
                                L3456_i_ = L3451_i_;
                                continue;
                        }
#endif
#ifdef MEDIA564_F20J
                        L3453_i_SpaceCharacterIndex = L3450_i_;
                        L3458_i_ = F0952_JAPANESE_Print(M774_CAST_PUC(P2193_pc_String), L3450_i_, NULL, &L3459_i_, &L3460_i_, C00_COLOR_BLACK, C00_COLOR_BLACK) - L3453_i_SpaceCharacterIndex;
#endif
#ifdef MEDIA585_X30J_P20JA_P20JB_F31J_X31J_P31J
                        L3457_i_ = L3450_i_;
                        L3458_i_ = F0952_JAPANESE_Print(M774_CAST_PUC(P2193_pc_String), L3450_i_, NULL, &L3459_i_, &L3460_i_, C00_COLOR_BLACK, C00_COLOR_BLACK) - L3457_i_;
#endif
                        if (L3459_i_ + L3451_i_ >= P2196_i_Width)
                                break;
                        L3451_i_ += L3459_i_;
                        if (L3458_i_ == 2) {
                                P2194_pc_String[L3452_i_++] = P2193_pc_String[L3450_i_++];
                        }
                        P2194_pc_String[L3452_i_++] = P2193_pc_String[L3450_i_++];
                };
#endif
#ifdef MEDIA585_X30J_P20JA_P20JB_F31J_X31J_P31J
                if (L3453_i_SpaceCharacterIndex != 0xFFFF) {
                        *P2195_pi_CharacterIndex = L3453_i_SpaceCharacterIndex;
                        P2194_pc_String[L3455_i_] = 0;
                        return L3456_i_;
#ifdef MEDIA607_X30J_X31J
                } else {
                        *P2195_pi_CharacterIndex = L3450_i_;
                        return L3451_i_;
#endif
                }
#endif
#ifdef MEDIA564_F20J
                *P2195_pi_CharacterIndex = L3450_i_;
                return L3451_i_;
#endif
#ifdef MEDIA571_F20J_X30J_P20JA_P20JB_F31J_X31J_P31J
        } else {
#endif
                for (;;) { /*_Infinite loop_*/
                        P2194_pc_String[L3452_i_] = 0;
                        if ((P2193_pc_String[L3450_i_] == '\n') || (P2193_pc_String[L3450_i_] == '\0')) {
                                *P2195_pi_CharacterIndex = L3450_i_;
                                return L3451_i_;
                        }
                        if (P2193_pc_String[L3450_i_] == ' ') {
                                L3453_i_SpaceCharacterIndex = L3450_i_;
                                L3455_i_ = L3452_i_;
                                L3456_i_ = L3451_i_;
                        }
                        if (L3451_i_ + G2087_C6_TextCharacterWidth >= P2196_i_Width) {
                                break;
                        }
                        L3451_i_ += G2087_C6_TextCharacterWidth;
                        P2194_pc_String[L3452_i_++] = P2193_pc_String[L3450_i_++];
#ifdef MEDIA555_F20E_F20J_I34E_I34M_A36M_A31E_A31M_A33M_A35E_A35M_F31E_F31J
                        continue;
#endif
                };
#ifdef MEDIA593_X30J_P20JA_P20JB_I34E_I34M_A36M_A31E_A31M_A33M_A35E_A35M_F31E_F31J_X31J_P31J
                if (L3453_i_SpaceCharacterIndex != 0xFFFF) {
#endif
                        *P2195_pi_CharacterIndex = L3453_i_SpaceCharacterIndex + 1;
#ifdef MEDIA488_F20E_F20J
                        P2194_pc_String[L3452_i_] = 0;
#endif
#ifdef MEDIA593_X30J_P20JA_P20JB_I34E_I34M_A36M_A31E_A31M_A33M_A35E_A35M_F31E_F31J_X31J_P31J
                        P2194_pc_String[L3455_i_] = 0;
#endif
                        return L3456_i_;
#ifdef MEDIA593_X30J_P20JA_P20JB_I34E_I34M_A36M_A31E_A31M_A33M_A35E_A35M_F31E_F31J_X31J_P31J
                }
#endif
#ifdef MEDIA571_F20J_X30J_P20JA_P20JB_F31J_X31J_P31J
        }
#endif
#ifdef MEDIA593_X30J_P20JA_P20JB_I34E_I34M_A36M_A31E_A31M_A33M_A35E_A35M_F31E_F31J_X31J_P31J
        *P2195_pi_CharacterIndex = L3450_i_;
        return L3451_i_;
#endif
}
#endif

#ifdef MEDIA607_X30J_X31J
#include "TEXT2.C"
#endif

void F0040_TEXT_Print(
#ifdef MEDIA008_S10EA_S10EB_S11E_S12E_S12G_S13FA_S13FB_S20E_S21E_G14ED_G20E_G21E
P0050_puc_Bitmap_Destination, P0051_i_ByteWidth, P0052_i_X, P0053_i_Y, P0054_i_TextColor, P0055_i_BackgroundColor, P0056_pc_String)
#endif
#ifdef MEDIA413_A20ED_A20E_A20F_A20G_A21E_A22E_A22G
P0050_puc_Bitmap_Destination, P0051_i_ByteWidth, P0052_i_X, P0053_i_Y, P0054_i_TextColor, P0055_i_BackgroundColor, P0056_pc_String, P0919_i_Height)
#endif
unsigned char*   P0050_puc_Bitmap_Destination SEPARATOR
#ifdef MEDIA009_S10EA_S10EB_S11E_S12E_S12G_S13FA_S13FB_S20E_S21E_G14ED_G20E_G21E_A20ED_A20E_A20F_A20G_A21E_A22E_A22G
int16_t          P0051_i_ByteWidth            SEPARATOR
int16_t          P0052_i_X                    SEPARATOR
int16_t          P0053_i_Y                    SEPARATOR
#endif
#ifdef MEDIA529_F20E_F20J_X30J_P20JA_P20JB_I34E_I34M_A36M_A31E_A31M_A33M_A35E_A35M_F31E_F31J_X31J_P31J
unsigned int16_t P0051_ui_Width               SEPARATOR
int16_t          P2197_i_ZoneIndex            SEPARATOR
#endif
int16_t          P0054_i_TextColor            SEPARATOR
int16_t          P0055_i_BackgroundColor      SEPARATOR
#ifdef MEDIA098_S10EA_S10EB_S11E_S12E_S12G_S13FA_S13FB_S20E_S21E_G14ED_G20E_G21E_F20E_F20J_X30J_P20JA_P20JB_I34E_I34M_F31E_F31J_X31J_P31J
char*            P0056_pc_String              FINAL_SEPARATOR
#endif
#ifdef MEDIA425_A20ED_A20E_A20F_A20G_A21E_A22E_A22G_A36M_A31E_A31M_A33M_A35E_A35M
char*            P0056_pc_String              SEPARATOR
int16_t          P0919_i_Height               FINAL_SEPARATOR
#endif
{
#ifdef MEDIA007_S10EA_S10EB_S11E_S12E_S12G_S13FA_S13FB_S20E_S21E
        asm {
                        movem.l D4-D7/A2-A3,-(A7)
                        movea.l P0050_puc_Bitmap_Destination(A6),A3
                        move.w  P0052_i_X(A6),D7
                        move.w  P0053_i_Y(A6),D6
                        move.w  P0054_i_TextColor(A6),D5
                        move.w  P0055_i_BackgroundColor(A6),D4
                        movea.l P0056_pc_String(A6),A0
                        move.b  (A0),D0                                         /* First character of specified string */
                        bne.s   T0040001                                        /* If the string is not empty */
                        bra     T0040043_Return
                T0040001:
                        move.w  D6,D0
                        subq.w  #4,D0
                        mulu.w  P0051_i_ByteWidth(A6),D0                       /* Width is the number of bytes for one line (e.g. '160' for 320 pixels) */
                        adda.w  D0,A3                                           /* Address of the pixel line where printing will start */
                        move.w  D7,D0                                           /* X coordinate */
                        andi.w  #0xFFF0,D0                                      /* Multiple of 16 pixels */
                        lsr.w   #1,D0                                           /* Number of bytes */
                        adda.w  D0,A3                                           /* Address of the first word where printing will start */
                        moveq   #0x0F,D3
                        and.w   D7,D3                                           /* Index of the first bit / pixel to modify in the word */
                        move.w  D5,D1                                           /* Text color */
                        add.w   D5,D5
                        add.w   D1,D5
                        add.w   D5,D5                                           /* 6 * Text color (Each entry in the jumptable below is 6 bytes large) */
                        jmp     2(PC,D5.w)
                T0040002:
                        lea     T0040025_TextColor0(PC),A0
                        bra.s   T0040003_SwitchTextColor
                        lea     T0040010_TextColor1(PC),A0
                        bra.s   T0040003_SwitchTextColor
                        lea     T0040011_TextColor2(PC),A0
                        bra.s   T0040003_SwitchTextColor
                        lea     T0040012_TextColor3(PC),A0
                        bra.s   T0040003_SwitchTextColor
                        lea     T0040013_TextColor4(PC),A0
                        bra.s   T0040003_SwitchTextColor
                        lea     T0040014_TextColor5(PC),A0
                        bra.s   T0040003_SwitchTextColor
                        lea     T0040015_TextColor6(PC),A0
                        bra.s   T0040003_SwitchTextColor
                        lea     T0040016_TextColor7(PC),A0
                        bra.s   T0040003_SwitchTextColor
                        lea     T0040017_TextColor8(PC),A0
                        bra.s   T0040003_SwitchTextColor
                        lea     T0040018_TextColor9(PC),A0
                        bra.s   T0040003_SwitchTextColor
                        lea     T0040019_TextColor10(PC),A0
                        bra.s   T0040003_SwitchTextColor
                        lea     T0040020_TextColor11(PC),A0
                        bra.s   T0040003_SwitchTextColor
                        lea     T0040021_TextColor12(PC),A0
                        bra.s   T0040003_SwitchTextColor
                        lea     T0040022_TextColor13(PC),A0
                        bra.s   T0040003_SwitchTextColor
                        lea     T0040023_TextColor14(PC),A0
                        bra.s   T0040003_SwitchTextColor
                        lea     T0040024_TextColor15(PC),A0
                T0040003_SwitchTextColor:
                        move.w  D4,D1                                           /* Background color */
                        add.w   D4,D4
                        add.w   D1,D4
                        add.w   D4,D4                                           /* 6 * Background color (Each entry in the jumptable below is 6 bytes large) */
                        jmp     2(PC,D4.w)
                T0040004_SwitchBackgroundColor:
                        lea     T0040041_BackgroundColor0(PC),A1
                        bra.s   T0040005_Loop
                        lea     T0040026_BackgroundColor1(PC),A1
                        bra.s   T0040005_Loop
                        lea     T0040027_BackgroundColor2(PC),A1
                        bra.s   T0040005_Loop
                        lea     T0040028_BackgroundColor3(PC),A1
                        bra.s   T0040005_Loop
                        lea     T0040029_BackgroundColor4(PC),A1
                        bra.s   T0040005_Loop
                        lea     T0040030_BackgroundColor5(PC),A1
                        bra.s   T0040005_Loop
                        lea     T0040031_BackgroundColor6(PC),A1
                        bra.s   T0040005_Loop
                        lea     T0040032_BackgroundColor7(PC),A1
                        bra.s   T0040005_Loop
                        lea     T0040033_BackgroundColor8(PC),A1
                        bra.s   T0040005_Loop
                        lea     T0040034_BackgroundColor9(PC),A1
                        bra.s   T0040005_Loop
                        lea     T0040035_BackgroundColor10(PC),A1
                        bra.s   T0040005_Loop
                        lea     T0040036_BackgroundColor11(PC),A1
                        bra.s   T0040005_Loop
                        lea     T0040037_BackgroundColor12(PC),A1
                        bra.s   T0040005_Loop
                        lea     T0040038_BackgroundColor13(PC),A1
                        bra.s   T0040005_Loop
                        lea     T0040039_BackgroundColor14(PC),A1
                        bra.s   T0040005_Loop
                        lea     T0040040_BackgroundColor15(PC),A1
                T0040005_Loop:
                        moveq   #0,D2
                        movea.l P0056_pc_String(A6),A2
                        move.b  (A2),D2                                         /* Next character in the specified string */
                        beq     T0040043_Return                                 /* If this is the end of the string */
                        addq.l  #1,P0056_pc_String(A6)                           /* Proceed to the next character in the specified string */
                        movea.l G0357_puc_InterfaceAndScrollsFont(A4),A2
                        lea     0(A2,D2.w),A2                                   /* Address of the character in the font (top left corner) */
                        cmp.w   #11,D3                                          /* If bit index to modify in word > 11. If character is across two words (the width of each character is 5 bits per pixels) */
                        bhi.s   T0040006_CharacterSpans2Words
                        moveq   #6,D4
                        move.l  #0x07FF07FF,D2                                  /* Mask with 5 bits clear */
                        ror.l   D3,D2                                           /* Rotate bits in D2 to the right by D3 cells. The bits shifted out to the right are shifted in to the left. Rotate the bits so that the 5 clear bits are cellned correctly */
                        moveq   #0,D5
                        move.l  A3,-(A7)
                        bsr.s   T0040007_PrintCharacter
                        movea.l (A7)+,A3
                        addq.w  #6,D3                                           /* Proceed to the next character cell (5 bits per character + 1 bit for spacing) */
                        cmpi.w  #16,D3
                        bcs.s   T0040005_Loop                                   /* If still in the same word */
                        andi.w  #0x0001,D3                                      /* D3 = 16 or 17 (before). D3 = 0 or 1 (after) */
                        addq.l  #8,A3                                           /* Proceed to the next set of 4 words (16 pixels) */
                        bra.s   T0040005_Loop
                T0040006_CharacterSpans2Words:
                        moveq   #6,D4
                        move.l  A3,-(A7)
                        addq.l  #8,(A7)
                        move.l  A2,-(A7)
                        lsl.w   #2,D3                                           /* D3 is 12..15 (before). D3 is 48..60 (after) */
                        lea     G0064_al_Graphic562_PrintTextMasks2-48(A4),A2
                        move.l  0(A2,D3.w),D2
                        lea     G0065_al_Graphic562_PrintTextMasks1-48(A4),A2
                        move.l  0(A2,D3.w),-(A7)
                        lsr.w   #2,D3
                        movea.l 4(A7),A2
                        moveq   #0x08,D5
                        bsr.s   T0040007_PrintCharacter
                        move.l  (A7)+,D2
                        movea.l (A7)+,A2
                        movea.l (A7),A3
                        moveq   #0x06,D4
                        moveq   #0x12,D5
                        bsr.s   T0040007_PrintCharacter
                        movea.l (A7)+,A3
                        subi.w  #0x000A,D3
                        bra.s   T0040005_Loop
                T0040007_PrintCharacter:
                        and.l   D2,(A3)
                        and.l   D2,4(A3)
                        moveq   #0,D0
                        move.b  (A2),D0
                        jmp     2(PC,D5.w)
                T0040008:
                        moveq   #0x0B,D1
                        sub.w   D3,D1
                        lsl.w   D1,D0
                        bra.s   T0040009
                        move.w  D3,D1
                        subi.w  #0x000B,D1
                        lsr.w   D1,D0
                        bra.s   T0040009
                        moveq   #0x1B,D1
                        sub.w   D3,D1
                        lsl.w   D1,D0
                T0040009:
                        move.w  D0,D1
                        swap    D1
                        move.w  D0,D1
                        swap    D0
                        moveq   #0,D6
                        moveq   #0,D7
                        jmp     (A0)
                T0040010_TextColor1:
                        move.l  D0,D6
                        bra.s   T0040025_TextColor0
                T0040011_TextColor2:
                        move.w  D1,D6
                        bra.s   T0040025_TextColor0
                T0040012_TextColor3:
                        move.l  D1,D6
                        bra.s   T0040025_TextColor0
                T0040013_TextColor4:
                        move.l  D0,D7
                        bra.s   T0040025_TextColor0
                T0040014_TextColor5:
                        move.l  D0,D6
                        move.l  D0,D7
                        bra.s   T0040025_TextColor0
                T0040015_TextColor6:
                        move.w  D1,D6
                        move.l  D0,D7
                        bra.s   T0040025_TextColor0
                T0040016_TextColor7:
                        move.l  D1,D6
                        move.l  D0,D7
                        bra.s   T0040025_TextColor0
                T0040017_TextColor8:
                        move.w  D1,D7
                        bra.s   T0040025_TextColor0
                T0040018_TextColor9:
                        move.l  D0,D6
                        move.w  D1,D7
                        bra.s   T0040025_TextColor0
                T0040019_TextColor10:
                        move.w  D1,D6
                        move.w  D1,D7
                        bra.s   T0040025_TextColor0
                T0040020_TextColor11:
                        move.l  D1,D6
                        move.w  D1,D7
                        bra.s   T0040025_TextColor0
                T0040021_TextColor12:
                        move.l  D1,D7
                        bra.s   T0040025_TextColor0
                T0040022_TextColor13:
                        move.l  D0,D6
                        move.l  D1,D7
                        bra.s   T0040025_TextColor0
                T0040023_TextColor14:
                        move.w  D1,D6
                        move.l  D1,D7
                        bra.s   T0040025_TextColor0
                T0040024_TextColor15:
                        move.l  D1,D6
                        move.l  D1,D7
                T0040025_TextColor0:
                        or.l    D2,D0
                        not.l   D0
                        clr.w   D0
                        or.l    D2,D1
                        not.l   D1
                        jmp     (A1)
                T0040026_BackgroundColor1:
                        or.l    D0,D6
                        bra.s   T0040041_BackgroundColor0
                T0040027_BackgroundColor2:
                        or.w    D1,D6
                        bra.s   T0040041_BackgroundColor0
                T0040028_BackgroundColor3:
                        or.l    D1,D6
                        bra.s   T0040041_BackgroundColor0
                T0040029_BackgroundColor4:
                        or.l    D0,D7
                        bra.s   T0040041_BackgroundColor0
                T0040030_BackgroundColor5:
                        or.l    D0,D6
                        or.l    D0,D7
                        bra.s   T0040041_BackgroundColor0
                T0040031_BackgroundColor6:
                        or.w    D1,D6
                        or.l    D0,D7
                        bra.s   T0040041_BackgroundColor0
                T0040032_BackgroundColor7:
                        or.l    D1,D6
                        or.l    D0,D7
                        bra.s   T0040041_BackgroundColor0
                T0040033_BackgroundColor8:
                        or.w    D1,D7
                        bra.s   T0040041_BackgroundColor0
                T0040034_BackgroundColor9:
                        or.l    D0,D6
                        or.w    D1,D7
                        bra.s   T0040041_BackgroundColor0
                T0040035_BackgroundColor10:
                        or.w    D1,D6
                        or.w    D1,D7
                        bra.s   T0040041_BackgroundColor0
                T0040036_BackgroundColor11:
                        or.l    D1,D6
                        or.w    D1,D7
                        bra.s   T0040041_BackgroundColor0
                T0040037_BackgroundColor12:
                        or.l    D1,D7
                        bra.s   T0040041_BackgroundColor0
                T0040038_BackgroundColor13:
                        or.l    D0,D6
                        or.l    D1,D7
                        bra.s   T0040041_BackgroundColor0
                T0040039_BackgroundColor14:
                        or.w    D1,D6
                        or.l    D1,D7
                        bra.s   T0040041_BackgroundColor0
                T0040040_BackgroundColor15:
                        or.l    D1,D6
                        or.l    D1,D7
                T0040041_BackgroundColor0:
                        or.l    D6,(A3)
                        or.l    D7,4(A3)
                        subq.w  #1,D4
                        bne.s   T0040042
                        rts
                T0040042:
                        lea     128(A2),A2
                        adda.w  P0051_i_ByteWidth(A6),A3                        /* Width is the number of bytes for one line (e.g. '160' for 320 pixels) */
                        bra     T0040007_PrintCharacter
                T0040043_Return:
                        movem.l (A7)+,D4-D7/A2-A3
        }
#endif
#ifdef MEDIA413_A20ED_A20E_A20F_A20G_A21E_A22E_A22G
        if (*P0056_pc_String == '\0') {
                return;
        }
        ;
        AztecCDirective_asm
                T0040044:
                        movem.l d4-d7/a2-a6,-(sp)
                        movea.l 8(a5),a3                ; P0050_puc_Bitmap_Destination
                        move.w  14(a5),d7               ; P0052_i_X
                        move.w  16(a5),d6               ; P0053_i_Y
                        move.w  18(a5),d5               ; P0054_i_TextColor
                        move.w  20(a5),d4               ; P0055_i_BackgroundColor
                        moveq   #0,d1
                        move.w  12(a5),d1               ; P0051_i_ByteWidth
                        lsr.w   #2,d1
                        move.w  d1,12(a5)               ; P0051_i_ByteWidth
                        move.w  d6,d0
                        subq.w  #4,d0
                        mulu.w  d1,d0
                        adda.w  d0,a3
                        move.w  d7,d0
                        andi.w  #$FFF0,d0
                        lsr.w   #3,d0
                        adda.w  d0,a3
                        move.w  d7,d3
                        andi.w  #$F,d3
                        mulu.w  26(a5),d1               ; P0919_i_Height
                        movea.w d1,a6
                        lsl.w   #3,d5
                        addq.w  #2,d5
                        jmp     (pc,d5.w)
                        lea     T0040065,a0             ; Text color #0
                        nop
                        bra.s   T0040045
                        lea     T0040050,a0             ; Text color #1
                        nop
                        bra.s   T0040045
                        lea     T0040051,a0             ; Text color #2
                        nop
                        bra.s   T0040045
                        lea     T0040052,a0             ; Text color #3
                        nop
                        bra.s   T0040045
                        lea     T0040053,a0             ; Text color #4
                        nop
                        bra.s   T0040045
                        lea     T0040054,a0             ; Text color #5
                        nop
                        bra.s   T0040045
                        lea     T0040055,a0             ; Text color #6
                        nop
                        bra.s   T0040045
                        lea     T0040056,a0             ; Text color #7
                        nop
                        bra.s   T0040045
                        lea     T0040057,a0             ; Text color #8
                        nop
                        bra.s   T0040045
                        lea     T0040058,a0             ; Text color #9
                        nop
                        bra.s   T0040045
                        lea     T0040059,a0             ; Text color #10
                        nop
                        bra.s   T0040045
                        lea     T0040060,a0             ; Text color #11
                        nop
                        bra.s   T0040045
                        lea     T0040061,a0             ; Text color #12
                        nop
                        bra.s   T0040045
                        lea     T0040062,a0             ; Text color #13
                        nop
                        bra.s   T0040045
                        lea     T0040063,a0             ; Text color #14
                        nop
                        bra.s   T0040045
                        lea     T0040064,a0             ; Text color #15
                T0040045:
                        lsl.w   #3,d4
                        addq.w  #2,d4
                        jmp     (pc,d4.w)
                        lea     T0040081,a1             ; Background color #0
                        nop
                        bra.s   T0040046
                        lea     T0040066,a1             ; Background color #1
                        nop
                        bra.s   T0040046
                        lea     T0040067,a1             ; Background color #2
                        nop
                        bra.s   T0040046
                        lea     T0040068,a1             ; Background color #3
                        nop
                        bra.s   T0040046
                        lea     T0040069,a1             ; Background color #4
                        nop
                        bra.s   T0040046
                        lea     T0040070,a1             ; Background color #5
                        nop
                        bra.s   T0040046
                        lea     T0040071,a1             ; Background color #6
                        nop
                        bra.s   T0040046
                        lea     T0040072,a1             ; Background color #7
                        nop
                        bra.s   T0040046
                        lea     T0040073,a1             ; Background color #8
                        nop
                        bra.s   T0040046
                        lea     T0040074,a1             ; Background color #9
                        nop
                        bra.s   T0040046
                        lea     T0040075,a1             ; Background color #10
                        nop
                        bra.s   T0040046
                        lea     T0040076,a1             ; Background color #11
                        nop
                        bra.s   T0040046
                        lea     T0040077,a1             ; Background color #12
                        nop
                        bra.s   T0040046
                        lea     T0040078,a1             ; Background color #13
                        nop
                        bra.s   T0040046
                        lea     T0040079,a1             ; Background color #14
                        nop
                        bra.s   T0040046
                        lea     T0040080,a1             ; Background color #15
                T0040046:
                        moveq   #0,d2
                        movea.l 22(a5),a2               ; P0056_pc_String
                        move.b  (a2),d2
                        beq     T0040083
                        addq.l  #1,22(a5)               ; P0056_pc_String
                        lea     _G1103_auc_InterfaceAndScrollsFo,a2
                        lea     (a2,d2.w),a2
                        cmp.w   #$B,d3
                        bhi.s   T0040047                ; If the 5 pixels of a character are not in the same word
                        moveq   #6,d4
                        move.l  #$7FF07FF,d2            ; Use mask with 5 clear bits
                        ror.l   d3,d2                   ; Adjust mask to position
                        moveq   #0,d5
                        move.l  a3,-(sp)
                        bsr.s   T0040048
                        movea.l (sp)+,a3
                        addq.w  #6,d3
                        cmpi.w  #$10,d3
                        bcs.s   T0040046
                        andi.w  #1,d3
                        addq.l  #2,a3
                        bra.s   T0040046
                T0040047:
                        moveq   #6,d4
                        move.l  a3,-(sp)
                        addq.l  #2,(sp)
                        move.l  a2,-(sp)
                        move.l  d3,-(sp)
                        sub.w   #$C,d3
                        lsl.w   #2,d3
                        lea     _G0064_al_Graphic562_PrintTextMa,a2
                        move.l  (a2,d3.w),d2
                        lea     _G0065_al_Graphic562_PrintTextMa,a2
                        move.l  (a2,d3.w),d5
                        move.l  (sp)+,d3
                        movea.l (sp),a2
                        move.l  d5,-(sp)
                        moveq   #8,d5
                        bsr.s   T0040048
                        move.l  (sp)+,d2
                        movea.l (sp)+,a2
                        movea.l (sp),a3
                        moveq   #6,d4
                        moveq   #$12,d5
                        bsr.s   T0040048
                        movea.l (sp)+,a3
                        subi.w  #$A,d3
                        bra.s   T0040046
                T0040048:                               ; Print a character subroutine
                        move.l  a3,-(sp)
                        and.w   d2,(a3)
                        adda.l  a6,a3
                        and.w   d2,(a3)
                        adda.l  a6,a3
                        and.w   d2,(a3)
                        adda.l  a6,a3
                        and.w   d2,(a3)
                        movea.l (sp)+,a3
                        moveq   #0,d0
                        move.b  (a2),d0
                        addq.w  #2,d5
                        jmp     (pc,d5.w)
                        moveq   #$B,d1
                        sub.w   d3,d1
                        lsl.w   d1,d0
                        bra.s   T0040049
                        move.w  d3,d1
                        subi.w  #$B,d1
                        lsr.w   d1,d0
                        bra.s   T0040049
                        moveq   #$1B,d1
                        sub.w   d3,d1
                        lsl.w   d1,d0
                T0040049:
                        subq.w  #2,d5
                        move.w  d0,d1
                        swap    d1
                        move.w  d0,d1
                        swap    d0
                        moveq   #0,d6
                        moveq   #0,d7
                        jmp     (a0)
                T0040050:
                        move.l  d0,d6
                        bra.s   T0040065
                T0040051:
                        move.w  d1,d6
                        bra.s   T0040065
                T0040052:
                        move.l  d1,d6
                        bra.s   T0040065
                T0040053:
                        move.l  d0,d7
                        bra.s   T0040065
                T0040054:
                        move.l  d0,d6
                        move.l  d0,d7
                        bra.s   T0040065
                T0040055:
                        move.w  d1,d6
                        move.l  d0,d7
                        bra.s   T0040065
                T0040056:
                        move.l  d1,d6
                        move.l  d0,d7
                        bra.s   T0040065
                T0040057:
                        move.w  d1,d7
                        bra.s   T0040065
                T0040058:
                        move.l  d0,d6
                        move.w  d1,d7
                        bra.s   T0040065
                T0040059:
                        move.w  d1,d6
                        move.w  d1,d7
                        bra.s   T0040065
                T0040060:
                        move.l  d1,d6
                        move.w  d1,d7
                        bra.s   T0040065
                T0040061:
                        move.l  d1,d7
                        bra.s   T0040065
                T0040062:
                        move.l  d0,d6
                        move.l  d1,d7
                        bra.s   T0040065
                T0040063:
                        move.w  d1,d6
                        move.l  d1,d7
                        bra.s   T0040065
                T0040064:
                        move.l  d1,d6
                        move.l  d1,d7
                T0040065:
                        or.l    d2,d0
                        not.l   d0
                        clr.w   d0
                        or.l    d2,d1
                        not.l   d1
                        jmp     (a1)
                T0040066:
                        or.l    d0,d6
                        bra.s   T0040081
                T0040067:
                        or.w    d1,d6
                        bra.s   T0040081
                T0040068:
                        or.l    d1,d6
                        bra.s   T0040081
                T0040069:
                        or.l    d0,d7
                        bra.s   T0040081
                T0040070:
                        or.l    d0,d6
                        or.l    d0,d7
                        bra.s   T0040081
                T0040071:
                        or.w    d1,d6
                        or.l    d0,d7
                        bra.s   T0040081
                T0040072:
                        or.l    d1,d6
                        or.l    d0,d7
                        bra.s   T0040081
                T0040073:
                        or.w    d1,d7
                        bra.s   T0040081
                T0040074:
                        or.l    d0,d6
                        or.w    d1,d7
                        bra.s   T0040081
                T0040075:
                        or.w    d1,d6
                        or.w    d1,d7
                        bra.s   T0040081
                T0040076:
                        or.l    d1,d6
                        or.w    d1,d7
                        bra.s   T0040081
                T0040077:
                        or.l    d1,d7
                        bra.s   T0040081
                T0040078:
                        or.l    d0,d6
                        or.l    d1,d7
                        bra.s   T0040081
                T0040079:
                        or.w    d1,d6
                        or.l    d1,d7
                        bra.s   T0040081
                T0040080:
                        or.l    d1,d6
                        or.l    d1,d7
                T0040081:
                        move.l  a3,-(sp)
                        swap    d6
                        or.w    d6,(a3)
                        swap    d6
                        adda.l  a6,a3
                        or.w    d6,(a3)
                        swap    d7
                        adda.l  a6,a3
                        or.w    d7,(a3)
                        swap    d7
                        adda.l  a6,a3
                        or.w    d7,(a3)
                        movea.l (sp)+,a3
                        subq.w  #1,d4
                        bne.s   T0040082
                        rts
                T0040082:
                        lea     $80(a2),a2
                        adda.w  12(a5),a3               ; P0051_i_ByteWidth
                        bra     T0040048
                T0040083:
                        movem.l (sp)+,d4-d7/a2-a6
                public _G0064_al_Graphic562_PrintTextMa
                public _G0065_al_Graphic562_PrintTextMa
        AztecCDirective_endasm
#endif
#ifdef MEDIA351_G14ED_G20E_G21E
        unsigned char* L6243_;
        unsigned char* L6234_puc_Address;
        unsigned char* L6244_;
        unsigned char* L6240_;
        char L6235_c_TextColor2;
        char L6236_c_TextColor1;
        char L6237_c_BackgroundColor2;
        char L6238_c_BackgroundColor1;
        char L6241_;
        char L6242_;
        int16_t L6239_i_CharacterIndex;
        int16_t L6245_;


        if (!*P0056_pc_String) {
                return;
        }
        L6234_puc_Address = P0050_puc_Bitmap_Destination + ((P0053_i_Y - 4) * P0051_i_ByteWidth);
        asm {
                        SEP        #0x30
                        LDA        P0054_i_TextColor
                        AND        #0x0f
                        STA        L6236_c_TextColor1
                        ASL        A
                        ASL        A
                        ASL        A
                        ASL        A
                        STA        L6235_c_TextColor2
                        LDA        P0055_i_BackgroundColor
                        AND        #0x0f
                        STA        L6238_c_BackgroundColor1
                        ASL        A
                        ASL        A
                        ASL        A
                        ASL        A
                        STA        L6237_c_BackgroundColor2
                        REP        #0x30
                        STZ        L6239_i_CharacterIndex
                L083DA2:
                        LDY        L6239_i_CharacterIndex
                        LDA        [P0056_pc_String],Y
                        AND        #0xff
                        BNE        L083DAE              /* If not end of string */
                        BRL        L083E75              /* If end of string */
                L083DAE:
                        CLC
                        ADC        #G1103_auc_InterfaceAndScrollsFont
                        STA        L6240_
                        LDA        #^G1103_auc_InterfaceAndScrollsFont
                        ADC        #0x00
                        STA        L6240_+2
                        LDA        P0052_i_X
                        LSR        A
                        CLC
                        ADC        L6234_puc_Address
                        STA        L6243_
                        LDA        L6234_puc_Address+2
                        ADC        #0x00
                        STA        L6243_+2
                        STZ        L6245_
                L083DCD:
                        LDA        L6243_
                        STA        L6244_
                        LDA        L6243_+2
                        STA        L6244_+2
                        SEP        #0x30
                        STZ        L6242_
                        LDA        P0052_i_X
                        LSR        A
                        ROR        L6242_
                        LDX        #0x04
                        LDA        #0x01
                L083DE2:
                        ASL        A
                        DEX
                        BNE        L083DE2
                        STA        L6241_
                L083DE8:
                        LDA        [L6240_]
                        AND        L6241_
                        BEQ        L083E02
                        LDA        L6242_
                        BEQ        L083DFA
                        LDA        [L6243_]
                        AND        #0xf0
                        ORA        L6236_c_TextColor1
                        BRA        L083E14
                L083DFA:
                        LDA        [L6243_]
                        AND        #0x0f
                        ORA        L6235_c_TextColor2
                        BRA        L083E14      /* BUGX_XX G14ED: The target of the wrong BEQ instruction below is after the BRA instruction byte, pointing to the offset of L083E14 which is not an instruction */
                L083E02:
                        LDA        L6242_
                        BEQ        L083E0E
                        LDA        [L6243_]
                        AND        #0xf0
                        ORA        L6238_c_BackgroundColor1
                        BRA        L083E14
                L083E0E:
                        LDA        [L6243_]
                        AND        #0x0f
                        ORA        L6237_c_BackgroundColor2
                L083E14:
                        STA        [L6243_]
                        LDA        L6242_
                        EOR        #0x80
                        STA        L6242_
                        BNE        L083E26
                        REP        #0x30
                        INC        L6243_
                        BNE        L083E26
                        INC        L6243_+2
                L083E26:
                        SEP        #0x30
                        LSR        L6241_
                        BNE        L083DE8
                        LDA        L6242_
#ifdef MEDIA349_G14ED
                        BEQ        L083E38      /* ANOMALY_IIGS BUGX_XX: Target is in middle of BRA instruction. This can't be achived with the inline assembler because it does not accept the constant operand *-0x2f. It also does not accept an offset from label like L083DFA+7. A target label is required as the operand. */
#endif
#ifdef MEDIA388_G20E_G21E
                        BEQ        L083E38
#endif
                        LDA        [L6243_]
                        AND        #0xf0
                        ORA        L6238_c_BackgroundColor1
                        BRA        L083E3E
                L083E38:
                        LDA        [L6243_]
                        AND        #0x0f
                        ORA        L6237_c_BackgroundColor2
                L083E3E:
                        STA        [L6243_]
                        REP        #0x30
                        CLC
                        LDA        L6240_
                        ADC        #0x80
                        STA        L6240_
                        BCC        L083E4E
                        INC        L6240_+2
                L083E4E:
                        CLC
                        LDA        L6244_
                        ADC        P0051_i_ByteWidth
                        STA        L6243_
                        LDA        L6244_+2
                        ADC        #0x00
                        STA        L6243_+2
                        INC        L6245_
                        LDA        L6245_
                        CMP        #0x06
                        BCS        L083E68
                        BRL        L083DCD
                L083E68:
                        CLC
                        LDA        P0052_i_X
                        ADC        #0x06
                        STA        P0052_i_X
                        INC        L6239_i_CharacterIndex
                        BRL        L083DA2
                L083E75:
                        REP        #0x30
        }
#endif
#ifdef MEDIA529_F20E_F20J_X30J_P20JA_P20JB_I34E_I34M_A36M_A31E_A31M_A33M_A35E_A35M_F31E_F31J_X31J_P31J
        int16_t L3461_i_Width;
        int16_t L3462_i_Height;
        int16_t L3463_ai_XYZ[4];


        if (F0645_GetStringPixelDimensions(P0056_pc_String, &L3461_i_Width, &L3462_i_Height)) {
                if (F0635_(NULL, L3463_ai_XYZ, P2197_i_ZoneIndex, &L3461_i_Width, &L3462_i_Height)) {
                        M720_F0644_PrintTextAlt(P0050_puc_Bitmap_Destination, P0051_ui_Width, M704_ZONE_LEFT(L3463_ai_XYZ), M707_ZONE_BOTTOM(L3463_ai_XYZ), P0054_i_TextColor, P0055_i_BackgroundColor, P0056_pc_String, P0919_i_Height);
                }
        }
#endif
}

void F0041_TEXT_PrintWithTrailingSpaces(
#ifdef MEDIA008_S10EA_S10EB_S11E_S12E_S12G_S13FA_S13FB_S20E_S21E_G14ED_G20E_G21E
P0057_puc_Bitmap_Destination, P0058_i_ByteWidth, P0059_i_X, P0060_i_Y, P0061_i_TextColor, P0062_i_BackgroundColor, P0063_pc_String, P0064_i_StringLength)
#endif
#ifdef MEDIA413_A20ED_A20E_A20F_A20G_A21E_A22E_A22G
P0057_puc_Bitmap_Destination, P0058_i_ByteWidth, P0059_i_X, P0060_i_Y, P0061_i_TextColor, P0062_i_BackgroundColor, P0063_pc_String, P0064_i_StringLength, P0920_i_Height)
#endif
unsigned char* P0057_puc_Bitmap_Destination SEPARATOR
int16_t        P0058_i_ByteWidth            SEPARATOR
int16_t        P0059_i_X                    SEPARATOR
int16_t        P0060_i_Y                    SEPARATOR
int16_t        P0061_i_TextColor            SEPARATOR
int16_t        P0062_i_BackgroundColor      SEPARATOR
REGISTER char* P0063_pc_String              SEPARATOR
#ifdef MEDIA098_S10EA_S10EB_S11E_S12E_S12G_S13FA_S13FB_S20E_S21E_G14ED_G20E_G21E_F20E_F20J_X30J_P20JA_P20JB_I34E_I34M_F31E_F31J_X31J_P31J
int16_t        P0064_i_StringLength         FINAL_SEPARATOR
#endif
#ifdef MEDIA425_A20ED_A20E_A20F_A20G_A21E_A22E_A22G_A36M_A31E_A31M_A33M_A35E_A35M
int16_t        P0064_i_StringLength         SEPARATOR
int16_t        P0920_i_Height               FINAL_SEPARATOR
#endif
{
        char L0022_ac_String[80];
        REGISTER int16_t L0021_i_CharacterIndex;


        L0021_i_CharacterIndex = 0;
        while (L0022_ac_String[L0021_i_CharacterIndex] = *P0063_pc_String++) {
                L0021_i_CharacterIndex++;
        }
#ifdef MEDIA061_S10EA_S10EB_S11E_S12E_S12G_S13FA_S13FB_S20E_S21E_G14ED_G20E_G21E_A20ED_A20E_A20F_A20G_A21E_A22E_A22G_F20E_I34E_I34M_A36M_A31E_A31M_A33M_A35E_A35M_F31E
        for (; L0021_i_CharacterIndex < P0064_i_StringLength; L0021_i_CharacterIndex++) {
                L0022_ac_String[L0021_i_CharacterIndex] = ' ';
        }
#endif
        L0022_ac_String[L0021_i_CharacterIndex] = '\0';
#ifdef MEDIA009_S10EA_S10EB_S11E_S12E_S12G_S13FA_S13FB_S20E_S21E_G14ED_G20E_G21E_A20ED_A20E_A20F_A20G_A21E_A22E_A22G
        M521_F0040_TEXT_Print(P0057_puc_Bitmap_Destination, P0058_i_ByteWidth, P0059_i_X, P0060_i_Y, P0061_i_TextColor, P0062_i_BackgroundColor, L0022_ac_String, P0920_i_Height);
#endif
#ifdef MEDIA529_F20E_F20J_X30J_P20JA_P20JB_I34E_I34M_A36M_A31E_A31M_A33M_A35E_A35M_F31E_F31J_X31J_P31J
        M720_F0644_PrintTextAlt(P0057_puc_Bitmap_Destination, P0058_i_ByteWidth, P0059_i_X, P0060_i_Y, P0061_i_TextColor, P0062_i_BackgroundColor, L0022_ac_String, P0920_i_Height);
#endif
}

#ifdef MEDIA529_F20E_F20J_X30J_P20JA_P20JB_I34E_I34M_A36M_A31E_A31M_A33M_A35E_A35M_F31E_F31J_X31J_P31J
void F0768_TEXT_PrintToZoneWithTrailingSpaces(
unsigned char* P0057_puc_Bitmap_Destination SEPARATOR
int16_t        P0058_i_ByteWidth            SEPARATOR
int16_t        P2198_i_ZoneIndex            SEPARATOR
int16_t        P0061_i_TextColor            SEPARATOR
int16_t        P0062_i_BackgroundColor      SEPARATOR
REGISTER char* P0063_pc_String              SEPARATOR
#ifdef MEDIA525_F20E_F20J_X30J_P20JA_P20JB_I34E_I34M_F31E_F31J_X31J_P31J
int16_t        P0064_i_StringLength         FINAL_SEPARATOR
#endif
#ifdef MEDIA746_A36M_A31E_A31M_A33M_A35E_A35M
int16_t        P0064_i_StringLength         SEPARATOR
int16_t        P2756_i_                     FINAL_SEPARATOR
#endif
{
        REGISTER int16_t L0021_i_CharacterIndex;
        char L0022_ac_String[80];


        L0021_i_CharacterIndex = 0;
        while ((L0022_ac_String[L0021_i_CharacterIndex] = *P0063_pc_String++)) {
                L0021_i_CharacterIndex++;
        }
#ifdef MEDIA562_F20E_I34E_I34M_A36M_A31E_A31M_A33M_A35E_A35M_F31E
        while (L0021_i_CharacterIndex < P0064_i_StringLength) {
                L0022_ac_String[L0021_i_CharacterIndex] = ' ';
                L0021_i_CharacterIndex++;
        }
#endif
        L0022_ac_String[L0021_i_CharacterIndex] = '\0';
#ifdef MEDIA525_F20E_F20J_X30J_P20JA_P20JB_I34E_I34M_F31E_F31J_X31J_P31J
        F0040_TEXT_Print(P0057_puc_Bitmap_Destination, P0058_i_ByteWidth, P2198_i_ZoneIndex, P0061_i_TextColor, P0062_i_BackgroundColor, L0022_ac_String);
#endif
#ifdef MEDIA746_A36M_A31E_A31M_A33M_A35E_A35M
        F0040_TEXT_Print(P0057_puc_Bitmap_Destination, P0058_i_ByteWidth, P2198_i_ZoneIndex, P0061_i_TextColor, P0062_i_BackgroundColor, L0022_ac_String, P2756_i_);
#endif
}
#endif

void F0042_TEXT_MESSAGEAREA_MoveCursor(
#ifdef MEDIA009_S10EA_S10EB_S11E_S12E_S12G_S13FA_S13FB_S20E_S21E_G14ED_G20E_G21E_A20ED_A20E_A20F_A20G_A21E_A22E_A22G
P0065_i_Column, P0066_i_Row)
#endif
REGISTER int16_t P0065_i_Column SEPARATOR
REGISTER int16_t P0066_i_Row    FINAL_SEPARATOR
{
        if (P0065_i_Column < 0) {
                P0065_i_Column = 0;
#ifdef MEDIA009_S10EA_S10EB_S11E_S12E_S12G_S13FA_S13FB_S20E_S21E_G14ED_G20E_G21E_A20ED_A20E_A20F_A20G_A21E_A22E_A22G
        } else {
                if (P0065_i_Column >= 53) {
                        P0065_i_Column = 52;
                }
#endif
        }
#ifdef MEDIA009_S10EA_S10EB_S11E_S12E_S12G_S13FA_S13FB_S20E_S21E_G14ED_G20E_G21E_A20ED_A20E_A20F_A20G_A21E_A22E_A22G
        G0359_i_MessageAreaCursorColumn = P0065_i_Column;
#endif
#ifdef MEDIA529_F20E_F20J_X30J_P20JA_P20JB_I34E_I34M_A36M_A31E_A31M_A33M_A35E_A35M_F31E_F31J_X31J_P31J
        G0359_i_MessageAreaCursorColumn = F0024_MAIN_GetMinimumValue(P0065_i_Column * G2087_C6_TextCharacterWidth, G2092_MessageAreaWidth - G2087_C6_TextCharacterWidth);
#endif
        if (P0066_i_Row < 0) {
                P0066_i_Row = 0;
        } else {
                if (P0066_i_Row >= M532_MESSAGE_AREA_ROW_COUNT) {
                        P0066_i_Row = M532_MESSAGE_AREA_ROW_COUNT - 1;
                }
        }
        G0358_i_MessageAreaCursorRow = P0066_i_Row;
#ifdef MEDIA375_G14ED_G20E_G21E_F20E_F20J_X30J_P20JA_P20JB_I34E_I34M_F31E_F31J_X31J_P31J
        G0355_B_ScrollMessageArea = C0_FALSE;
#endif
}

void F0043_TEXT_MESSAGEAREA_ClearAllRows(
#ifdef MEDIA529_F20E_F20J_X30J_P20JA_P20JB_I34E_I34M_A36M_A31E_A31M_A33M_A35E_A35M_F31E_F31J_X31J_P31J
void
#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
        REGISTER unsigned int16_t L0023_RowIndex;
#endif
#ifdef MEDIA433_A20E_A20F_A20G_A21E_A22E_A22G
        REGISTER int16_t L0023_RowIndex;
#endif
#ifdef MEDIA008_S10EA_S10EB_S11E_S12E_S12G_S13FA_S13FB_S20E_S21E_G14ED_G20E_G21E
        int16_t L0024_ai_Box[4];


        G0578_B_UseByteBoxCoordinates = C0_FALSE;
        M704_ZONE_LEFT(L0024_ai_Box) = 0;
        M705_ZONE_RIGHT(L0024_ai_Box) = 319;
        M706_ZONE_TOP(L0024_ai_Box) = 169;
        M707_ZONE_BOTTOM(L0024_ai_Box) = 199;
#endif
#ifdef MEDIA173_S10EA_S10EB_S11E_S12E_S12G_S13FA_S13FB_S20E_S21E_A36M_A31E_A31M_A33M_A35E_A35M
        while ((G0354_i_MessageAreaScrollingLineCount >= 0) || G0355_B_ScrollMessageArea);
#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
        F0077_MOUSE_EnableScreenUpdate_CPSE();
#endif
#ifdef MEDIA008_S10EA_S10EB_S11E_S12E_S12G_S13FA_S13FB_S20E_S21E_G14ED_G20E_G21E
        F0135_VIDEO_FillBox(G0348_Bitmap_Screen, L0024_ai_Box, C00_COLOR_BLACK, C160_BYTE_WIDTH_SCREEN);
#endif
#ifdef MEDIA413_A20ED_A20E_A20F_A20G_A21E_A22E_A22G
        F0561_SCROLLER_IsTextScrolling(&G1057_s_TextScroller, C1_TRUE);
        SetAPen(&G0734_ps_AmigaData->RastPort, 0L);
        RectFill(&G0734_ps_AmigaData->RastPort, 0L, 169L, 319L, 199L);
#endif
#ifdef MEDIA529_F20E_F20J_X30J_P20JA_P20JB_I34E_I34M_A36M_A31E_A31M_A33M_A35E_A35M_F31E_F31J_X31J_P31J
        F0733_FillZoneByIndex(C015_ZONE_MESSAGE_AREA, C00_COLOR_BLACK);
#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
        F0078_MOUSE_DisableScreenUpdate();
#endif
#ifdef MEDIA156_S10EA_S10EB_S11E_S12E_S12G_S13FA_S13FB_S20E_S21E_A20E_A20F_A20G_A21E_A22E_A22G
        G0358_i_MessageAreaCursorRow = M532_MESSAGE_AREA_ROW_COUNT - 1;
#endif
#ifdef MEDIA137_S10EA_S10EB_S11E_S12E_S12G_S13FA_S13FB_S20E_S21E_A20ED_A20E_A20F_A20G_A21E_A22E_A22G
        G0359_i_MessageAreaCursorColumn = 0;
#endif
#ifdef MEDIA410_A20ED
        G0358_i_MessageAreaCursorRow = 0;
#endif
#ifdef MEDIA376_G14ED_G20E_G21E_F20E_F20J_X30J_P20JA_P20JB_I34E_I34M_A36M_A31E_A31M_A33M_A35E_A35M_F31E_F31J_X31J_P31J
        F0042_TEXT_MESSAGEAREA_MoveCursor(0, M532_MESSAGE_AREA_ROW_COUNT - 1);
#endif
#ifdef MEDIA093_S10EA_S10EB_S11E_S12E_S12G_S13FA_S13FB_S20E_S21E_G14ED_G20E_G21E_A20E_A20F_A20G_A21E_A22E_A22G_F20E_F20J_X30J_P20JA_P20JB_I34E_I34M_A36M_A31E_A31M_A33M_A35E_A35M_F31E_F31J_X31J_P31J
        for (L0023_RowIndex = 0; L0023_RowIndex < M532_MESSAGE_AREA_ROW_COUNT; L0023_RowIndex++) {
                G0360_al_MessageAreaRowExpirationTime[L0023_RowIndex] = -1;
        }
#endif
}

#ifdef MEDIA413_A20ED_A20E_A20F_A20G_A21E_A22E_A22G
void F0553_TEXT_MESSAGEAREA_MoveCursorToTopLeft(
)
{
        G0359_i_MessageAreaCursorColumn = 0;
        G0358_i_MessageAreaCursorRow = 0;
}
#endif

void F0044_TEXT_MESSAGEAREA_ClearExpiredRows(
#ifdef MEDIA529_F20E_F20J_X30J_P20JA_P20JB_I34E_I34M_A36M_A31E_A31M_A33M_A35E_A35M_F31E_F31J_X31J_P31J
void
#endif
)
{
#ifdef MEDIA092_S10EA_S10EB_S11E_S12E_S12G_S13FA_S13FB_S20E_S21E_G14ED_G20E_G21E_A20E_A20F_A20G_A21E_A22E_A22G
        REGISTER int16_t L0025_i_Unreferenced; /* BUG0_00 Useless code */
#endif
        REGISTER unsigned int16_t L0026_ui_RowIndex;
        REGISTER long L0027_l_ExpirationTime;
#ifdef MEDIA092_S10EA_S10EB_S11E_S12E_S12G_S13FA_S13FB_S20E_S21E_G14ED_G20E_G21E_A20E_A20F_A20G_A21E_A22E_A22G
        int16_t L0028_ai_Box[4];
#endif
#ifdef MEDIA529_F20E_F20J_X30J_P20JA_P20JB_I34E_I34M_A36M_A31E_A31M_A33M_A35E_A35M_F31E_F31J_X31J_P31J
        int16_t L0028_ai_XYZ[4];
        REGISTER int16_t L3464_i_ZoneYBackup;
#endif


#ifdef MEDIA410_A20ED
        L0027_l_ExpirationTime = G0360_al_MessageAreaRowExpirationTime[0];
        if ((L0027_l_ExpirationTime == -1) || (L0027_l_ExpirationTime > G0313_ul_GameTime)) {
                return;
        }
        F0561_SCROLLER_IsTextScrolling(&G1057_s_TextScroller, C1_TRUE);
        F0008_MAIN_ClearBytes(G0356_puc_Bitmap_MessageAreaNewRow, M075_BITMAP_BYTE_COUNT(320, 7));
        F0560_SCROLLER_SetCommand(&G1057_s_TextScroller, 1);
        if (G0358_i_MessageAreaCursorRow == 0) {
                G0359_i_MessageAreaCursorColumn = 0;
        } else {
                G0358_i_MessageAreaCursorRow--;
        }
        for (L0026_ui_RowIndex = 0; L0026_ui_RowIndex < M532_MESSAGE_AREA_ROW_COUNT - 1; L0026_ui_RowIndex++) {
                G0360_al_MessageAreaRowExpirationTime[L0026_ui_RowIndex] = G0360_al_MessageAreaRowExpirationTime[L0026_ui_RowIndex + 1];
        }
        G0360_al_MessageAreaRowExpirationTime[M532_MESSAGE_AREA_ROW_COUNT - 1] = -1;
        F0561_SCROLLER_IsTextScrolling(&G1057_s_TextScroller, C1_TRUE);
#endif
#ifdef MEDIA092_S10EA_S10EB_S11E_S12E_S12G_S13FA_S13FB_S20E_S21E_G14ED_G20E_G21E_A20E_A20F_A20G_A21E_A22E_A22G
        G0578_B_UseByteBoxCoordinates = C0_FALSE;
        M768_BOX_LEFT(L0028_ai_Box) = 0;
        M769_BOX_RIGHT(L0028_ai_Box) = 319;
#endif
#ifdef MEDIA529_F20E_F20J_X30J_P20JA_P20JB_I34E_I34M_A36M_A31E_A31M_A33M_A35E_A35M_F31E_F31J_X31J_P31J
        F0638_GetZone(C015_ZONE_MESSAGE_AREA, L0028_ai_XYZ);
        L3464_i_ZoneYBackup = M706_ZONE_TOP(L0028_ai_XYZ);
#endif
#ifdef MEDIA093_S10EA_S10EB_S11E_S12E_S12G_S13FA_S13FB_S20E_S21E_G14ED_G20E_G21E_A20E_A20F_A20G_A21E_A22E_A22G_F20E_F20J_X30J_P20JA_P20JB_I34E_I34M_A36M_A31E_A31M_A33M_A35E_A35M_F31E_F31J_X31J_P31J
        for (L0026_ui_RowIndex = 0; L0026_ui_RowIndex < M532_MESSAGE_AREA_ROW_COUNT; L0026_ui_RowIndex++) { /* ANOMALY_ASSEMBLY_COMPILATION_DIFFERENCE jmp */
                L0027_l_ExpirationTime = G0360_al_MessageAreaRowExpirationTime[L0026_ui_RowIndex];
                if ((L0027_l_ExpirationTime == -1) || (L0027_l_ExpirationTime > G0313_ul_GameTime))
                        continue;
#ifdef MEDIA092_S10EA_S10EB_S11E_S12E_S12G_S13FA_S13FB_S20E_S21E_G14ED_G20E_G21E_A20E_A20F_A20G_A21E_A22E_A22G
                M771_BOX_BOTTOM(L0028_ai_Box) = (M770_BOX_TOP(L0028_ai_Box) = 172 + (L0026_ui_RowIndex * 7)) + 6;
#endif
#ifdef MEDIA569_F20J_X30J_P20JA_P20JB
                M706_ZONE_TOP(L0028_ai_XYZ) = L3464_i_ZoneYBackup + (L0026_ui_RowIndex * G2342_C17_JapaneseTextLineHeight);
                M707_ZONE_BOTTOM(L0028_ai_XYZ) = M706_ZONE_TOP(L0028_ai_XYZ) + G2338_i_JapaneseCharacterMaximumHeight - 1;
#endif
#ifdef MEDIA689_F31J_X31J_P31J
                M706_ZONE_TOP(L0028_ai_XYZ) = L3464_i_ZoneYBackup + (L0026_ui_RowIndex * G2342_C17_JapaneseTextLineHeight);
                M709_ZONE_HEIGHT(L0028_ai_XYZ) = G2338_i_JapaneseCharacterMaximumHeight;
#endif
#ifdef MEDIA562_F20E_I34E_I34M_A36M_A31E_A31M_A33M_A35E_A35M_F31E
                M706_ZONE_TOP(L0028_ai_XYZ) = L3464_i_ZoneYBackup + (L0026_ui_RowIndex * G2088_C7_TextLineHeight);
#endif
#ifdef MEDIA487_F20E
                M707_ZONE_BOTTOM(L0028_ai_XYZ) = M706_ZONE_TOP(L0028_ai_XYZ) + G2083_C6_ - 1;
#endif
#ifdef MEDIA718_I34E_I34M_A36M_A31E_A31M_A33M_A35E_A35M_F31E
                M709_ZONE_HEIGHT(L0028_ai_XYZ) = G2083_C6_;
#endif
#ifdef MEDIA173_S10EA_S10EB_S11E_S12E_S12G_S13FA_S13FB_S20E_S21E_A36M_A31E_A31M_A33M_A35E_A35M
                while ((G0354_i_MessageAreaScrollingLineCount >= 0) || G0355_B_ScrollMessageArea);
#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
                F0077_MOUSE_EnableScreenUpdate_CPSE();
#endif
#ifdef MEDIA433_A20E_A20F_A20G_A21E_A22E_A22G
                F0561_SCROLLER_IsTextScrolling(&G1057_s_TextScroller, C1_TRUE);
#endif
#ifdef MEDIA092_S10EA_S10EB_S11E_S12E_S12G_S13FA_S13FB_S20E_S21E_G14ED_G20E_G21E_A20E_A20F_A20G_A21E_A22E_A22G
                M525_F0135_VIDEO_FillBox(G0348_Bitmap_Screen, L0028_ai_Box, C00_COLOR_BLACK, C160_BYTE_WIDTH_SCREEN, C200_HEIGHT_SCREEN);
#endif
#ifdef MEDIA529_F20E_F20J_X30J_P20JA_P20JB_I34E_I34M_A36M_A31E_A31M_A33M_A35E_A35M_F31E_F31J_X31J_P31J
                F0732_FillScreenArea(L0028_ai_XYZ, C00_COLOR_BLACK);
#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
                F0078_MOUSE_DisableScreenUpdate();
#endif
                G0360_al_MessageAreaRowExpirationTime[L0026_ui_RowIndex] = -1;
        }
#endif
}

STATICFUNCTION void F0045_TEXT_MESSAGEAREA_CreateNewRow(
#ifdef MEDIA529_F20E_F20J_X30J_P20JA_P20JB_I34E_I34M_A36M_A31E_A31M_A33M_A35E_A35M_F31E_F31J_X31J_P31J
void
#endif
)
{
        REGISTER unsigned int16_t L0029_ui_RowIndex;


        if (G0358_i_MessageAreaCursorRow == M532_MESSAGE_AREA_ROW_COUNT - 1) {
#ifdef MEDIA173_S10EA_S10EB_S11E_S12E_S12G_S13FA_S13FB_S20E_S21E_A36M_A31E_A31M_A33M_A35E_A35M
                while ((G0354_i_MessageAreaScrollingLineCount >= 0) || G0355_B_ScrollMessageArea);
#endif
#ifdef MEDIA413_A20ED_A20E_A20F_A20G_A21E_A22E_A22G
                F0561_SCROLLER_IsTextScrolling(&G1057_s_TextScroller, C1_TRUE);
#endif
#ifdef MEDIA375_G14ED_G20E_G21E_F20E_F20J_X30J_P20JA_P20JB_I34E_I34M_F31E_F31J_X31J_P31J
                if (G0355_B_ScrollMessageArea) {
                        F0696_UpdateMessageArea();
                }
#endif
#ifdef MEDIA137_S10EA_S10EB_S11E_S12E_S12G_S13FA_S13FB_S20E_S21E_A20ED_A20E_A20F_A20G_A21E_A22E_A22G
                F0008_MAIN_ClearBytes(G0356_puc_Bitmap_MessageAreaNewRow, M075_BITMAP_BYTE_COUNT(320, 7));
#endif
#ifdef MEDIA351_G14ED_G20E_G21E
                F0008_MAIN_ClearBytes(G3971_auc_Bitmap_MessageAreaNewRow, M075_BITMAP_BYTE_COUNT(320, 7));
#endif
#ifdef MEDIA529_F20E_F20J_X30J_P20JA_P20JB_I34E_I34M_A36M_A31E_A31M_A33M_A35E_A35M_F31E_F31J_X31J_P31J
                F0008_MAIN_ClearBytes(M772_CAST_PC(G0356_puc_Bitmap_MessageAreaNewRow), (long)G2091_MessageAreaLineByteCount);
#endif
#ifdef MEDIA007_S10EA_S10EB_S11E_S12E_S12G_S13FA_S13FB_S20E_S21E
                G0354_i_MessageAreaScrollingLineCount = 0;
#endif
#ifdef MEDIA746_A36M_A31E_A31M_A33M_A35E_A35M
                G0354_i_MessageAreaScrollingLineCount = G2088_C7_TextLineHeight - 1;
#endif
#ifdef MEDIA413_A20ED_A20E_A20F_A20G_A21E_A22E_A22G
                F0560_SCROLLER_SetCommand(&G1057_s_TextScroller, 1);
#endif
#ifdef MEDIA375_G14ED_G20E_G21E_F20E_F20J_X30J_P20JA_P20JB_I34E_I34M_F31E_F31J_X31J_P31J
                G0355_B_ScrollMessageArea = C1_TRUE;
#endif
                for (L0029_ui_RowIndex = 0; L0029_ui_RowIndex < M532_MESSAGE_AREA_ROW_COUNT - 1; L0029_ui_RowIndex++) {
                        G0360_al_MessageAreaRowExpirationTime[L0029_ui_RowIndex] = G0360_al_MessageAreaRowExpirationTime[L0029_ui_RowIndex + 1];
                }
                G0360_al_MessageAreaRowExpirationTime[M532_MESSAGE_AREA_ROW_COUNT - 1] = -1;
        } else {
                G0358_i_MessageAreaCursorRow++;
#ifdef MEDIA375_G14ED_G20E_G21E_F20E_F20J_X30J_P20JA_P20JB_I34E_I34M_F31E_F31J_X31J_P31J
                G0355_B_ScrollMessageArea = C0_FALSE;
#endif
        }
}

STATICFUNCTION void F0046_TEXT_MESSAGEAREA_PrintString(
#ifdef MEDIA009_S10EA_S10EB_S11E_S12E_S12G_S13FA_S13FB_S20E_S21E_G14ED_G20E_G21E_A20ED_A20E_A20F_A20G_A21E_A22E_A22G
P0067_i_TextColor, P0068_pc_String)
#endif
int16_t        P0067_i_TextColor SEPARATOR
REGISTER char* P0068_pc_String   FINAL_SEPARATOR
{
        REGISTER int16_t L0030_i_StringLength;
#ifdef MEDIA529_F20E_F20J_X30J_P20JA_P20JB_I34E_I34M_A36M_A31E_A31M_A33M_A35E_A35M_F31E_F31J_X31J_P31J
        int16_t L3465_ai_XYZ[4];


        F0638_GetZone(C015_ZONE_MESSAGE_AREA, L3465_ai_XYZ);
#endif
        L0030_i_StringLength = M544_STRLEN(P0068_pc_String);
#ifdef MEDIA173_S10EA_S10EB_S11E_S12E_S12G_S13FA_S13FB_S20E_S21E_A36M_A31E_A31M_A33M_A35E_A35M
        if (G0354_i_MessageAreaScrollingLineCount == -1) {
                while (G0355_B_ScrollMessageArea);
                F0077_MOUSE_EnableScreenUpdate_CPSE();
#endif
#ifdef MEDIA413_A20ED_A20E_A20F_A20G_A21E_A22E_A22G
        if (F0561_SCROLLER_IsTextScrolling(&G1057_s_TextScroller, C0_FALSE)) {
#endif
#ifdef MEDIA375_G14ED_G20E_G21E_F20E_F20J_X30J_P20JA_P20JB_I34E_I34M_F31E_F31J_X31J_P31J
        if (G0355_B_ScrollMessageArea) {
#endif
#ifdef MEDIA156_S10EA_S10EB_S11E_S12E_S12G_S13FA_S13FB_S20E_S21E_A20E_A20F_A20G_A21E_A22E_A22G
                F0053_TEXT_PrintToLogicalScreen(G0359_i_MessageAreaCursorColumn * 6, (G0358_i_MessageAreaCursorRow * 7) + 177, P0067_i_TextColor, C00_COLOR_BLACK, P0068_pc_String);
#endif
#ifdef MEDIA410_A20ED
                F0040_TEXT_Print(G0348_Bitmap_Screen, C160_BYTE_WIDTH_SCREEN, G0359_i_MessageAreaCursorColumn * 6, (G0358_i_MessageAreaCursorRow * 7) + 177, P0067_i_TextColor, C00_COLOR_BLACK, P0068_pc_String, C200_HEIGHT_SCREEN);
#endif
#ifdef MEDIA351_G14ED_G20E_G21E
                F0040_TEXT_Print(G3971_auc_Bitmap_MessageAreaNewRow, C160_BYTE_WIDTH_SCREEN, G0359_i_MessageAreaCursorColumn * 6, 5, P0067_i_TextColor, C00_COLOR_BLACK, P0068_pc_String);
#endif
#ifdef MEDIA746_A36M_A31E_A31M_A33M_A35E_A35M
                F0053_TEXT_PrintToLogicalScreen(M704_ZONE_LEFT(L3465_ai_XYZ) + G0359_i_MessageAreaCursorColumn, M706_ZONE_TOP(L3465_ai_XYZ) + (G0358_i_MessageAreaCursorRow * G2088_C7_TextLineHeight) + G2083_C6_ - G2086_C1_ - 1, P0067_i_TextColor, C00_COLOR_BLACK, P0068_pc_String);
#endif
#ifdef MEDIA173_S10EA_S10EB_S11E_S12E_S12G_S13FA_S13FB_S20E_S21E_A36M_A31E_A31M_A33M_A35E_A35M
                F0078_MOUSE_DisableScreenUpdate();
#endif
#ifdef MEDIA569_F20J_X30J_P20JA_P20JB
                F0644_PrintTextAlt(G0356_puc_Bitmap_MessageAreaNewRow, G2092_MessageAreaWidth, G0359_i_MessageAreaCursorColumn, G2338_i_JapaneseCharacterMaximumHeight - G2341_, P0067_i_TextColor, C00_COLOR_BLACK, P0068_pc_String);
#endif
#ifdef MEDIA487_F20E
                F0644_PrintTextAlt(G0356_puc_Bitmap_MessageAreaNewRow, G2092_MessageAreaWidth, G0359_i_MessageAreaCursorColumn, G2083_C6_ - G2086_C1_, P0067_i_TextColor, C00_COLOR_BLACK, P0068_pc_String);
#endif
#ifdef MEDIA689_F31J_X31J_P31J
                F0644_PrintTextAlt(G0356_puc_Bitmap_MessageAreaNewRow, G2092_MessageAreaWidth, G0359_i_MessageAreaCursorColumn, G2187_MessageAreaHeight_Unreferenced - 2 - (F0818_IsJapaneseText(M774_CAST_PUC(P0068_pc_String)) ? G2341_ : G2086_C1_), P0067_i_TextColor, C00_COLOR_BLACK, P0068_pc_String);
#endif
#ifdef MEDIA710_I34E_I34M_F31E
                F0644_PrintTextAlt(G0356_puc_Bitmap_MessageAreaNewRow, G2092_MessageAreaWidth, G0359_i_MessageAreaCursorColumn, G2088_C7_TextLineHeight - G2086_C1_ - 2, P0067_i_TextColor, C00_COLOR_BLACK, P0068_pc_String);
#endif
        } else {
#ifdef MEDIA375_G14ED_G20E_G21E_F20E_F20J_X30J_P20JA_P20JB_I34E_I34M_F31E_F31J_X31J_P31J
                F0077_MOUSE_EnableScreenUpdate_CPSE();
#endif

#ifdef MEDIA137_S10EA_S10EB_S11E_S12E_S12G_S13FA_S13FB_S20E_S21E_A20ED_A20E_A20F_A20G_A21E_A22E_A22G
                M521_F0040_TEXT_Print(G0356_puc_Bitmap_MessageAreaNewRow, C160_BYTE_WIDTH_SCREEN, G0359_i_MessageAreaCursorColumn * 6, 5, P0067_i_TextColor, C00_COLOR_BLACK, P0068_pc_String, 7);
#endif
#ifdef MEDIA746_A36M_A31E_A31M_A33M_A35E_A35M
                F0644_PrintTextAlt(G0356_puc_Bitmap_MessageAreaNewRow, G2092_MessageAreaWidth, G0359_i_MessageAreaCursorColumn, G2088_C7_TextLineHeight - G2086_C1_ - 1, P0067_i_TextColor, C00_COLOR_BLACK, P0068_pc_String, G2187_MessageAreaHeight_Unreferenced);
#endif
#ifdef MEDIA351_G14ED_G20E_G21E
                F0053_TEXT_PrintToLogicalScreen(G0359_i_MessageAreaCursorColumn * 6, G0358_i_MessageAreaCursorRow * 7 + 177, P0067_i_TextColor, C00_COLOR_BLACK, P0068_pc_String);
#endif
#ifdef MEDIA569_F20J_X30J_P20JA_P20JB
                F0053_TEXT_PrintToLogicalScreen(G0359_i_MessageAreaCursorColumn, M706_ZONE_TOP(L3465_ai_XYZ) + (G0358_i_MessageAreaCursorRow * G2342_C17_JapaneseTextLineHeight) + G2338_i_JapaneseCharacterMaximumHeight - G2341_, P0067_i_TextColor, C00_COLOR_BLACK, P0068_pc_String);
#endif
#ifdef MEDIA487_F20E
                F0053_TEXT_PrintToLogicalScreen(G0359_i_MessageAreaCursorColumn, M706_ZONE_TOP(L3465_ai_XYZ) + (G0358_i_MessageAreaCursorRow * G2088_C7_TextLineHeight) + G2083_C6_ - G2086_C1_, P0067_i_TextColor, C00_COLOR_BLACK, P0068_pc_String);
#endif
#ifdef MEDIA689_F31J_X31J_P31J
                F0053_TEXT_PrintToLogicalScreen(M704_ZONE_LEFT(L3465_ai_XYZ) + G0359_i_MessageAreaCursorColumn, M706_ZONE_TOP(L3465_ai_XYZ) + (G0358_i_MessageAreaCursorRow * G2342_C17_JapaneseTextLineHeight) + G2338_i_JapaneseCharacterMaximumHeight - G2341_ - 1, P0067_i_TextColor, C00_COLOR_BLACK, P0068_pc_String);
#endif
#ifdef MEDIA710_I34E_I34M_F31E
                F0053_TEXT_PrintToLogicalScreen(M704_ZONE_LEFT(L3465_ai_XYZ) + G0359_i_MessageAreaCursorColumn, M706_ZONE_TOP(L3465_ai_XYZ) + (G0358_i_MessageAreaCursorRow * G2088_C7_TextLineHeight) + G2083_C6_ - G2086_C1_ - 1, P0067_i_TextColor, C00_COLOR_BLACK, P0068_pc_String);
#endif
#ifdef MEDIA173_S10EA_S10EB_S11E_S12E_S12G_S13FA_S13FB_S20E_S21E_A36M_A31E_A31M_A33M_A35E_A35M
                if (G0354_i_MessageAreaScrollingLineCount == -1) {
                        G0355_B_ScrollMessageArea = C1_TRUE;
                }
#endif
#ifdef MEDIA413_A20ED_A20E_A20F_A20G_A21E_A22E_A22G
                if (F0561_SCROLLER_IsTextScrolling(&G1057_s_TextScroller, C0_FALSE)) {
                        F0560_SCROLLER_SetCommand(&G1057_s_TextScroller, 1);
                }
#endif
#ifdef MEDIA375_G14ED_G20E_G21E_F20E_F20J_X30J_P20JA_P20JB_I34E_I34M_F31E_F31J_X31J_P31J
                F0078_MOUSE_DisableScreenUpdate();
#endif
        }
#ifdef MEDIA009_S10EA_S10EB_S11E_S12E_S12G_S13FA_S13FB_S20E_S21E_G14ED_G20E_G21E_A20ED_A20E_A20F_A20G_A21E_A22E_A22G
        G0359_i_MessageAreaCursorColumn += L0030_i_StringLength;
#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
        G0360_al_MessageAreaRowExpirationTime[G0358_i_MessageAreaCursorRow] = G0313_ul_GameTime + 70;
#endif
#ifdef MEDIA413_A20ED_A20E_A20F_A20G_A21E_A22E_A22G
        G0360_al_MessageAreaRowExpirationTime[G0358_i_MessageAreaCursorRow] = G0313_ul_GameTime + 200;
#endif
}

void F0047_TEXT_MESSAGEAREA_PrintMessage(
#ifdef MEDIA009_S10EA_S10EB_S11E_S12E_S12G_S13FA_S13FB_S20E_S21E_G14ED_G20E_G21E_A20ED_A20E_A20F_A20G_A21E_A22E_A22G
P0069_i_TextColor, P0070_pc_String)
#endif
REGISTER int16_t P0069_i_TextColor SEPARATOR
REGISTER char*   P0070_pc_String   FINAL_SEPARATOR
{
#ifdef MEDIA009_S10EA_S10EB_S11E_S12E_S12G_S13FA_S13FB_S20E_S21E_G14ED_G20E_G21E_A20ED_A20E_A20F_A20G_A21E_A22E_A22G
        int16_t L0032_i_SpaceString;
        REGISTER unsigned int16_t L0031_CharacterIndex;
        char L0033_ac_String[54];


#ifdef MEDIA351_G14ED_G20E_G21E
        if (G0355_B_ScrollMessageArea) {
                F0696_UpdateMessageArea();
                F0008_MAIN_ClearBytes(G3971_auc_Bitmap_MessageAreaNewRow, M075_BITMAP_BYTE_COUNT(320, 7));
                G0355_B_ScrollMessageArea = C0_FALSE;
        }
#endif
        while (*P0070_pc_String) {
                if (*P0070_pc_String == '\n') { /* New line */
                        P0070_pc_String++;
                        if ((G0359_i_MessageAreaCursorColumn != 0) || (G0358_i_MessageAreaCursorRow != 0)) {
                                G0359_i_MessageAreaCursorColumn = 0;
                                F0045_TEXT_MESSAGEAREA_CreateNewRow();
                        }
                } else {
                        if (*P0070_pc_String == ' ') {
                                P0070_pc_String++;
                                if (G0359_i_MessageAreaCursorColumn != 53) { /* 53 is the maximum number of characters possible on one line */
#ifdef MEDIA137_S10EA_S10EB_S11E_S12E_S12G_S13FA_S13FB_S20E_S21E_A20ED_A20E_A20F_A20G_A21E_A22E_A22G
                                        L0032_i_SpaceString = 0x2000;
#endif
#ifdef MEDIA351_G14ED_G20E_G21E
                                        L0032_i_SpaceString = 0x0020;
#endif
                                        F0046_TEXT_MESSAGEAREA_PrintString(P0069_i_TextColor, &L0032_i_SpaceString);
                                }
                        } else {
                                L0031_CharacterIndex = 0;
                                do {
                                        L0033_ac_String[L0031_CharacterIndex++] = *P0070_pc_String++;
                                } while (*P0070_pc_String && (*P0070_pc_String != ' ') && (*P0070_pc_String != '\n')); /* End of string, space or New line */
                                L0033_ac_String[L0031_CharacterIndex] = '\0';
                                if (G0359_i_MessageAreaCursorColumn + L0031_CharacterIndex > 53) {
                                        G0359_i_MessageAreaCursorColumn = 2;
                                        F0045_TEXT_MESSAGEAREA_CreateNewRow();
                                }
                                F0046_TEXT_MESSAGEAREA_PrintString(P0069_i_TextColor, L0033_ac_String);
                        }
                }
        }
#ifdef MEDIA351_G14ED_G20E_G21E
        if (G0355_B_ScrollMessageArea) {
                F0696_UpdateMessageArea();
                F0008_MAIN_ClearBytes(G3971_auc_Bitmap_MessageAreaNewRow, M075_BITMAP_BYTE_COUNT(320, 7));
                G0355_B_ScrollMessageArea = C0_FALSE;
        }
#endif
#endif
#ifdef MEDIA529_F20E_F20J_X30J_P20JA_P20JB_I34E_I34M_A36M_A31E_A31M_A33M_A35E_A35M_F31E_F31J_X31J_P31J
        int16_t L0031_CharacterIndex;
        char L0033_ac_String[100];
        REGISTER int16_t L3466_i_Width;


#ifdef MEDIA525_F20E_F20J_X30J_P20JA_P20JB_I34E_I34M_F31E_F31J_X31J_P31J
        if (G0355_B_ScrollMessageArea) {
                F0696_UpdateMessageArea();
                F0008_MAIN_ClearBytes(M772_CAST_PC(G0356_puc_Bitmap_MessageAreaNewRow), (long)G2091_MessageAreaLineByteCount);
                G0355_B_ScrollMessageArea = C0_FALSE;
        }
#endif
        L0031_CharacterIndex = 0;
        while (P0070_pc_String[L0031_CharacterIndex]) {
                L3466_i_Width = F0646_GetLargestPrintableSubString(P0070_pc_String, L0033_ac_String, &L0031_CharacterIndex, G2092_MessageAreaWidth - G0359_i_MessageAreaCursorColumn);
#ifdef MEDIA488_F20E_F20J
                F0046_TEXT_MESSAGEAREA_PrintString(P0069_i_TextColor, L0033_ac_String);
#endif
                if (P0070_pc_String[L0031_CharacterIndex] == '\n') { /* New line */
                        F0045_TEXT_MESSAGEAREA_CreateNewRow();
#ifdef MEDIA593_X30J_P20JA_P20JB_I34E_I34M_A36M_A31E_A31M_A33M_A35E_A35M_F31E_F31J_X31J_P31J
                        F0046_TEXT_MESSAGEAREA_PrintString(P0069_i_TextColor, L0033_ac_String);
#endif
                        G0359_i_MessageAreaCursorColumn = 0;
                        L0031_CharacterIndex++;
                        continue;
                }
                if (P0070_pc_String[L0031_CharacterIndex] != '\0') {
#ifdef MEDIA593_X30J_P20JA_P20JB_I34E_I34M_A36M_A31E_A31M_A33M_A35E_A35M_F31E_F31J_X31J_P31J
                        F0046_TEXT_MESSAGEAREA_PrintString(P0069_i_TextColor, L0033_ac_String);
#endif
                        F0045_TEXT_MESSAGEAREA_CreateNewRow();
#ifdef MEDIA571_F20J_X30J_P20JA_P20JB_F31J_X31J_P31J
                        G0359_i_MessageAreaCursorColumn = 0;
#endif
#ifdef MEDIA562_F20E_I34E_I34M_A36M_A31E_A31M_A33M_A35E_A35M_F31E
                        G0359_i_MessageAreaCursorColumn = 12;
#endif
                        continue;
                }
#ifdef MEDIA593_X30J_P20JA_P20JB_I34E_I34M_A36M_A31E_A31M_A33M_A35E_A35M_F31E_F31J_X31J_P31J
                F0046_TEXT_MESSAGEAREA_PrintString(P0069_i_TextColor, L0033_ac_String);
#endif
                G0359_i_MessageAreaCursorColumn += L3466_i_Width;
        }
#ifdef MEDIA525_F20E_F20J_X30J_P20JA_P20JB_I34E_I34M_F31E_F31J_X31J_P31J
        if (G0355_B_ScrollMessageArea) {
                F0696_UpdateMessageArea();
                F0008_MAIN_ClearBytes(M772_CAST_PC(G0356_puc_Bitmap_MessageAreaNewRow), (long)G2091_MessageAreaLineByteCount);
                G0355_B_ScrollMessageArea = C0_FALSE;
        }
#endif
#endif
}

#ifdef MEDIA571_F20J_X30J_P20JA_P20JB_F31J_X31J_P31J
void F0819_TEXT_MESSAGEAREA_PrintMessageAsJapanese(
int16_t P2199_i_TextColor SEPARATOR
char*   P2200_pc_String   FINAL_SEPARATOR
{
        char L3467_ac_String[100];


        L3467_ac_String[0] = 0x1B;
        M547_STRCPY(&L3467_ac_String[1], P2200_pc_String);
        F0047_TEXT_MESSAGEAREA_PrintMessage(P2199_i_TextColor, L3467_ac_String);
}
#endif

void F0048_TEXT_MESSAGEAREA_PrintCharacter( /* BUG0_00 Useless code (Atari ST / Amiga) */
#ifdef MEDIA009_S10EA_S10EB_S11E_S12E_S12G_S13FA_S13FB_S20E_S21E_G14ED_G20E_G21E_A20ED_A20E_A20F_A20G_A21E_A22E_A22G
P0071_i_TextColor, P0072_c_Character)
#endif
int16_t P0071_i_TextColor SEPARATOR
char    P0072_c_Character FINAL_SEPARATOR
{
        char L0034_ac_String[2];


        L0034_ac_String[0] = P0072_c_Character;
        L0034_ac_String[1] = '\0';
        F0047_TEXT_MESSAGEAREA_PrintMessage(P0071_i_TextColor, L0034_ac_String);
}

#ifdef MEDIA020_S10EA_S10EB_S11E_S12E_S12G_S13FA_S13FB_S20E_S21E_G14ED_G20E_G21E_A20ED_A20E_A20F_A20G_A21E_A22E_A22G_F20E_F20J_X30J_P20JA_P20JB
void F0049_TEXT_MESSAGEAREA_PrintInteger_Unreferenced( /* BUG0_00 Useless code */
#ifdef MEDIA009_S10EA_S10EB_S11E_S12E_S12G_S13FA_S13FB_S20E_S21E_G14ED_G20E_G21E_A20ED_A20E_A20F_A20G_A21E_A22E_A22G
P0073_i_TextColor, P0074_ui_Integer)
#endif
int16_t                   P0073_i_TextColor SEPARATOR
REGISTER unsigned int16_t P0074_ui_Integer  FINAL_SEPARATOR
{
        REGISTER unsigned int16_t L0035_ui_CharacterIndex;
        char L0036_ac_String[7];


        L0035_ui_CharacterIndex = 7;
        L0036_ac_String[7] = '\0'; /* BUG0_01 Coding error without consequence. Index 7 is out of array bounds. No consequence because this function is never called and all compilers provision 8 bytes on the stack to store the array anyway. But declaring an array of 8 bytes generates wrong code for Apple IIGS and Amiga versions */
        do {
                L0036_ac_String[--L0035_ui_CharacterIndex] = '0' + (P0074_ui_Integer % 10);
        } while (P0074_ui_Integer /= 10);
        F0047_TEXT_MESSAGEAREA_PrintMessage(P0073_i_TextColor, &L0036_ac_String[L0035_ui_CharacterIndex]);
}
#endif

#ifdef MEDIA720_I34E_I34M_A36M_A31E_A31M_A33M_A35E_A35M_F31E_F31J_X31J_P31J
void F0647_PrintLongForDebugMemory( /* Can be merged with F0049_TEXT_MESSAGEAREA_PrintInteger_Unreferenced */
int16_t                P2201_i_TextColor SEPARATOR
REGISTER unsigned long P2202_ul_Value    FINAL_SEPARATOR
{
        char L3468_ac_String[14];
#ifdef MEDIA622_A31E_A31M_A33M_F31E_F31J_X31J_P31J
        REGISTER unsigned int16_t L3469_ui_;


        L3469_ui_ = 12;
        L3468_ac_String[L3469_ui_--] = '\0';
        L3468_ac_String[L3469_ui_] = ' ';
        do {
                L3468_ac_String[--L3469_ui_] = '0' + (P2202_ul_Value % 10);
        } while ((P2202_ul_Value /= 10) != 0);
        F0047_TEXT_MESSAGEAREA_PrintMessage(P2201_i_TextColor, &L3468_ac_String[L3469_ui_]);
#endif
#ifdef MEDIA728_I34E_I34M_A36M_A35E_A35M
        F0671_ConvertLongToString(P2202_ul_Value, L3468_ac_String);
        F0047_TEXT_MESSAGEAREA_PrintMessage(P2201_i_TextColor, L3468_ac_String);
        F0047_TEXT_MESSAGEAREA_PrintMessage(P2201_i_TextColor, " ");
#endif
}
#endif

void F0050_TEXT_MESSAGEAREA_PrintSpace_Unreferenced( /* BUG0_00 Useless code */
#ifdef MEDIA529_F20E_F20J_X30J_P20JA_P20JB_I34E_I34M_A36M_A31E_A31M_A33M_A35E_A35M_F31E_F31J_X31J_P31J
void
#endif
)
{
        F0047_TEXT_MESSAGEAREA_PrintMessage(C15_COLOR_WHITE, " ");
}

#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
void F0051_TEXT_MESSAGEAREA_PrintLineFeed(
#ifdef MEDIA529_F20E_F20J_X30J_P20JA_P20JB_I34E_I34M_A36M_A31E_A31M_A33M_A35E_A35M_F31E_F31J_X31J_P31J
void
#endif
)
{
        F0047_TEXT_MESSAGEAREA_PrintMessage(C00_COLOR_BLACK, G0066_ac_Graphic562_LineFeedCharacterString);
}
#endif

void F0052_TEXT_PrintToViewport(
#ifdef MEDIA009_S10EA_S10EB_S11E_S12E_S12G_S13FA_S13FB_S20E_S21E_G14ED_G20E_G21E_A20ED_A20E_A20F_A20G_A21E_A22E_A22G
P0075_i_X, P0076_i_Y, P0077_i_TextColor, P0078_pc_String)
#endif
int16_t P0075_i_X         SEPARATOR
int16_t P0076_i_Y         SEPARATOR
int16_t P0077_i_TextColor SEPARATOR
char*   P0078_pc_String   FINAL_SEPARATOR
{
#ifdef MEDIA009_S10EA_S10EB_S11E_S12E_S12G_S13FA_S13FB_S20E_S21E_G14ED_G20E_G21E_A20ED_A20E_A20F_A20G_A21E_A22E_A22G
        M521_F0040_TEXT_Print(G0296_puc_Bitmap_Viewport, C112_BYTE_WIDTH_VIEWPORT, P0075_i_X, P0076_i_Y, P0077_i_TextColor, C12_COLOR_DARKEST_GRAY, P0078_pc_String, C136_HEIGHT_VIEWPORT);
#endif
#ifdef MEDIA529_F20E_F20J_X30J_P20JA_P20JB_I34E_I34M_A36M_A31E_A31M_A33M_A35E_A35M_F31E_F31J_X31J_P31J
        M720_F0644_PrintTextAlt(G0296_puc_Bitmap_Viewport, G2073_C224_ViewportPixelWidth, P0075_i_X, P0076_i_Y, P0077_i_TextColor, C12_COLOR_DARKEST_GRAY, P0078_pc_String, G2074_C136_ViewportHeight);
#endif
}

void F0053_TEXT_PrintToLogicalScreen(
#ifdef MEDIA009_S10EA_S10EB_S11E_S12E_S12G_S13FA_S13FB_S20E_S21E_G14ED_G20E_G21E_A20ED_A20E_A20F_A20G_A21E_A22E_A22G
P0079_i_X, P0080_i_Y, P0081_i_TextColor, P0082_i_BackgroundColor, P0083_pc_String)
#endif
int16_t P0079_i_X               SEPARATOR
int16_t P0080_i_Y               SEPARATOR
int16_t P0081_i_TextColor       SEPARATOR
int16_t P0082_i_BackgroundColor SEPARATOR
char*   P0083_pc_String         FINAL_SEPARATOR
{
#ifdef MEDIA009_S10EA_S10EB_S11E_S12E_S12G_S13FA_S13FB_S20E_S21E_G14ED_G20E_G21E_A20ED_A20E_A20F_A20G_A21E_A22E_A22G
        M521_F0040_TEXT_Print(G0348_Bitmap_Screen, C160_BYTE_WIDTH_SCREEN, P0079_i_X, P0080_i_Y, P0081_i_TextColor, P0082_i_BackgroundColor, P0083_pc_String, C200_HEIGHT_SCREEN);
#endif
#ifdef MEDIA529_F20E_F20J_X30J_P20JA_P20JB_I34E_I34M_A36M_A31E_A31M_A33M_A35E_A35M_F31E_F31J_X31J_P31J
        M720_F0644_PrintTextAlt(G0348_Bitmap_Screen, G2071_C320_ScreenPixelWidth, P0079_i_X, P0080_i_Y, P0081_i_TextColor, P0082_i_BackgroundColor, P0083_pc_String, G2072_C200_ScreenPixelHeight);
#endif
}

#ifdef MEDIA413_A20ED_A20E_A20F_A20G_A21E_A22E_A22G
void F0554_TEXT_MESSAGEAREA_DeleteLastCharacter_Unreferenced(
)
{
        if (G0359_i_MessageAreaCursorColumn > 0) {
                G0359_i_MessageAreaCursorColumn--;
        }
        F0047_TEXT_MESSAGEAREA_PrintMessage(C15_COLOR_WHITE, " ");
        G0359_i_MessageAreaCursorColumn--;
}

void F0051_TEXT_MESSAGEAREA_PrintLineFeed(
)
{
        F0047_TEXT_MESSAGEAREA_PrintMessage(C00_COLOR_BLACK, G1029_ac_LineFeedCharacterString);
}
#endif

#ifdef MEDIA529_F20E_F20J_X30J_P20JA_P20JB_I34E_I34M_A36M_A31E_A31M_A33M_A35E_A35M_F31E_F31J_X31J_P31J
void F0648_PrintTextInViewportZone(
int16_t P2203_i_ZoneIndex SEPARATOR
int16_t P2204_i_Color     SEPARATOR
char*   P2205_pc_String   FINAL_SEPARATOR
{
        int16_t L3470_i_Width;
        int16_t L3471_i_Height;
        int16_t L3472_ai_XYZ[4];


        if (F0645_GetStringPixelDimensions(P2205_pc_String, &L3470_i_Width, &L3471_i_Height)) {
                if (F0635_(NULL, L3472_ai_XYZ, P2203_i_ZoneIndex, &L3470_i_Width, &L3471_i_Height)) {
                        M720_F0644_PrintTextAlt(G0296_puc_Bitmap_Viewport, G2073_C224_ViewportPixelWidth, M704_ZONE_LEFT(L3472_ai_XYZ), M707_ZONE_BOTTOM(L3472_ai_XYZ), P2204_i_Color, C12_COLOR_DARKEST_GRAY, P2205_pc_String, G2074_C136_ViewportHeight);
                }
        }
}

void F0649_PrintCenteredTextToViewportZone(
int16_t P2206_i_ZoneIndex       SEPARATOR
int16_t P2207_i_TextColor       SEPARATOR
int16_t P2208_i_BackgroundColor SEPARATOR
char*   P2209_pc_String         FINAL_SEPARATOR
{
        int16_t L3473_i_Width;
        int16_t L3474_i_Height;
        int16_t L3475_ai_XYZ[4];


        if (F0645_GetStringPixelDimensions(P2209_pc_String, &L3473_i_Width, &L3474_i_Height)) {
                if (F0635_(NULL, L3475_ai_XYZ, P2206_i_ZoneIndex, &L3473_i_Width, &L3474_i_Height)) {
                        M720_F0644_PrintTextAlt(G0296_puc_Bitmap_Viewport, G2073_C224_ViewportPixelWidth, M704_ZONE_LEFT(L3475_ai_XYZ), M707_ZONE_BOTTOM(L3475_ai_XYZ), P2207_i_TextColor, P2208_i_BackgroundColor, P2209_pc_String, G2074_C136_ViewportHeight);
                }
        }
}

void F0650_PrintCenteredTextToScreenZone(
int16_t P2210_i_ZoneIndex       SEPARATOR
int16_t P2211_i_TextColor       SEPARATOR
int16_t P2212_i_BackgroundColor SEPARATOR
char*   P2213_pc_String         FINAL_SEPARATOR
{
        int16_t L3476_i_Width;
        int16_t L3477_i_Height;
        int16_t L3478_ai_XYZ[4];


        if (F0645_GetStringPixelDimensions(P2213_pc_String, &L3476_i_Width, &L3477_i_Height)) {
                if (F0635_(NULL, L3478_ai_XYZ, P2210_i_ZoneIndex, &L3476_i_Width, &L3477_i_Height)) {
                        M720_F0644_PrintTextAlt(G0348_Bitmap_Screen, G2071_C320_ScreenPixelWidth, M704_ZONE_LEFT(L3478_ai_XYZ), M707_ZONE_BOTTOM(L3478_ai_XYZ), P2211_i_TextColor, P2212_i_BackgroundColor, P2213_pc_String, G2072_C200_ScreenPixelHeight);
                }
        }
}
#endif

void F0054_TEXT_Initialize(
#ifdef MEDIA529_F20E_F20J_X30J_P20JA_P20JB_I34E_I34M_A36M_A31E_A31M_A33M_A35E_A35M_F31E_F31J_X31J_P31J
void
#endif
)
{
        REGISTER unsigned int16_t L0037_ui_LineIndex;


        F0042_TEXT_MESSAGEAREA_MoveCursor(0, M532_MESSAGE_AREA_ROW_COUNT - 1);
#ifdef MEDIA458_P20JA_P20JB
        F1001_JAPANESE_LoadANKCharacterPatterns();
#endif
#ifdef MEDIA007_S10EA_S10EB_S11E_S12E_S12G_S13FA_S13FB_S20E_S21E
        G0356_puc_Bitmap_MessageAreaNewRow = (unsigned char*)F0468_MEMORY_Allocate((long)M075_BITMAP_BYTE_COUNT(320, 7), C1_ALLOCATION_PERMANENT);
        G0357_puc_InterfaceAndScrollsFont = (unsigned char*)F0468_MEMORY_Allocate((long)(M075_BITMAP_BYTE_COUNT(1024, 6) / 4), C1_ALLOCATION_PERMANENT); /* The color depth of the font bitmap is 1 bit per pixel instead of 4 for all other bitmaps */
#endif
#ifdef MEDIA529_F20E_F20J_X30J_P20JA_P20JB_I34E_I34M_A36M_A31E_A31M_A33M_A35E_A35M_F31E_F31J_X31J_P31J
        G0356_puc_Bitmap_MessageAreaNewRow = M533_F0468_MEMORY_Allocate((long)G2091_MessageAreaLineByteCount, C1_ALLOCATION_PERMANENT, MASK0x0008_MEMREQ);
        G0357_puc_InterfaceAndScrollsFont = M533_F0468_MEMORY_Allocate((long)(M075_BITMAP_BYTE_COUNT(1024, 6) / 4), C1_ALLOCATION_PERMANENT, MASK0x0400_MEMREQ); /* The color depth of the font bitmap is 1 bit per pixel instead of 4 for all other bitmaps */
#endif
#ifdef MEDIA007_S10EA_S10EB_S11E_S12E_S12G_S13FA_S13FB_S20E_S21E
        F0490_MEMORY_LoadDecompressAndExpandGraphic(MASK0x8000_NOT_EXPANDED | M653_GRAPHIC_FONT, G0357_puc_InterfaceAndScrollsFont); /* BUG0_01 Coding error without consequence. Function call with wrong number of parameters. It should be called with 4 parameters. No consequence because the missing parameters are not used when MASK0x8000_NOT_EXPANDED is specified */
#endif
#ifdef MEDIA353_G14ED_G20E_G21E_A20ED_A20E_A20F_A20G_A21E_A22E_A22G
        F0490_MEMORY_LoadDecompressAndExpandGraphic(MASK0x8000_NOT_EXPANDED | M653_GRAPHIC_FONT, G1103_auc_InterfaceAndScrollsFont); /* BUG0_01 Coding error without consequence. Function call with wrong number of parameters. It should be called with 4 parameters. No consequence because the missing parameters are not used when MASK0x8000_NOT_EXPANDED is specified */
#endif
#ifdef MEDIA508_F20E_F20J_X30J_P20JA_P20JB
        F0490_MEMORY_LoadDecompressAndExpandGraphic(MASK0x8000_NOT_EXPANDED | MASK0x4000_DO_NOT_COPY_DIMENSIONS | M653_GRAPHIC_FONT, G0357_puc_InterfaceAndScrollsFont, 0, 0);
#endif
#ifdef MEDIA720_I34E_I34M_A36M_A31E_A31M_A33M_A35E_A35M_F31E_F31J_X31J_P31J
        F0490_MEMORY_LoadDecompressAndExpandGraphic(MASK0x8000_NOT_EXPANDED | MASK0x4000_DO_NOT_COPY_DIMENSIONS | M653_GRAPHIC_FONT, G0357_puc_InterfaceAndScrollsFont);
#endif
        for (L0037_ui_LineIndex = 0; L0037_ui_LineIndex < M532_MESSAGE_AREA_ROW_COUNT; L0037_ui_LineIndex++) {
                G0360_al_MessageAreaRowExpirationTime[L0037_ui_LineIndex] = -1;
        }
#ifdef MEDIA746_A36M_A31E_A31M_A33M_A35E_A35M
        F1029_InitializeMessageAreaData();
#endif
}

#ifdef MEDIA413_A20ED_A20E_A20F_A20G_A21E_A22E_A22G
BOOLEAN F0555_TEXT_AllocateMemory(
)
{
        G1056_ps_MessageAreaNewRowBitMap = AllocMem((long)sizeof(struct BitMap), MEMF_CHIP | MEMF_CLEAR);
        if (G1056_ps_MessageAreaNewRowBitMap == NULL) {
                Alert(0x80444DB0, 0L);
                return C0_FALSE;
        }
        InitBitMap(G1056_ps_MessageAreaNewRowBitMap, 4L, 320L, 7L); /* 320 x 7 pixels, 4 bpp */
        G0356_puc_Bitmap_MessageAreaNewRow = AllocMem((long)M075_BITMAP_BYTE_COUNT(320, 7), MEMF_CHIP | MEMF_CLEAR);
        if (G0356_puc_Bitmap_MessageAreaNewRow == NULL) {
                Alert(0x80444DB1, 0L);
                return C0_FALSE;
        }
        G1056_ps_MessageAreaNewRowBitMap->Planes[0] = (PLANEPTR)G0356_puc_Bitmap_MessageAreaNewRow;
        G1056_ps_MessageAreaNewRowBitMap->Planes[1] = G1056_ps_MessageAreaNewRowBitMap->Planes[0] + M091_BITPLANE_SIZE(320, 7);
        G1056_ps_MessageAreaNewRowBitMap->Planes[2] = G1056_ps_MessageAreaNewRowBitMap->Planes[1] + M091_BITPLANE_SIZE(320, 7);
        G1056_ps_MessageAreaNewRowBitMap->Planes[3] = G1056_ps_MessageAreaNewRowBitMap->Planes[2] + M091_BITPLANE_SIZE(320, 7);
        return C1_TRUE;
}

void F0556_TEXT_Deinitialize(
)
{
        if (G1056_ps_MessageAreaNewRowBitMap) {
                FreeMem(G1056_ps_MessageAreaNewRowBitMap, (long)sizeof(struct BitMap));
        }
        if (G0356_puc_Bitmap_MessageAreaNewRow) {
                FreeMem(G0356_puc_Bitmap_MessageAreaNewRow, (long)M075_BITMAP_BYTE_COUNT(320, 7));
        }
}
#endif
#endif
