#ifndef COMPILE_H
#include "COMPILE.H"
#endif
#ifdef MEDIA701_I34E
typedef struct {
        unsigned char Index;
#if ((EXETYPE == C23_EGA) || (EXETYPE == C24_TANDY))
        unsigned char Val1;
        unsigned char Val2;
#endif
#if (EXETYPE == C25_VGA)
        unsigned char Red;
        unsigned char Green;
        unsigned char Blue;
#endif
} COLOR_DEF;

#if (EXETYPE == C25_VGA)
extern void F8163_VIDRV_00_CopyPixelsToScreenWithoutTransparency();
extern void F8152_VIDRV_01_FillBox();
extern void F8151_VIDRV_02_Blit();
extern void F8167_VIDRV_03_BlitMousePointerPrefixedBitmapFromScreen();
extern void F8168_VIDRV_04_BlitMousePointerPrefixedBitmapToScreen();
extern void F8154_VIDRV_05_InvertBox();
extern void F8155_VIDRV_06_HatchScreenBox();
extern void F8153_VIDRV_07_WaitVerticalBlank();
extern void F8157_VIDRV_08_SetMultipleColorsInPalette();
extern void F8161_VIDRV_09_BlitViewPort();
extern void F8162_VIDRV_10_ScrollMessageAreaUp();
extern void F8159_VIDRV_11_PALETTE_SetCurtain();
extern void F8160_VIDRV_12_SetCreatureReplacementColors();
extern void F8164_VIDRV_13_InitializeUnusedGlobalVariables();
extern long F8165_VIDRV_14_GetPrefixedBitmapByteCountOrBlitFromScreenNoTransparency();
extern void F8166_VIDRV_15_BlitToScreenNoTransparency();
extern void F8230_VIDRV_16_SetSingleColorComponentsInPalette();
extern void F8169_VIDRV_19_BlackenAllPixelsOneByOne();
extern int16_t F8170_Return0();
#endif

unsigned int16_t _stklen = 500;
COLOR_DEF G8147_CREDITS[17] = {
#if ((EXETYPE == C23_EGA) || (EXETYPE == C24_TANDY))
        { 0x00, 0x00, 0x00 },
        { 0x01, 0x03, 0x01 },
        { 0x02, 0x0E, 0x02 },
        { 0x03, 0x04, 0x03 },
        { 0x04, 0x0E, 0x04 },
        { 0x05, 0x00, 0x05 },
        { 0x06, 0x02, 0x06 },
        { 0x07, 0x0C, 0x07 },
        { 0x08, 0x06, 0x08 },
        { 0x09, 0x0F, 0x09 },
        { 0x0A, 0x06, 0x0A },
        { 0x0B, 0x0E, 0x0B },
        { 0x0C, 0x0E, 0x0C },
        { 0x0D, 0x00, 0x0D },
        { 0x0E, 0x00, 0x0E },
        { 0x0F, 0x0F, 0x0F },
        { 0xFF, 0xFF, 0x00 } };
#endif
#if (EXETYPE == C25_VGA)
        { 0x00, 0x00, 0x00, 0x00 },
        { 0x01, 0x00, 0x2D, 0x2D },
        { 0x02, 0x3F, 0x3F, 0x1B },
        { 0x03, 0x24, 0x12, 0x00 },
        { 0x04, 0x3F, 0x3F, 0x24 },
        { 0x05, 0x00, 0x00, 0x00 },
        { 0x06, 0x00, 0x24, 0x00 },
        { 0x07, 0x2D, 0x00, 0x00 },
        { 0x08, 0x36, 0x24, 0x12 },
        { 0x09, 0x3F, 0x3F, 0x2D },
        { 0x0A, 0x3F, 0x24, 0x12 },
        { 0x0B, 0x3F, 0x36, 0x00 },
        { 0x0C, 0x3F, 0x2D, 0x00 },
        { 0x0D, 0x00, 0x00, 0x00 },
        { 0x0E, 0x1B, 0x09, 0x00 },
        { 0x0F, 0x3F, 0x3F, 0x36 },
        { 0xFF, 0x00, 0x00, 0x00 } };
#endif
COLOR_DEF G8148_ENTRANCE[17] = {
#if ((EXETYPE == C23_EGA) || (EXETYPE == C24_TANDY))
        { 0x00, 0x00, 0x00 },
        { 0x01, 0x00, 0x00 },
        { 0x02, 0x08, 0x02 },
        { 0x03, 0x0C, 0x03 },
        { 0x04, 0x0C, 0x04 },
        { 0x05, 0x0A, 0x05 },
        { 0x06, 0x02, 0x06 },
        { 0x07, 0x0A, 0x07 },
        { 0x08, 0x04, 0x08 },
        { 0x09, 0x0C, 0x09 },
        { 0x0A, 0x06, 0x0A },
        { 0x0B, 0x04, 0x0B },
        { 0x0C, 0x00, 0x00 },
        { 0x0D, 0x07, 0x0D },
        { 0x0E, 0x04, 0x0E },
        { 0x0F, 0x0F, 0x0F },
        { 0xFF, 0x00, 0x00 } };
#endif
#if (EXETYPE == C25_VGA)
        { 0x00, 0x00, 0x00, 0x00 },
        { 0x01, 0x1B, 0x1B, 0x1B },
        { 0x02, 0x24, 0x24, 0x24 },
        { 0x03, 0x24, 0x12, 0x00 },
        { 0x04, 0x36, 0x2D, 0x24 },
        { 0x05, 0x00, 0x36, 0x00 },
        { 0x06, 0x00, 0x24, 0x00 },
        { 0x07, 0x00, 0x2D, 0x00 },
        { 0x08, 0x24, 0x1B, 0x12 },
        { 0x09, 0x3F, 0x00, 0x00 },
        { 0x0A, 0x2D, 0x24, 0x1B },
        { 0x0B, 0x1B, 0x12, 0x09 },
        { 0x0C, 0x12, 0x12, 0x12 },
        { 0x0D, 0x2D, 0x2D, 0x2D },
        { 0x0E, 0x1B, 0x09, 0x00 },
        { 0x0F, 0x3F, 0x3F, 0x3F },
        { 0xFF, 0x00, 0x00, 0x00 } };
#endif
COLOR_DEF G8149_ICON[17] = { /* Colors are identical to G8151_LIGHT0, but with color indices 0-15 instead of 16-31 */
#if ((EXETYPE == C23_EGA) || (EXETYPE == C24_TANDY))
        { 0x00, 0x00, 0x00 },
        { 0x01, 0x07, 0x00 },
        { 0x02, 0x08, 0x02 },
        { 0x03, 0x04, 0x03 },
        { 0x04, 0x0B, 0x04 },
        { 0x05, 0x06, 0x05 },
        { 0x06, 0x02, 0x06 },
        { 0x07, 0x0A, 0x07 },
        { 0x08, 0x0C, 0x08 },
        { 0x09, 0x04, 0x09 },
        { 0x0A, 0x07, 0x0A },
        { 0x0B, 0x0E, 0x0B },
        { 0x0C, 0x08, 0x00 },
        { 0x0D, 0x07, 0x0D },
        { 0x0E, 0x01, 0x0E },
        { 0x0F, 0x0F, 0x0F },
        { 0xFF, 0x00, 0x00 } };
#endif
#if (EXETYPE == C25_VGA)
        { 0x00, 0x00, 0x00, 0x00 },
        { 0x01, 0x1B, 0x1B, 0x1B },
        { 0x02, 0x24, 0x24, 0x24 },
        { 0x03, 0x1B, 0x09, 0x00 },
        { 0x04, 0x00, 0x36, 0x36 },
        { 0x05, 0x24, 0x12, 0x00 },
        { 0x06, 0x00, 0x24, 0x00 },
        { 0x07, 0x00, 0x36, 0x00 },
        { 0x08, 0x3F, 0x00, 0x00 },
        { 0x09, 0x3F, 0x2D, 0x00 },
        { 0x0A, 0x36, 0x24, 0x1B },
        { 0x0B, 0x3F, 0x3F, 0x00 },
        { 0x0C, 0x12, 0x12, 0x12 },
        { 0x0D, 0x2D, 0x2D, 0x2D },
        { 0x0E, 0x00, 0x00, 0x3F },
        { 0x0F, 0x3F, 0x3F, 0x3F },
        { 0xFF, 0x00, 0x00, 0x00 } };
#endif
COLOR_DEF G8150_INVENTORY[17] = {
#if ((EXETYPE == C23_EGA) || (EXETYPE == C24_TANDY))
        { 0x00, 0xFF, 0x00 },
        { 0x01, 0xFF, 0x01 },
        { 0x02, 0xFF, 0x02 },
        { 0x03, 0xFF, 0x03 },
        { 0x04, 0xFF, 0x04 },
        { 0x05, 0xFF, 0x05 },
        { 0x06, 0xFF, 0x06 },
        { 0x07, 0xFF, 0x07 },
        { 0x08, 0xFF, 0x08 },
        { 0x09, 0xFF, 0x09 },
        { 0x0A, 0xFF, 0x0A },
        { 0x0B, 0xFF, 0x0B },
        { 0x0C, 0xFF, 0x0C },
        { 0x0D, 0xFF, 0x0D },
        { 0x0E, 0xFF, 0x0E },
        { 0x0F, 0xFF, 0x0F },
        { 0xFF, 0x00, 0x00 } };
#endif
#if (EXETYPE == C25_VGA)
        { 0x10, 0x00, 0x00, 0x00 },
        { 0x11, 0x1B, 0x1B, 0x1B },
        { 0x12, 0x24, 0x24, 0x24 },
        { 0x13, 0x1B, 0x09, 0x00 },
        { 0x14, 0x00, 0x36, 0x36 },
        { 0x15, 0x24, 0x12, 0x00 },
        { 0x16, 0x00, 0x24, 0x00 },
        { 0x17, 0x00, 0x36, 0x00 },
        { 0x18, 0x3F, 0x00, 0x00 },
        { 0x19, 0x3F, 0x2D, 0x00 },
        { 0x1A, 0x36, 0x24, 0x1B },
        { 0x1B, 0x3F, 0x3F, 0x00 },
        { 0x1C, 0x12, 0x12, 0x12 },
        { 0x1D, 0x2D, 0x2D, 0x2D },
        { 0x1E, 0x00, 0x00, 0x3F },
        { 0x1F, 0x3F, 0x3F, 0x3F },
        { 0xFF, 0x00, 0x00, 0x00 } };
#endif
COLOR_DEF G8151_LIGHT0[17] = {
#if ((EXETYPE == C23_EGA) || (EXETYPE == C24_TANDY))
        { 0x00, 0xFF, 0x00 },
        { 0x01, 0xFF, 0x00 },
        { 0x02, 0xFF, 0x02 },
        { 0x03, 0xFF, 0x03 },
        { 0x04, 0xFF, 0x04 },
        { 0x05, 0xFF, 0x05 },
        { 0x06, 0xFF, 0x06 },
        { 0x07, 0xFF, 0x07 },
        { 0x08, 0xFF, 0x08 },
        { 0x09, 0xFF, 0x09 },
        { 0x0A, 0xFF, 0x0A },
        { 0x0B, 0xFF, 0x0B },
        { 0x0C, 0xFF, 0x00 },
        { 0x0D, 0xFF, 0x0D },
        { 0x0E, 0xFF, 0x0E },
        { 0x0F, 0xFF, 0x0F },
        { 0xFF, 0x00, 0x00 } };
#endif
#if (EXETYPE == C25_VGA)
        { 0x10, 0x00, 0x00, 0x00 },
        { 0x11, 0x1B, 0x1B, 0x1B },
        { 0x12, 0x24, 0x24, 0x24 },
        { 0x13, 0x1B, 0x09, 0x00 },
        { 0x14, 0x00, 0x36, 0x36 },
        { 0x15, 0x24, 0x12, 0x00 },
        { 0x16, 0x00, 0x24, 0x00 },
        { 0x17, 0x00, 0x36, 0x00 },
        { 0x18, 0x3F, 0x00, 0x00 },
        { 0x19, 0x3F, 0x2D, 0x00 },
        { 0x1A, 0x36, 0x24, 0x1B },
        { 0x1B, 0x3F, 0x3F, 0x00 },
        { 0x1C, 0x12, 0x12, 0x12 },
        { 0x1D, 0x2D, 0x2D, 0x2D },
        { 0x1E, 0x00, 0x00, 0x3F },
        { 0x1F, 0x3F, 0x3F, 0x3F },
        { 0xFF, 0x00, 0x00, 0x00 } };
#endif
COLOR_DEF G8152_LIGHT1[17] = {
#if ((EXETYPE == C23_EGA) || (EXETYPE == C24_TANDY))
        { 0x00, 0xFF, 0x00 },
        { 0x01, 0xFF, 0x00 },
        { 0x02, 0xFF, 0x02 },
        { 0x03, 0xFF, 0x03 },
        { 0x04, 0xFF, 0x04 },
        { 0x05, 0xFF, 0x05 },
        { 0x06, 0xFF, 0x06 },
        { 0x07, 0xFF, 0x07 },
        { 0x08, 0xFF, 0x08 },
        { 0x09, 0xFF, 0x09 },
        { 0x0A, 0xFF, 0x0A },
        { 0x0B, 0xFF, 0x0B },
        { 0x0C, 0xFF, 0x00 },
        { 0x0D, 0xFF, 0x0D },
        { 0x0E, 0xFF, 0x0E },
        { 0x0F, 0xFF, 0x0F },
        { 0xFF, 0x00, 0x00 } };
#endif
#if (EXETYPE == C25_VGA)
        { 0x10, 0x00, 0x00, 0x00 },
        { 0x11, 0x12, 0x12, 0x12 },
        { 0x12, 0x1B, 0x1B, 0x1B },
        { 0x13, 0x1B, 0x09, 0x00 },
        { 0x14, 0x00, 0x36, 0x36 },
        { 0x15, 0x24, 0x09, 0x00 },
        { 0x16, 0x00, 0x1B, 0x00 },
        { 0x17, 0x00, 0x2D, 0x00 },
        { 0x18, 0x36, 0x00, 0x00 },
        { 0x19, 0x36, 0x24, 0x00 },
        { 0x1A, 0x2D, 0x1B, 0x12 },
        { 0x1B, 0x3F, 0x36, 0x00 },
        { 0x1C, 0x09, 0x09, 0x09 },
        { 0x1D, 0x24, 0x24, 0x24 },
        { 0x1E, 0x00, 0x00, 0x36 },
        { 0x1F, 0x36, 0x36, 0x36 },
        { 0xFF, 0x00, 0x00, 0x00 } };
#endif
COLOR_DEF G8153_LIGHT2[17] = {
#if ((EXETYPE == C23_EGA) || (EXETYPE == C24_TANDY))
        { 0x00, 0xFF, 0x00 },
        { 0x01, 0xFF, 0x00 },
        { 0x02, 0xFF, 0x00 },
        { 0x03, 0xFF, 0x00 },
        { 0x04, 0xFF, 0x04 },
        { 0x05, 0xFF, 0x03 },
        { 0x06, 0xFF, 0x00 },
        { 0x07, 0xFF, 0x06 },
        { 0x08, 0xFF, 0x03 },
        { 0x09, 0xFF, 0x00 },
        { 0x0A, 0xFF, 0x02 },
        { 0x0B, 0xFF, 0x05 },
        { 0x0C, 0xFF, 0x00 },
        { 0x0D, 0xFF, 0x02 },
        { 0x0E, 0xFF, 0x00 },
        { 0x0F, 0xFF, 0x0D },
        { 0xFF, 0x00, 0x00 } };
#endif
#if (EXETYPE == C25_VGA)
        { 0x10, 0x00, 0x00, 0x00 },
        { 0x11, 0x09, 0x09, 0x09 },
        { 0x12, 0x12, 0x12, 0x12 },
        { 0x13, 0x12, 0x09, 0x00 },
        { 0x14, 0x00, 0x36, 0x36 },
        { 0x15, 0x1B, 0x09, 0x00 },
        { 0x16, 0x00, 0x12, 0x00 },
        { 0x17, 0x00, 0x24, 0x00 },
        { 0x18, 0x2D, 0x00, 0x00 },
        { 0x19, 0x2D, 0x1B, 0x00 },
        { 0x1A, 0x24, 0x12, 0x09 },
        { 0x1B, 0x3F, 0x2D, 0x00 },
        { 0x1C, 0x00, 0x00, 0x00 },
        { 0x1D, 0x1B, 0x1B, 0x1B },
        { 0x1E, 0x00, 0x00, 0x2D },
        { 0x1F, 0x2D, 0x2D, 0x2D },
        { 0xFF, 0x00, 0x00, 0x00 } };
#endif
COLOR_DEF G8154_LIGHT3[17] = {
#if ((EXETYPE == C23_EGA) || (EXETYPE == C24_TANDY))
        { 0x00, 0xFF, 0x00 },
        { 0x01, 0xFF, 0x00 },
        { 0x02, 0xFF, 0x00 },
        { 0x03, 0xFF, 0x00 },
        { 0x04, 0xFF, 0x04 },
        { 0x05, 0xFF, 0x03 },
        { 0x06, 0xFF, 0x00 },
        { 0x07, 0xFF, 0x06 },
        { 0x08, 0xFF, 0x03 },
        { 0x09, 0xFF, 0x00 },
        { 0x0A, 0xFF, 0x02 },
        { 0x0B, 0xFF, 0x05 },
        { 0x0C, 0xFF, 0x00 },
        { 0x0D, 0xFF, 0x02 },
        { 0x0E, 0xFF, 0x00 },
        { 0x0F, 0xFF, 0x0D },
        { 0xFF, 0x00, 0x00 } };
#endif
#if (EXETYPE == C25_VGA)
        { 0x10, 0x00, 0x00, 0x00 },
        { 0x11, 0x00, 0x00, 0x00 },
        { 0x12, 0x09, 0x09, 0x09 },
        { 0x13, 0x09, 0x00, 0x00 },
        { 0x14, 0x00, 0x36, 0x36 },
        { 0x15, 0x12, 0x09, 0x00 },
        { 0x16, 0x00, 0x09, 0x00 },
        { 0x18, 0x00, 0x1B, 0x00 },
        { 0x18, 0x24, 0x00, 0x00 },
        { 0x19, 0x24, 0x12, 0x00 },
        { 0x1A, 0x1B, 0x09, 0x00 },
        { 0x1B, 0x36, 0x24, 0x00 },
        { 0x1C, 0x00, 0x00, 0x00 },
        { 0x1D, 0x12, 0x12, 0x12 },
        { 0x1E, 0x00, 0x00, 0x24 },
        { 0x1F, 0x24, 0x24, 0x24 },
        { 0xFF, 0x00, 0x00, 0x00 } };
#endif
COLOR_DEF G8155_LIGHT4[17] = {
#if ((EXETYPE == C23_EGA) || (EXETYPE == C24_TANDY))
        { 0x00, 0xFF, 0x00 },
        { 0x01, 0xFF, 0x00 },
        { 0x02, 0xFF, 0x00 },
        { 0x03, 0xFF, 0x00 },
        { 0x04, 0xFF, 0x04 },
        { 0x05, 0xFF, 0x03 },
        { 0x06, 0xFF, 0x00 },
        { 0x07, 0xFF, 0x06 },
        { 0x08, 0xFF, 0x03 },
        { 0x09, 0xFF, 0x00 },
        { 0x0A, 0xFF, 0x02 },
        { 0x0B, 0xFF, 0x05 },
        { 0x0C, 0xFF, 0x00 },
        { 0x0D, 0xFF, 0x02 },
        { 0x0E, 0xFF, 0x00 },
        { 0x0F, 0xFF, 0x0D },
        { 0xFF, 0x00, 0x00 } };
#endif
#if (EXETYPE == C25_VGA)
        { 0x10, 0x00, 0x00, 0x00 },
        { 0x11, 0x00, 0x00, 0x00 },
        { 0x12, 0x00, 0x00, 0x00 },
        { 0x13, 0x00, 0x00, 0x00 },
        { 0x14, 0x00, 0x36, 0x36 },
        { 0x15, 0x09, 0x00, 0x00 },
        { 0x16, 0x00, 0x00, 0x00 },
        { 0x17, 0x00, 0x12, 0x00 },
        { 0x18, 0x1B, 0x00, 0x00 },
        { 0x19, 0x1B, 0x09, 0x00 },
        { 0x1A, 0x12, 0x00, 0x00 },
        { 0x1B, 0x2D, 0x1B, 0x00 },
        { 0x1C, 0x00, 0x00, 0x00 },
        { 0x1D, 0x09, 0x09, 0x09 },
        { 0x1E, 0x00, 0x00, 0x1B },
        { 0x1F, 0x1B, 0x1B, 0x1B },
        { 0xFF, 0x00, 0x00, 0x00 } };
#endif
COLOR_DEF G8156_LIGHT5[17] = {
#if ((EXETYPE == C23_EGA) || (EXETYPE == C24_TANDY))
        { 0x00, 0xFF, 0x00 },
        { 0x01, 0xFF, 0x00 },
        { 0x02, 0xFF, 0x00 },
        { 0x03, 0xFF, 0x00 },
        { 0x04, 0xFF, 0x04 },
        { 0x05, 0xFF, 0x00 },
        { 0x06, 0xFF, 0x00 },
        { 0x07, 0xFF, 0x00 },
        { 0x08, 0xFF, 0x00 },
        { 0x09, 0xFF, 0x00 },
        { 0x0A, 0xFF, 0x00 },
        { 0x0B, 0xFF, 0x00 },
        { 0x0C, 0xFF, 0x00 },
        { 0x0D, 0xFF, 0x00 },
        { 0x0E, 0xFF, 0x00 },
        { 0x0F, 0xFF, 0x02 },
        { 0xFF, 0x00, 0x00 } };
#endif
#if (EXETYPE == C25_VGA)
        { 0x10, 0x00, 0x00, 0x00 },
        { 0x11, 0x00, 0x00, 0x00 },
        { 0x12, 0x00, 0x00, 0x00 },
        { 0x13, 0x00, 0x00, 0x00 },
        { 0x14, 0x00, 0x36, 0x36 },
        { 0x15, 0x00, 0x00, 0x00 },
        { 0x16, 0x00, 0x00, 0x00 },
        { 0x17, 0x00, 0x09, 0x00 },
        { 0x18, 0x12, 0x00, 0x00 },
        { 0x19, 0x12, 0x00, 0x00 },
        { 0x1A, 0x09, 0x00, 0x00 },
        { 0x1B, 0x1B, 0x12, 0x00 },
        { 0x1C, 0x00, 0x00, 0x00 },
        { 0x1D, 0x00, 0x00, 0x00 },
        { 0x1E, 0x00, 0x00, 0x12 },
        { 0x1F, 0x12, 0x12, 0x12 },
        { 0xFF, 0x00, 0x00, 0x00 } };
#endif
#if ((EXETYPE == C23_EGA) || (EXETYPE == C24_TANDY))
COLOR_DEF G8157_BLACK[17] = {
        { 0x00, 0x00, 0xFF },
        { 0x01, 0x00, 0xFF },
        { 0x02, 0x00, 0xFF },
        { 0x03, 0x00, 0xFF },
        { 0x04, 0x00, 0xFF },
        { 0x05, 0x00, 0xFF },
        { 0x06, 0x00, 0xFF },
        { 0x07, 0x00, 0xFF },
        { 0x08, 0x00, 0xFF },
        { 0x09, 0x00, 0xFF },
        { 0x0A, 0x00, 0xFF },
        { 0x0B, 0x00, 0xFF },
        { 0x0C, 0x00, 0xFF },
        { 0x0D, 0x00, 0xFF },
        { 0x0E, 0x00, 0xFF },
        { 0x0F, 0x00, 0xFF },
        { 0xFF, 0x00, 0x00 } };
#endif
#if (EXETYPE == C25_VGA)
COLOR_DEF G8157_BLACK[33] = {
        { 0x00, 0x00, 0x00, 0x00 },
        { 0x01, 0x00, 0x00, 0x00 },
        { 0x02, 0x00, 0x00, 0x00 },
        { 0x03, 0x00, 0x00, 0x00 },
        { 0x04, 0x00, 0x00, 0x00 },
        { 0x05, 0x00, 0x00, 0x00 },
        { 0x06, 0x00, 0x00, 0x00 },
        { 0x07, 0x00, 0x00, 0x00 },
        { 0x08, 0x00, 0x00, 0x00 },
        { 0x09, 0x00, 0x00, 0x00 },
        { 0x0A, 0x00, 0x00, 0x00 },
        { 0x0B, 0x00, 0x00, 0x00 },
        { 0x0C, 0x00, 0x00, 0x00 },
        { 0x0D, 0x00, 0x00, 0x00 },
        { 0x0E, 0x00, 0x00, 0x00 },
        { 0x0F, 0x00, 0x00, 0x00 },
        { 0x10, 0x00, 0x00, 0x00 },
        { 0x11, 0x00, 0x00, 0x00 },
        { 0x12, 0x00, 0x00, 0x00 },
        { 0x13, 0x00, 0x00, 0x00 },
        { 0x14, 0x00, 0x00, 0x00 },
        { 0x15, 0x00, 0x00, 0x00 },
        { 0x16, 0x00, 0x00, 0x00 },
        { 0x17, 0x00, 0x00, 0x00 },
        { 0x18, 0x00, 0x00, 0x00 },
        { 0x19, 0x00, 0x00, 0x00 },
        { 0x1A, 0x00, 0x00, 0x00 },
        { 0x1B, 0x00, 0x00, 0x00 },
        { 0x1C, 0x00, 0x00, 0x00 },
        { 0x1D, 0x00, 0x00, 0x00 },
        { 0x1E, 0x00, 0x00, 0x00 },
        { 0x1F, 0x00, 0x00, 0x00 },
        { 0xFF, 0x00, 0x00, 0x00 } };
#endif
#if ((EXETYPE == C23_EGA) || (EXETYPE == C24_TANDY))
COLOR_DEF G8158_BLUE[17] = {
        { 0x00, 0x01, 0xFF },
        { 0x01, 0x01, 0xFF },
        { 0x02, 0x01, 0xFF },
        { 0x03, 0x01, 0xFF },
        { 0x04, 0x01, 0xFF },
        { 0x05, 0x01, 0xFF },
        { 0x06, 0x01, 0xFF },
        { 0x07, 0x01, 0xFF },
        { 0x08, 0x01, 0xFF },
        { 0x09, 0x01, 0xFF },
        { 0x0A, 0x01, 0xFF },
        { 0x0B, 0x01, 0xFF },
        { 0x0C, 0x01, 0xFF },
        { 0x0D, 0x01, 0xFF },
        { 0x0E, 0x01, 0xFF },
        { 0x0F, 0x01, 0xFF },
        { 0xFF, 0x00, 0x00 } };
#endif
#if (EXETYPE == C25_VGA)
COLOR_DEF G8158_BLUE[33] = {
        { 0x00, 0x00, 0x00, 0x00 },
        { 0x01, 0x00, 0x00, 0x00 },
        { 0x02, 0x00, 0x00, 0x00 },
        { 0x03, 0x00, 0x00, 0x00 },
        { 0x04, 0x00, 0x00, 0x00 },
        { 0x05, 0x00, 0x00, 0x00 },
        { 0x06, 0x00, 0x00, 0x00 },
        { 0x07, 0x00, 0x00, 0x00 },
        { 0x08, 0x00, 0x00, 0x00 },
        { 0x09, 0x00, 0x00, 0x00 },
        { 0x0A, 0x00, 0x00, 0x00 },
        { 0x0B, 0x00, 0x00, 0x00 },
        { 0x0C, 0x00, 0x00, 0x00 },
        { 0x0D, 0x00, 0x00, 0x00 },
        { 0x0E, 0x00, 0x00, 0x00 },
        { 0x0F, 0x00, 0x00, 0x00 },
        { 0x10, 0x00, 0x00, 0x00 },
        { 0x11, 0x00, 0x00, 0x00 },
        { 0x12, 0x00, 0x00, 0x00 },
        { 0x13, 0x00, 0x00, 0x00 },
        { 0x14, 0x00, 0x00, 0x00 },
        { 0x15, 0x00, 0x00, 0x00 },
        { 0x16, 0x00, 0x00, 0x00 },
        { 0x17, 0x00, 0x00, 0x00 },
        { 0x18, 0x00, 0x00, 0x00 },
        { 0x19, 0x00, 0x00, 0x00 },
        { 0x1A, 0x00, 0x00, 0x00 },
        { 0x1B, 0x00, 0x00, 0x00 },
        { 0x1C, 0x00, 0x00, 0x00 },
        { 0x1D, 0x00, 0x00, 0x00 },
        { 0x1E, 0x00, 0x00, 0x00 },
        { 0x1F, 0x00, 0x00, 0x00 },
        { 0xFF, 0x00, 0x00, 0x00 } };
#endif
#if ((EXETYPE == C23_EGA) || (EXETYPE == C24_TANDY))
COLOR_DEF G8159_PRESENTS[2] = {
        { 0x0F, 0x0F, 0xFF },
        { 0xFF, 0x00, 0xFF } };
#endif
#if (EXETYPE == C25_VGA)
COLOR_DEF G8159_PRESENTS[17] = {
        { 0x00, 0x00, 0x00, 0x00 },
        { 0x01, 0x00, 0x00, 0x00 },
        { 0x02, 0x00, 0x00, 0x00 },
        { 0x03, 0x00, 0x00, 0x00 },
        { 0x04, 0x00, 0x00, 0x00 },
        { 0x05, 0x00, 0x00, 0x00 },
        { 0x06, 0x00, 0x00, 0x00 },
        { 0x07, 0x00, 0x00, 0x00 },
        { 0x08, 0x00, 0x00, 0x00 },
        { 0x09, 0x00, 0x00, 0x00 },
        { 0x0A, 0x00, 0x00, 0x00 },
        { 0x0B, 0x00, 0x00, 0x00 },
        { 0x0C, 0x00, 0x00, 0x00 },
        { 0x0D, 0x00, 0x00, 0x00 },
        { 0x0E, 0x00, 0x00, 0x00 },
        { 0x0F, 0x3F, 0x3F, 0x3F },
        { 0xFF, 0x00, 0x00, 0x00 } };
#endif
COLOR_DEF G8160_DUNGEON[10] = {
#if ((EXETYPE == C23_EGA) || (EXETYPE == C24_TANDY))
        { 0x03, 0x0E, 0xFF },
        { 0x04, 0x06, 0xFF },
        { 0x05, 0x0E, 0xFF },
        { 0x06, 0x06, 0xFF },
        { 0x07, 0x0E, 0xFF },
        { 0x08, 0x0F, 0xFF },
        { 0x0B, 0x04, 0xFF },
        { 0x0C, 0x0C, 0xFF },
        { 0x0F, 0x00, 0xFF },
        { 0xFF, 0x00, 0x00 } };
#endif
#if (EXETYPE == C25_VGA)
        { 0x03, 0x2F, 0x27, 0x0F },
        { 0x04, 0x27, 0x17, 0x0F },
        { 0x05, 0x37, 0x2F, 0x0F },
        { 0x06, 0x2F, 0x17, 0x0F },
        { 0x07, 0x37, 0x37, 0x17 },
        { 0x08, 0x3F, 0x3F, 0x0F },
        { 0x0B, 0x1F, 0x0F, 0x07 },
        { 0x0C, 0x3F, 0x00, 0x00 },
        { 0x0F, 0x3F, 0x3F, 0x3F },
        { 0xFF, 0x00, 0x00, 0x00 } };
#endif
#if ((EXETYPE == C23_EGA) || (EXETYPE == C24_TANDY))
COLOR_DEF G8161_MASTER[3] = {
        { 0x0A, 0x00, 0xFF },
        { 0x0C, 0x0C, 0xFF },
        { 0xFF, 0x00, 0x00 } };
#endif
#if (EXETYPE == C25_VGA)
COLOR_DEF G8161_MASTER[2] = {
        { 0x0C, 0x3F, 0x00, 0x00 },
        { 0xFF, 0x00, 0x00, 0x00 } };
#endif
COLOR_DEF G8162_SWOOSH1[2] = {
#if ((EXETYPE == C23_EGA) || (EXETYPE == C24_TANDY))
        { 0x01, 0x0F, 0xFF },
        { 0xFF, 0x00, 0x00 } };
#endif
#if (EXETYPE == C25_VGA)
        { 0x01, 0x3F, 0x3F, 0x3F },
        { 0xFF, 0x00, 0x00, 0x00 } };
#endif
COLOR_DEF G8163_SWOOSH2[2] = {
#if ((EXETYPE == C23_EGA) || (EXETYPE == C24_TANDY))
        { 0x02, 0x0F, 0xFF },
        { 0xFF, 0x00, 0x00 } };
#endif
#if (EXETYPE == C25_VGA)
        { 0x02, 0x3F, 0x3F, 0x3F },
        { 0xFF, 0x00, 0x00, 0x00 } };
#endif
COLOR_DEF G8164_SWOOSH3[2] = {
#if ((EXETYPE == C23_EGA) || (EXETYPE == C24_TANDY))
        { 0x03, 0x0F, 0xFF },
        { 0xFF, 0x00, 0x00 } };
#endif
#if (EXETYPE == C25_VGA)
        { 0x03, 0x3F, 0x3F, 0x3F },
        { 0xFF, 0x00, 0x00, 0x00 } };
#endif
COLOR_DEF G8165_SWOOSH4[2] = {
#if ((EXETYPE == C23_EGA) || (EXETYPE == C24_TANDY))
        { 0x04, 0x0F, 0xFF },
        { 0xFF, 0x00, 0x00 } };
#endif
#if (EXETYPE == C25_VGA)
        { 0x04, 0x3F, 0x3F, 0x3F },
        { 0xFF, 0x00, 0x00, 0x00 } };
#endif
COLOR_DEF G8166_SWOOSH5[2] = {
#if ((EXETYPE == C23_EGA) || (EXETYPE == C24_TANDY))
        { 0x05, 0x0F, 0xFF },
        { 0xFF, 0x00, 0x00 } };
#endif
#if (EXETYPE == C25_VGA)
        { 0x05, 0x3F, 0x3F, 0x3F },
        { 0xFF, 0x00, 0x00, 0x00 } };
#endif
COLOR_DEF G8167_SWOOSH6[2] = {
#if ((EXETYPE == C23_EGA) || (EXETYPE == C24_TANDY))
        { 0x06, 0x0F, 0xFF },
        { 0xFF, 0x00, 0x00 } };
#endif
#if (EXETYPE == C25_VGA)
        { 0x06, 0x3F, 0x3F, 0x3F },
        { 0xFF, 0x00, 0x00, 0x00 } };
#endif
COLOR_DEF G8168_SWOOSH7[2] = {
#if ((EXETYPE == C23_EGA) || (EXETYPE == C24_TANDY))
        { 0x07, 0x0F, 0xFF },
        { 0xFF, 0x00, 0x00 } };
#endif
#if (EXETYPE == C25_VGA)
        { 0x07, 0x3F, 0x3F, 0x3F },
        { 0xFF, 0x00, 0x00, 0x00 } };
#endif
COLOR_DEF G8169_SWOOSH8[5] = {
#if ((EXETYPE == C23_EGA) || (EXETYPE == C24_TANDY))
        { 0x08, 0x0F, 0xFF },
        { 0x09, 0x0F, 0xFF },
        { 0x0A, 0x07, 0xFF },
        { 0x0F, 0x0F, 0xFF },
        { 0xFF, 0x00, 0x00 } };
#endif
#if (EXETYPE == C25_VGA)
        { 0x08, 0x3F, 0x3F, 0x3F },
        { 0x09, 0x3F, 0x3F, 0x3F },
        { 0x0A, 0x2F, 0x2F, 0x2F },
        { 0x0F, 0x3F, 0x3F, 0x3F },
        { 0xFF, 0x00, 0x00, 0x00 } };
#endif
COLOR_DEF G8170_SWOOSH9[5] = {
#if ((EXETYPE == C23_EGA) || (EXETYPE == C24_TANDY))
        { 0x08, 0x00, 0xFF },
        { 0x0B, 0x0F, 0xFF },
        { 0x0C, 0x07, 0xFF },
        { 0x0D, 0x08, 0xFF },
        { 0xFF, 0x00, 0x00 } };
#endif
#if (EXETYPE == C25_VGA)
        { 0x08, 0x00, 0x00, 0x00 },
        { 0x0B, 0x3F, 0x3F, 0x3F },
        { 0x0C, 0x2F, 0x2F, 0x2F },
        { 0x0D, 0x1F, 0x1F, 0x1F },
        { 0xFF, 0x00, 0x00, 0x00 } };
#endif
COLOR_DEF G8171_SWOOSH10[3] = {
#if ((EXETYPE == C23_EGA) || (EXETYPE == C24_TANDY))
        { 0x0E, 0x0E, 0xFF },
        { 0x0F, 0x0E, 0xFF },
        { 0xFF, 0x00, 0x00 } };
#endif
#if (EXETYPE == C25_VGA)
        { 0x0E, 0x3F, 0x3F, 0x00 },
        { 0x0F, 0x3F, 0x3F, 0x00 },
        { 0xFF, 0x00, 0x00, 0x00 } };
#endif
#if ((EXETYPE == C23_EGA) || (EXETYPE == C24_TANDY))
COLOR_DEF G8130_[17] = {
        { 0x00, 0x00, 0x00 },
        { 0x01, 0x08, 0x01 },
        { 0x02, 0x09, 0x02 },
        { 0x03, 0x01, 0x03 },
        { 0x04, 0x0A, 0x04 },
        { 0x05, 0x04, 0x05 },
        { 0x06, 0x04, 0x06 },
        { 0x07, 0x0C, 0x07 },
        { 0x08, 0x0C, 0x08 },
        { 0x09, 0x0C, 0x09 },
        { 0x0A, 0x04, 0x0A },
        { 0x0B, 0x07, 0x0B },
        { 0x0C, 0x0C, 0x0C },
        { 0x0D, 0x06, 0x0D },
        { 0x0E, 0x0E, 0x0E },
        { 0x0F, 0x0B, 0x0F },
        { 0xFF, 0x00, 0x00 } };
#endif
#if (EXETYPE == C25_VGA)
COLOR_DEF G8172_[17] = {
        { 0x00, 0x00, 0x00, 0x00 },
        { 0x01, 0x00, 0x00, 0x14 },
        { 0x02, 0x00, 0x00, 0x1C },
        { 0x03, 0x00, 0x00, 0x24 },
        { 0x04, 0x00, 0x00, 0x34 },
        { 0x05, 0x00, 0x18, 0x2C },
        { 0x06, 0x00, 0x24, 0x28 },
        { 0x07, 0x1C, 0x14, 0x0C },
        { 0x08, 0x3F, 0x3F, 0x00 },
        { 0x09, 0x14, 0x14, 0x14 },
        { 0x0A, 0x20, 0x20, 0x20 },
        { 0x0B, 0x28, 0x28, 0x28 },
        { 0x0C, 0x28, 0x1C, 0x14 },
        { 0x0D, 0x3F, 0x00, 0x00 },
        { 0x0E, 0x28, 0x08, 0x08 },
        { 0x0F, 0x3F, 0x30, 0x28 },
        { 0xFF, 0x00, 0x00, 0x00 } };
COLOR_DEF G8173_[17] = {
        { 0x00, 0x03, 0x03, 0x03 },
        { 0x01, 0x33, 0x1B, 0x0B },
        { 0x02, 0x1F, 0x13, 0x07 },
        { 0x03, 0x2B, 0x17, 0x0B },
        { 0x04, 0x3F, 0x03, 0x03 },
        { 0x05, 0x2F, 0x03, 0x03 },
        { 0x06, 0x03, 0x03, 0x2F },
        { 0x07, 0x03, 0x03, 0x3F },
        { 0x08, 0x17, 0x17, 0x17 },
        { 0x09, 0x1F, 0x1F, 0x1F },
        { 0x0A, 0x2F, 0x2F, 0x2F },
        { 0x0B, 0x37, 0x37, 0x37 },
        { 0x0C, 0x23, 0x1B, 0x13 },
        { 0x0D, 0x27, 0x23, 0x17 },
        { 0x0E, 0x33, 0x27, 0x1B },
        { 0x0F, 0x3B, 0x2B, 0x1F },
        { 0xFF, 0x00, 0x00, 0x00 } };
COLOR_DEF G8174_[17] = {
        { 0x00, 0x00, 0x00, 0x00 },
        { 0x01, 0x1B, 0x1B, 0x1B },
        { 0x02, 0x23, 0x23, 0x23 },
        { 0x03, 0x23, 0x13, 0x03 },
        { 0x04, 0x33, 0x2B, 0x23 },
        { 0x05, 0x13, 0x0B, 0x0B },
        { 0x06, 0x03, 0x23, 0x03 },
        { 0x07, 0x03, 0x2B, 0x03 },
        { 0x08, 0x23, 0x1B, 0x13 },
        { 0x09, 0x3F, 0x03, 0x03 },
        { 0x0A, 0x2B, 0x23, 0x1B },
        { 0x0B, 0x1B, 0x13, 0x0B },
        { 0x0C, 0x13, 0x13, 0x13 },
        { 0x0D, 0x2B, 0x2B, 0x2B },
        { 0x0E, 0x1B, 0x0B, 0x03 },
        { 0x0F, 0x3F, 0x3F, 0x3F },
        { 0xFF, 0x00, 0x00, 0x00 } };
COLOR_DEF G8175_CREAT_PAL[14][7] = {
        { { 0x01, 0x30, 0x28, 0x00 },
          { 0x02, 0x28, 0x20, 0x00 },
          { 0x03, 0x20, 0x18, 0x00 },
          { 0x04, 0x18, 0x10, 0x00 },
          { 0x05, 0x10, 0x08, 0x00 },
          { 0x06, 0x08, 0x00, 0x00 },
          { 0xFF, 0x00, 0x00, 0x00 } },
        { { 0x01, 0x00, 0x18, 0x00 },
          { 0x02, 0x00, 0x10, 0x00 },
          { 0x03, 0x00, 0x08, 0x00 },
          { 0x04, 0x00, 0x00, 0x00 },
          { 0x05, 0x00, 0x00, 0x00 },
          { 0x06, 0x00, 0x00, 0x00 },
          { 0xFF, 0x00, 0x00, 0x00 } },
        { { 0x01, 0x20, 0x18, 0x00 },
          { 0x02, 0x18, 0x10, 0x00 },
          { 0x03, 0x10, 0x08, 0x00 },
          { 0x04, 0x08, 0x00, 0x00 },
          { 0x05, 0x00, 0x00, 0x00 },
          { 0x06, 0x00, 0x00, 0x00 },
          { 0xFF, 0x00, 0x00, 0x00 } },
        { { 0x01, 0x18, 0x10, 0x00 },
          { 0x02, 0x10, 0x08, 0x00 },
          { 0x03, 0x08, 0x00, 0x00 },
          { 0x04, 0x00, 0x00, 0x00 },
          { 0x05, 0x00, 0x00, 0x00 },
          { 0x06, 0x00, 0x00, 0x00 },
          { 0xFF, 0x00, 0x00, 0x00 } },
        { { 0x01, 0x00, 0x00, 0x28 },
          { 0x02, 0x00, 0x00, 0x20 },
          { 0x03, 0x00, 0x00, 0x18 },
          { 0x04, 0x00, 0x00, 0x10 },
          { 0x05, 0x00, 0x00, 0x08 },
          { 0x06, 0x00, 0x00, 0x00 },
          { 0xFF, 0x00, 0x00, 0x00 } },
        { { 0x01, 0x00, 0x00, 0x20 },
          { 0x02, 0x00, 0x00, 0x18 },
          { 0x03, 0x00, 0x00, 0x10 },
          { 0x04, 0x00, 0x00, 0x08 },
          { 0x05, 0x00, 0x00, 0x00 },
          { 0x06, 0x00, 0x00, 0x00 },
          { 0xFF, 0x00, 0x00, 0x00 } },
        { { 0x01, 0x20, 0x00, 0x20 },
          { 0x02, 0x18, 0x00, 0x18 },
          { 0x03, 0x10, 0x00, 0x10 },
          { 0x04, 0x08, 0x00, 0x08 },
          { 0x05, 0x00, 0x00, 0x00 },
          { 0x06, 0x00, 0x00, 0x00 },
          { 0xFF, 0x00, 0x00, 0x00 } },
        { { 0x01, 0x28, 0x00, 0x28 },
          { 0x02, 0x20, 0x00, 0x20 },
          { 0x03, 0x18, 0x00, 0x18 },
          { 0x04, 0x10, 0x00, 0x10 },
          { 0x05, 0x08, 0x00, 0x08 },
          { 0x06, 0x00, 0x00, 0x00 },
          { 0xFF, 0x00, 0x00, 0x00 } },
        { { 0x01, 0x38, 0x28, 0x00 },
          { 0x02, 0x30, 0x20, 0x00 },
          { 0x03, 0x28, 0x18, 0x00 },
          { 0x04, 0x20, 0x10, 0x00 },
          { 0x04, 0x18, 0x08, 0x00 },
          { 0x05, 0x10, 0x00, 0x00 },
          { 0xFF, 0x00, 0x00, 0x00 } },
        { { 0x01, 0x38, 0x20, 0x00 },
          { 0x02, 0x30, 0x18, 0x00 },
          { 0x03, 0x28, 0x10, 0x00 },
          { 0x04, 0x20, 0x08, 0x00 },
          { 0x05, 0x18, 0x00, 0x00 },
          { 0x06, 0x10, 0x00, 0x00 },
          { 0xFF, 0x00, 0x00, 0x00 } },
        { { 0x01, 0x20, 0x00, 0x00 },
          { 0x02, 0x18, 0x00, 0x00 },
          { 0x03, 0x10, 0x00, 0x00 },
          { 0x04, 0x08, 0x00, 0x00 },
          { 0x05, 0x00, 0x00, 0x00 },
          { 0x06, 0x00, 0x00, 0x00 },
          { 0xFF, 0x00, 0x00, 0x00 } },
        { { 0x01, 0x18, 0x00, 0x00 },
          { 0x02, 0x10, 0x00, 0x00 },
          { 0x03, 0x08, 0x00, 0x00 },
          { 0x04, 0x00, 0x00, 0x00 },
          { 0x05, 0x00, 0x00, 0x00 },
          { 0x06, 0x00, 0x00, 0x00 },
          { 0xFF, 0x00, 0x00, 0x00 } },
        { { 0x01, 0x30, 0x20, 0x18 },
          { 0x02, 0x28, 0x18, 0x10 },
          { 0x03, 0x20, 0x10, 0x08 },
          { 0x04, 0x18, 0x08, 0x00 },
          { 0x05, 0x10, 0x00, 0x00 },
          { 0x06, 0x08, 0x00, 0x00 },
          { 0xFF, 0x00, 0x00, 0x00 } },
        { { 0x00, 0x00, 0x00, 0x00 },
          { 0x00, 0x00, 0x00, 0x00 },
          { 0x00, 0x00, 0x00, 0x00 },
          { 0x00, 0x00, 0x00, 0x00 },
          { 0x00, 0x00, 0x00, 0x00 },
          { 0x00, 0x00, 0x00, 0x00 },
          { 0x00, 0x00, 0x00, 0x00 } } };
#endif
COLOR_DEF* G8176_PaletteTable[29] = {
        G8151_LIGHT0,           /* C00_LIGHT0 */
        G8152_LIGHT1,           /* C01_LIGHT1 */
        G8153_LIGHT2,           /* C02_LIGHT2 */
        G8154_LIGHT3,           /* C03_LIGHT3 */
        G8155_LIGHT4,           /* C04_LIGHT4 */
        G8156_LIGHT5,           /* C05_LIGHT5 */
        G8147_CREDITS,          /* C06_CREDITS */
        G8148_ENTRANCE,         /* C07_ENTRANCE_DM */
        G8150_INVENTORY,        /* C08_INVENTORY */
        G8149_ICON,             /* C09_ICON */
        G8157_BLACK,            /* C10_ENTRANCE_BLACK */
        G8158_BLUE,             /* C11_BLUE */
        G8159_PRESENTS,         /* C12_PRESENTS */
        G8160_DUNGEON,          /* C13_DUNGEON */
        G8161_MASTER,           /* C14_MASTER */
        G8157_BLACK,            /* C15_SWOOSH_BLACK */
        G8162_SWOOSH1,          /* C16_SWOOSH1 */
        G8163_SWOOSH2,          /* C17_SWOOSH2 */
        G8164_SWOOSH3,          /* C18_SWOOSH3 */
        G8165_SWOOSH4,          /* C19_SWOOSH4 */
        G8166_SWOOSH5,          /* C20_SWOOSH5 */
        G8167_SWOOSH6,          /* C21_SWOOSH6 */
        G8168_SWOOSH7,          /* C22_SWOOSH7 */
        G8169_SWOOSH8,          /* C23_SWOOSH8 */
        G8170_SWOOSH9,          /* C24_SWOOSH9 */
        G8171_SWOOSH10,         /* C25_SWOOSH10 */
#if ((EXETYPE == C23_EGA) || (EXETYPE == C24_TANDY))
        G8130_,                 /* 26 */
        G8130_,                 /* 27 */
        G8130_ };               /* 28 */
#endif
#if (EXETYPE == C25_VGA)
        G8172_,                 /* 26 */
        G8173_,                 /* 27 */
        G8174_ };               /* 28 */
#endif
#if ((EXETYPE == C23_EGA) || (EXETYPE == C24_TANDY))
char G8132_[14][6] = {
        { 0x05, 0x05, 0x03, 0x03, 0x03, 0x00 },
        { 0x02, 0x02, 0x02, 0x02, 0x02, 0x00 },
        { 0x05, 0x05, 0x03, 0x03, 0x03, 0x00 },
        { 0x03, 0x03, 0x00, 0x00, 0x00, 0x00 },
        { 0x0E, 0x0E, 0x02, 0x02, 0x02, 0x00 },
        { 0x02, 0x02, 0x00, 0x00, 0x00, 0x00 },
        { 0x09, 0x09, 0x02, 0x02, 0x02, 0x00 },
        { 0x08, 0x08, 0x09, 0x09, 0x09, 0x02 },
        { 0x09, 0x09, 0x02, 0x02, 0x02, 0x00 },
        { 0x08, 0x08, 0x09, 0x09, 0x09, 0x02 },
        { 0x08, 0x08, 0x09, 0x09, 0x09, 0x02 },
        { 0x09, 0x09, 0x02, 0x02, 0x02, 0x00 },
        { 0x0A, 0x0A, 0x0A, 0x0A, 0x0A, 0x0A },
        { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 } };
#endif
#if (EXETYPE == C25_VGA)
char G8177_c_ViewportColorIndexOffset = 0; /* When drawing the viewport, this is set to 0x10, or'ed with color index to use colors 16-31 instead of 0-15 */
char G4094_CURTAIN_FLAG = 0;
char* G8141_apc_VideoDriverVector[32] = {
        (char*)F8163_VIDRV_00_CopyPixelsToScreenWithoutTransparency,                                         /*  0 */
        (char*)F8152_VIDRV_01_FillBox,                                         /*  1 */
        (char*)F8151_VIDRV_02_Blit,                                     /*  2 */
        (char*)F8167_VIDRV_03_BlitMousePointerPrefixedBitmapFromScreen,                                         /*  3 */
        (char*)F8168_VIDRV_04_BlitMousePointerPrefixedBitmapToScreen,                                         /*  4 */
        (char*)F8154_VIDRV_05_InvertBox,                                /*  5 */
        (char*)F8155_VIDRV_06_HatchScreenBox,                           /*  6 */
        (char*)F8153_VIDRV_07_WaitVerticalBlank,                         /*  7 */
        (char*)F8157_VIDRV_08_SetMultipleColorsInPalette,               /*  8 */
        (char*)F8161_VIDRV_09_BlitViewPort,                             /*  9 */
        (char*)F8162_VIDRV_10_ScrollMessageAreaUp,                                         /* 10 */
        (char*)F8159_VIDRV_11_PALETTE_SetCurtain,                       /* 11 */
        (char*)F8160_VIDRV_12_SetCreatureReplacementColors,             /* 12 */
        (char*)F8164_VIDRV_13_InitializeUnusedGlobalVariables,                                         /* 13 */
        (char*)F8165_VIDRV_14_GetPrefixedBitmapByteCountOrBlitFromScreenNoTransparency,             /* 14 */
        (char*)F8166_VIDRV_15_BlitToScreenNoTransparency,               /* 15 */
        (char*)F8230_VIDRV_16_SetSingleColorComponentsInPalette,        /* 16 */
        (char*)F8170_Return0,                                           /* 17 */
        (char*)F8170_Return0,                                           /* 18 */
        (char*)F8169_VIDRV_19_BlackenAllPixelsOneByOne,                 /* 19 */
        (char*)F8170_Return0,                                           /* 20 */
        (char*)F8170_Return0,                                           /* 21 */
        (char*)F8170_Return0,                                           /* 22 */
        (char*)F8170_Return0,                                           /* 23 */
        (char*)F8170_Return0,                                           /* 24 */
        (char*)F8170_Return0,                                           /* 25 */
        (char*)F8170_Return0,                                           /* 26 */
        (char*)F8170_Return0,                                           /* 27 */
        (char*)F8170_Return0,                                           /* 28 */
        (char*)F8170_Return0,                                           /* 29 */
        (char*)F8170_Return0,                                           /* 30 */
        (char*)F8170_Return0 };                                         /* 31 */
#endif
char* G8134_pc_VideoMemory;
unsigned char* G2159_puc_Bitmap_Source;
unsigned char* G2160_puc_Bitmap_Destination;
#if ((EXETYPE == C23_EGA) || (EXETYPE == C24_TANDY))
int16_t G8133_PrefixedBitmap[85];
char G8135_ac_EGATandyColorPalette[17];
char G8136_[17];
char G8138_[160];
#endif
#if (EXETYPE == C25_VGA)
int16_t G8133_PrefixedBitmap[3];
char G8181_[324];
char G8183_aac_FullPalette[32][3];
char G8184_[4]; /* Probably 3 bytes only like in FM-Towns */
#endif


#if (EXETYPE == C24_TANDY)
FUNC_DEF int16_t F8172_(
int16_t P3117_i_)
{
        unsigned int16_t L3687_ui_;
        int16_t L3688_i_;


        asm     mov     dx, 0
        asm     mov     ax, P3117_i_
        asm     mov     bx, 320
        asm     div     bx
        asm     mov     L3687_ui_, ax
        asm     mov     L3688_i_, dx
        return ((L3687_ui_ & 0x03) << 14) | (L3688_i_ + ((L3687_ui_ >> 2) * 320));
}
#endif

#if (EXETYPE == C25_VGA)
FUNC_DEF void F8140_ScrollMessageAreaUp(
char huge* P3189_pc_,
char huge* P3190_pc_,
int16_t P3191_i_)
{
        int16_t L3749_i_Unreferenced;
        int16_t L3750_i_Unreferenced;


        if (P3189_pc_ > P3190_pc_) {
                asm     cld
                asm     push    ds
                asm     lds     si, P3189_pc_
                asm     les     di, P3190_pc_
                asm     mov     cx, P3191_i_
                asm     shr     cx, 1
                asm     pushf
                loc_1038A:
                asm     rep movsw
                asm     or      cx, cx
                asm     jnz     loc_1038A
                asm     popf
                asm     jnb     loc_10394
                asm     movsb
                loc_10394:
                asm     pop     ds
        } else {
                (int16_t)P3189_pc_ += P3191_i_ - 1;
                (int16_t)P3190_pc_ += P3191_i_ - 1;
                asm     std
                asm     push    ds
                asm     lds     si, P3189_pc_
                asm     les     di, P3190_pc_
                asm     mov     cx, P3191_i_
                loc_103B0:
                asm     rep movsb
                asm     or      cx, cx
                asm     jnz     loc_103B0
                asm     pop     ds
        }
}

FUNC_DEF void F8213_SetSinglePixel_Unreferenced(
int16_t P3192_i_PixelIndex,
char P3193_c_Color)
{
        asm     cld
        asm     les     di, G8134_pc_VideoMemory
        asm     add     di, P3192_i_PixelIndex
        asm     mov     al, G8177_c_ViewportColorIndexOffset
        asm     or      al, P3193_c_Color
        asm     stosb
}
#endif

FUNC_DEF void F8137_SetMultiplePixels(
int16_t P2483_i_PixelIndex,
char P2484_c_Color,
int16_t P2485_i_PixelCount)
{
#if (EXETYPE == C23_EGA)
        asm     cld
        asm     mov     bx, P2483_i_PixelIndex
        asm     mov     cl, bl
        asm     shr     bx, 1
        asm     shr     bx, 1
        asm     shr     bx, 1
        asm     les     di, G8134_pc_VideoMemory
        asm     add     di, bx
        asm     mov     bx, P2485_i_PixelCount
        asm     mov     dx, 3CEh
        asm     mov     ax, 0A05h
        asm     out     dx, ax         /* EGA: graph 1 and 2 addr reg: */
                                       /* unknown register */
        asm     mov     ax, 7
        asm     out     dx, ax         /* EGA: graph 1 and 2 addr reg: */
                                       /* color masking disable */
                                       /* bits 0-3 disable planes from compare logic in read mode 01 */
        asm     mov     al, 8
        asm     out     dx, al         /* EGA: graph 1 and 2 addr reg: */
                                       /* bit mask */
                                       /* Bits 0-7 select bits to be masked in all planes */
        asm     inc     dx
        asm     and     cl, 7
        asm     jz      loc_103AD
        asm     mov     ch, 8
        asm     sub     ch, cl
        asm     xor     al, al
        loc_10397:
        asm     clc
        asm     cmp     bx, 0
        asm     jz      loc_1039F
        asm     stc
        asm     dec     bx
        loc_1039F:
        asm     rcl     al, 1
        asm     dec     ch
        asm     jnz     loc_10397
        asm     out     dx, al         /* EGA port: graphics controller data register */
        asm     mov     al, P2484_c_Color
        asm     mov     ah, es:[di]
        asm     stosb
        loc_103AD:
        asm     mov     cx, bx
        asm     shr     cx, 1
        asm     shr     cx, 1
        asm     shr     cx, 1
        asm     jz      loc_103C3
        asm     mov     al, 0FFh
        asm     out     dx, al         /* EGA port: graphics controller data register */
        asm     mov     al, P2484_c_Color
        loc_103BD:
        asm     rep stosb
        asm     or      cx, cx
        asm     jnz     loc_103BD
        loc_103C3:
        asm     mov     cl, bl
        asm     and     cl, 7
        asm     jz      loc_103D8
        asm     mov     al, 0FFh
        asm     shr     al, cl
        asm     xor     al, 0FFh
        asm     out     dx, al         /* EGA port: graphics controller data register */
        asm     mov     al, P2484_c_Color
        asm     mov     ah, es:[di]
        asm     stosb
        loc_103D8:
        asm     dec     dx
        asm     mov     ax, 5
        asm     out     dx, ax         /* EGA: graph 1 and 2 addr reg: */
                                       /* mode register.Data bits: */
                                       /* 0-1: Write mode 0-2 */
                                       /* 2: test condition */
                                       /* 3: read mode: 1=color compare, 0=direct */
                                       /* 4: 1=use odd/even RAM addressing */
                                       /* 5: 1=use CGA mid-res map (2-bits/pixel) */
        asm     mov     ax, 0FF08h
        asm     out     dx, ax         /* EGA: graph 1 and 2 addr reg: */
                                       /* unknown register */
#endif
#if (EXETYPE == C24_TANDY)
        asm     cld
        asm     les     di, G8134_pc_VideoMemory
        asm     mov     bx, P2483_i_PixelIndex
        asm     mov     cx, P2485_i_PixelCount
        asm     mov     ah, P2484_c_Color
        asm     shr     bx, 1
        asm     pushf
        asm     add     di, bx
        asm     popf
        asm     jnb     loc_103A2
        asm     mov     al, es:[di]
        asm     and     al, 0F0h
        asm     or      al, ah
        asm     stosb
        asm     dec     cx
        asm     jz      loc_103CA
        loc_103A2:
        asm     mov     al, ah
        asm     shl     al, 1
        asm     shl     al, 1
        asm     shl     al, 1
        asm     shl     al, 1
        asm     or      al, ah
        asm     mov     ah, al
        asm     shr     cx, 1
        asm     pushf
        asm     shr     cx, 1
        asm     jnb     loc_103B8
        asm     stosb
        loc_103B8:
        asm     rep stosw
        asm     or      cx, cx
        asm     jnz     loc_103B8
        asm     popf
        asm     jnb     loc_103CA
        asm     mov     al, es:[di]
        asm     and     ax, 0F00Fh
        asm     or      al, ah
        asm     stosb
        loc_103CA: ;
#endif
#if (EXETYPE == C25_VGA)
        asm     cld
        asm     les     di, G8134_pc_VideoMemory
        asm     add     di, P2483_i_PixelIndex
        asm     mov     cx, P2485_i_PixelCount
        asm     mov     al, G8177_c_ViewportColorIndexOffset
        asm     or      al, P2484_c_Color
        asm     mov     ah, al
        asm     shr     cx, 1
        asm     jnb     loc_103ED
        asm     stosb
        loc_103ED:
        asm     rep stosw
        asm     or      cx, cx
        asm     jnz     loc_103ED
#endif
}

#if ((EXETYPE == C23_EGA) || (EXETYPE == C24_TANDY))
FUNC_DEF void F8138_(
int16_t P2486_i_,
char P2487_i_)
{
#if (EXETYPE == C23_EGA)
        F8137_SetMultiplePixels(P2486_i_, P2487_i_, 1);
#endif
#if (EXETYPE == C24_TANDY)
        F8137_SetMultiplePixels(F8172_(P2486_i_), P2487_i_, 1);
#endif
}
#endif

FUNC_DEF void F8139_Unreferenced(
unsigned int16_t P2488_i_,
int16_t P2489_i_PixelIndex,
int16_t P2490_i_)
{
#if ((EXETYPE == C23_EGA) || (EXETYPE == C24_TANDY))
        unsigned char L2497_uc_;
#if (EXETYPE == C24_TANDY)
        unsigned char* L3690_puc_;
#endif
        unsigned int16_t L2498_ui_;


        for (L2498_ui_ = 0; L2498_ui_ < P2490_i_; L2498_ui_++) {
                if (P2488_i_ & 1) {
#if (EXETYPE == C23_EGA)
                        L2497_uc_ = G2159_puc_Bitmap_Source[P2488_i_ >> 1] & 0x0F;
#endif
#if (EXETYPE == C24_TANDY)
                        L2497_uc_ = L3690_puc_[P2488_i_ >> 1] & 0x0F;
#endif
                } else {
#if (EXETYPE == C23_EGA)
                        L2497_uc_ = G2159_puc_Bitmap_Source[P2488_i_ >> 1] >> 4;
#endif
#if (EXETYPE == C24_TANDY)
                        L2497_uc_ = L3690_puc_[P2488_i_ >> 1] >> 4;
#endif
                }
                P2488_i_++;
                F8138_(P2489_i_PixelIndex++, L2497_uc_);
        }
#endif
#if (EXETYPE == C25_VGA)
        char* L3751_pc_;
        char* L3752_pc_;
        unsigned char L3753_uc_;
        char L3754_c_;


        L3751_pc_ = G8134_pc_VideoMemory + P2489_i_PixelIndex;
        L3754_c_ = P2488_i_ & 1;
        L3752_pc_ = G2159_puc_Bitmap_Source + (P2488_i_ >> 1);
        L3753_uc_ = *L3752_pc_++;
        while (P2490_i_-- > 0) {
                if (L3754_c_) {
                        *L3751_pc_++ = G8177_c_ViewportColorIndexOffset | (L3753_uc_ & 0x0F);
                        L3754_c_ ^= 1;
                        L3753_uc_ = *L3752_pc_++;
                } else {
                        *L3751_pc_++ = G8177_c_ViewportColorIndexOffset | (L3753_uc_ >> 4);
                        L3754_c_ ^= 1;
                }
        }
#endif
}

#if ((EXETYPE == C23_EGA) || (EXETYPE == C24_TANDY))
FUNC_DEF void F8140_ScrollMessageAreaUp(
int16_t P2491_i_,
int16_t P2492_i_,
int16_t P2493_i_)
{
        asm     cld
        asm     les     di, G8134_pc_VideoMemory
        asm     mov     si, di
#if (EXETYPE == C23_EGA)
        asm     mov     ax, P2492_i_
        asm     mov     bx, ax
        asm     add     bx, P2493_i_
        asm     mov     cl, al
        asm     and     cl, 7
        asm     mov     ch, bl
        asm     and     ch, 7
        asm     shr     ax, 1
        asm     shr     ax, 1
        asm     shr     ax, 1
        asm     add     si, ax
        asm     mov     ax, P2491_i_
        asm     shr     ax, 1
        asm     shr     ax, 1
        asm     shr     ax, 1
        asm     add     di, ax
        asm     mov     bx, P2493_i_
        asm     mov     dx, 3CEh
        asm     mov     ax, 5
        asm     out     dx, ax         /* EGA: graph 1 and 2 addr reg: */
                                       /* mode register.Data bits: */
                                       /* 0-1: Write mode 0-2 */
                                       /* 2: test condition */
                                       /* 3: read mode: 1=color compare, 0=direct */
                                       /* 4: 1=use odd/even RAM addressing */
                                       /* 5: 1=use CGA mid-res map (2-bits/pixel) */
        asm     mov     ax, 0FF08h
        asm     out     dx, ax         /* EGA: graph 1 and 2 addr reg: */
                                       /* unknown register */
        asm     mov     ax, 3
        asm     out     dx, ax         /* EGA: graph 1 and 2 addr reg: */
                                       /* data rotate and function select for write mode 00. Bits: */
                                       /* 0-2: set rotate count for write mode 00 */
                                       /* 3-4: fn for write modes 00 and 02 */
                                       /*      00=no change; 01=AND; 10=OR; 11=XOR */
        asm     mov     ax, 1
        asm     out     dx, ax         /* EGA: graph 1 and 2 addr reg: */
                                       /* enable set/reset */
        asm     mov     ah, 0FFh
        asm     shr     ah, cl
        asm     mov     cl, ch
        asm     mov     al, 0FFh
        asm     shr     al, cl
        asm     xor     al, 0FFh
        asm     shr     bx, 1
        asm     shr     bx, 1
        asm     shr     bx, 1
        asm     mov     cl, 0
        loc_104B0:
        asm     push    si
        asm     push    di
        asm     push    ax
        asm     mov     dx, 3C4h
        asm     mov     ax, 102h
        asm     shl     ah, cl
        asm     out     dx, ax         /* EGA: sequencer address reg */
                                       /* unknown register */
        asm     mov     dx, 3CEh
        asm     mov     ah, cl
        asm     mov     al, 4
        asm     out     dx, ax         /* EGA: graph 1 and 2 addr reg: */
                                       /* read map select. */
                                       /* Data bits 0-2 select map # for read mode 00. */
        asm     pop     ax
        asm     cmp     ah, 0FFh
        asm     jz      loc_104DC
        asm     mov     ch, ah
        asm     xor     ch, 0FFh
        asm     and     es:[di], ch
        asm     mov     ch, es:[si]
        asm     and     ch, ah
        asm     or      es:[di], ch
        asm     inc     si
        asm     inc     di
        loc_104DC:
        asm     cmp     bx, 0           /* BX is always 40 here */
        asm     jz      loc_104F1
        asm     push    cx
        asm     mov     cx, bx
        asm     push    ds
        asm     mov     ax, es
        asm     mov     ds, ax
        loc_104E9:
        asm     rep movsb
        asm     or      cx, cx
        asm     jnz     loc_104E9
        asm     pop     ds
        asm     pop     cx
        loc_104F1:
        asm     cmp     al, 0FFh        /* AX = ES = 0xA000 (loaded from G8134_pc_VideoMemory. So AL is always 00h */
        asm     jz      loc_104DC
        asm     mov     ch, al
        asm     xor     ch, 0FFh
        asm     and     es:[di], ch
        asm     mov     ch, es:[si]
        asm     and     ch, al
        asm     or      es:[di], ch
        asm     pop     di
        asm     pop     si
        asm     inc     cl
        asm     cmp     cl, 4
        asm     jnz     loc_104B0
        asm     mov     dx, 3CEh
        asm     mov     ax, 5
        asm     out     dx, ax         /* EGA: graph 1 and 2 addr reg: */
                                       /* mode register.Data bits: */
                                       /* 0-1: Write mode 0-2 */
                                       /* 2: test condition */
                                       /* 3: read mode: 1=color compare, 0=direct */
                                       /* 4: 1=use odd/even RAM addressing */
                                       /* 5: 1=use CGA mid-res map (2-bits/pixel) */
        asm     mov     ax, 0F01h
        asm     out     dx, ax         /* EGA: graph 1 and 2 addr reg: */
                                       /* unknown register */
        asm     mov     dx, 3C4h
        asm     mov     ax, 0F02h
        asm     out     dx, ax         /* EGA: sequencer address reg */
                                       /* unknown register */
#endif
#if (EXETYPE == C24_TANDY)
        asm     mov     bx, P2491_i_
        asm     mov     dx, P2492_i_
        asm     mov     cx, P2493_i_
        asm     shr     dx, 1
        asm     shr     bx, 1
        asm     pushf
        asm     add     di, bx
        asm     add     si, dx
        asm     popf
        asm     jnb     loc_10475
        asm     mov     dl, es:[di]
        asm     lods    byte ptr es:[si]
        asm     and     dl, 0F0h
        asm     and     al, 0Fh
        asm     or      al, dl
        asm     stosb
        asm     dec     cx
        asm     jz      loc_1048A
        loc_10475:
        asm     inc     cx
        asm     shr     cx, 1
        asm     shr     cx, 1
        asm     jnb     loc_1047E
        asm     movs    byte ptr es:[di], byte ptr es:[si]
        loc_1047E:
        asm     push    ds
        asm     mov     ax, es
        asm     mov     ds, ax
        loc_10483:
        asm     rep movsw
        asm     or      cx, cx
        asm     jnz     loc_10483
        asm     pop     ds
        loc_1048A: ;
#endif
}
#endif

#if (EXETYPE == C25_VGA)
FUNC_DEF void F8216_Unreferenced(
int16_t P3200_i_,
int16_t P3201_i_)
{
        asm     cld
        asm     les     di, G8134_pc_VideoMemory
        asm     add     di, P3200_i_
        asm     mov     si, di
        asm     sub     si, 320
        asm     mov     cx, P3201_i_
        asm     shr     cx, 1
        asm     jnb     loc_104B1
        asm     movs    byte ptr es:[di], byte ptr es:[si]
        loc_104B1:
        asm     push    ds
        asm     mov     ax, es
        asm     mov     ds, ax
        loc_104B6:
        asm     rep movsw
        asm     or      cx, cx
        asm     jnz     loc_104B6
        asm     pop     ds
}

FUNC_DEF void F8143_CopyPixelLineFromScreenWithoutTransparency(
int16_t P2501_i_,
int16_t P3203_i_,
int16_t P2503_i_)
{
        asm     cld
        asm     push    ds
        asm     les     di, G2160_puc_Bitmap_Destination
        asm     mov     ax, 0A000h
        asm     mov     ds, ax
        asm     mov     si, P2501_i_
        asm     mov     cx, P2503_i_
        asm     mov     ax, P3203_i_
        asm     shr     ax, 1
        asm     pushf
        asm     add     di, ax
        asm     popf
        asm     jnb     loc_104EF
        asm     lodsb
        asm     and     al, 0Fh
        asm     mov     ah, es:[di]
        asm     and     ah, 0F0h
        asm     or      al, ah
        asm     stosb
        asm     dec     cx
        loc_104EF:
        asm     shr     cx, 1
        asm     jz      loc_10506
        asm     pushf
        loc_104F4:
        asm     lodsw
        asm     shl     al, 1
        asm     shl     al, 1
        asm     shl     al, 1
        asm     shl     al, 1
        asm     and     ah, 0Fh
        asm     or      al, ah
        asm     stosb
        asm     loop    loc_104F4
        asm     popf
        loc_10506:
        asm     jnb     loc_1051A
        asm     lodsb
        asm     shl     al, 1
        asm     shl     al, 1
        asm     shl     al, 1
        asm     shl     al, 1
        asm     mov     ah, es:[di]
        asm     and     ah, 0Fh
        asm     or      al, ah
        asm     stosb
        loc_1051A:
        asm     pop     ds
}

FUNC_DEF void F8144_CopyPixelLineFromScreenWithoutTransparencyFlippedHorizontally(
)
{
}
#endif

#include "IMAGE5.C"

#if (EXETYPE == C25_VGA)
FUNC_DEF void F0681_CopyPixelLineToScreenWithoutTransparencyFlippedHorizontally(
)
{
}
#endif

#if (EXETYPE == C24_TANDY)
FUNC_DEF void F8143_CopyPixelLineFromScreenWithoutTransparency(
int16_t P2501_i_,
int16_t P2502_i_,
int16_t P2503_i_)
{
        asm     push    ds
        asm     cld
        asm     les     di, G2160_puc_Bitmap_Destination
        asm     lds     si, G8134_pc_VideoMemory
        asm     mov     cx, P2503_i_
        asm     mov     ax, P2501_i_
        asm     shr     ax, 1
        asm     jb      loc_105EF
        asm     add     si, ax
        asm     mov     ax, P2502_i_
        asm     shr     ax, 1
        asm     jnb     loc_105BB
        asm     jmp     loc_1064B
        loc_105BB:
        asm     add     di, ax
        loc_105BD:
        asm     shr     cx, 1
        asm     pushf
        asm     shr     cx, 1
        asm     jnb     loc_105C5
        asm     movsb
        loc_105C5:
        asm     cmp     cx, 0
        asm     jz      loc_105D0
        loc_105CA:
        asm     rep movsw
        asm     or      cx, cx
        asm     jnz     loc_105CA
        loc_105D0:
        asm     popf
        asm     jnb     loc_105DD
        asm     lodsb
        asm     mov     ah, es:[di]
        asm     and     ax, 0FF0h
        asm     or      al, ah
        asm     stosb
        loc_105DD:
        asm     jmp     loc_10699
        loc_105E0:
        asm     add     di, ax
        asm     lodsb
        asm     mov     ah, es:[di]
        asm     and     ax, 0F00Fh
        asm     or      al, ah
        asm     stosb
        asm     dec     cx
        asm     jmp     loc_105BD
        loc_105EF:
        asm     add     si, ax
        asm     mov     ax, P2502_i_
        asm     shr     ax, 1
        asm     jb      loc_105E0
        asm     add     di, ax
        asm     lodsb
        asm     mov     bh, al
        asm     shr     cx, 1
        asm     pushf
        asm     jz      loc_10635
        asm     shr     cx, 1
        asm     jnb     loc_10618
        asm     pushf
        asm     lodsb
        asm     mov     bl, al
        asm     mov     ah, bh
        asm     ror     ax, 1
        asm     ror     ax, 1
        asm     ror     ax, 1
        asm     ror     ax, 1
        asm     mov     bh, bl
        asm     stosb
        asm     popf
        loc_10618:
        asm     jz      loc_10635
        asm     and     bh, 0Fh
        loc_1061D:
        asm     lodsw
        asm     mov     bl, ah
        asm     xchg    ah, bh
        asm     and     bx, 0F00Fh
        asm     or      ah, bh
        asm     mov     bh, bl
        asm     ror     ax, 1
        asm     ror     ax, 1
        asm     ror     ax, 1
        asm     ror     ax, 1
        asm     stosw
        asm     loop    loc_1061D
        loc_10635:
        asm     popf
        asm     jnb     loc_10648
        asm     mov     al, es:[di]
        asm     and     al, 0Fh
        asm     shl     bh, 1
        asm     shl     bh, 1
        asm     shl     bh, 1
        asm     shl     bh, 1
        asm     or      al, bh
        asm     stosb
        loc_10648:
        asm     jmp     loc_10699
        loc_1064B:
        asm     add     di, ax
        asm     mov     bh, es:[di]
        asm     inc     cx
        asm     shr     cx, 1
        asm     pushf
        asm     jz      loc_1068E
        asm     shr     cx, 1
        asm     jnb     loc_10671
        asm     pushf
        asm     lodsb
        asm     and     bh, 0F0h
        asm     ror     al, 1
        asm     ror     al, 1
        asm     ror     al, 1
        asm     ror     al, 1
        asm     mov     bl, al
        asm     and     al, 0Fh
        asm     or      al, bh
        asm     mov     bh, bl
        asm     stosb
        asm     popf
        loc_10671:
        asm     jz      loc_1068E
        asm     and     bh, 0F0h
        loc_10676:
        asm     lodsw
        asm     ror     ax, 1
        asm     ror     ax, 1
        asm     ror     ax, 1
        asm     ror     ax, 1
        asm     mov     bl, al
        asm     xchg    al, bh
        asm     and     bx, 0FF0h
        asm     or      al, bh
        asm     mov     bh, bl
        asm     stosw
        asm     loop    loc_10676
        loc_1068E:
        asm     popf
        asm     jnb     loc_10699
        asm     mov     al, es:[di]
        asm     and     al, 0Fh
        asm     or      al, bh
        asm     stosb
        loc_10699:
        asm     pop     ds
}
#endif

FUNC_DEF void F0682_CopyPixelLineToScreenWithTransparency(
int16_t P2325_i_A,
int16_t P2326_i_DestinationOffset,
int16_t P2327_i_PixelCount,
char P2328_c_TransparentColor)
{
#if (EXETYPE == C23_EGA)
        asm     cld
        asm     push    ds
        asm     mov     bx, P2326_i_DestinationOffset
        asm     mov     cl, bl
        asm     shr     bx, 1
        asm     shr     bx, 1
        asm     shr     bx, 1
        asm     les     di, G8134_pc_VideoMemory
        asm     add     di, bx
        asm     mov     al, 80h
        asm     ror     al, cl
        asm     mov     cx, P2327_i_PixelCount
        asm     mov     bh, P2328_c_TransparentColor
        asm     mov     dx, P2325_i_A
        asm     shr     dx, 1
        asm     pushf
        asm     lds     si, G2159_puc_Bitmap_Source
        asm     add     si, dx
        asm     mov     dx, ds
        asm     dec     dx
        asm     mov     ds, dx
        asm     add     si, 10h
        asm     push    ax
        asm     mov     dx, 3CEh
        asm     mov     ax, 0A05h
        asm     out     dx, ax         /* EGA: graph 1 and 2 addr reg: */
                                       /* unknown register */
        asm     mov     ax, 7
        asm     out     dx, ax         /* EGA: graph 1 and 2 addr reg: */
                                       /* color masking disable */
                                       /* bits 0-3 disable planes from compare logic in read mode 01 */
        asm     mov     al, 8
        asm     out     dx, al         /* EGA: graph 1 and 2 addr reg: */
                                       /* bit mask */
                                       /* Bits 0-7 select bits to be masked in all planes */
        asm     mov     al, 8
        asm     out     dx, al         /* EGA: graph 1 and 2 addr reg: */
                                       /* bit mask */
                                       /* Bits 0-7 select bits to be masked in all planes */
        asm     inc     dx
        asm     pop     ax
        asm     popf
        asm     jnb     loc_106E3
        asm     jmp     loc_1078A
        loc_106E3:
        asm     mov     bl, [si]
        asm     inc     si
        asm     test    al, 80h
        asm     jnz     loc_1071C
        loc_106EA:
        asm     mov     ah, bl
        asm     shr     ah, 1
        asm     shr     ah, 1
        asm     shr     ah, 1
        asm     shr     ah, 1
        asm     cmp     ah, bh
        asm     jz      loc_106FC
        asm     out     dx, al         /* EGA port: graphics controller data register */
        asm     and     es:[di], ah
        loc_106FC:
        asm     dec     cx
        asm     jz      loc_10756
        asm     ror     al, 1
        asm     jnb     loc_10706
        asm     jmp     loc_107C4
        loc_10706:
        asm     and     bl, 0Fh
        asm     cmp     bl, bh
        asm     jz      loc_10711
        asm     out     dx, al         /* EGA port: graphics controller data register */
        asm     and     es:[di], bl
        loc_10711:
        asm     mov     bl, [si]
        asm     inc     si
        asm     dec     cx
        asm     jz      loc_10787
        asm     ror     al, 1
        asm     jnb     loc_106EA
        loc_1071B:
        asm     inc     di
        loc_1071C:
        asm     test    cx, 0FFF8h
        asm     jz      loc_10758
        asm     push    cx
        asm     shr     cx, 1
        asm     shr     cx, 1
        asm     shr     cx, 1
        loc_10729:
        asm     mov     ah, bl
        asm     shr     ah, 1
        asm     shr     ah, 1
        asm     shr     ah, 1
        asm     shr     ah, 1
        asm     cmp     ah, bh
        asm     jz      loc_1073B
        asm     out     dx, al         /* EGA port: graphics controller data register */
        asm     and     es:[di], ah
        loc_1073B:
        asm     ror     al, 1
        asm     and     bl, 0Fh
        asm     cmp     bl, bh
        asm     jz      loc_10748
        asm     out     dx, al         /* EGA port: graphics controller data register */
        asm     and     es:[di], bl
        loc_10748:
        asm     mov     bl, [si]
        asm     inc     si
        asm     ror     al, 1
        asm     jnb     loc_10729
        asm     inc     di
        asm     loop    loc_10729
        asm     pop     cx
        asm     and     cx, 7
        loc_10756:
        asm     jz      loc_10787
        loc_10758:
        asm     mov     ah, bl
        asm     shr     ah, 1
        asm     shr     ah, 1
        asm     shr     ah, 1
        asm     shr     ah, 1
        asm     cmp     ah, bh
        asm     jz      loc_1076A
        asm     out     dx, al         /* EGA port: graphics controller data register */
        asm     and     es:[di], ah
        loc_1076A:
        asm     ror     al, 1
        asm     adc     di, 0
        asm     dec     cx
        asm     jz      loc_10787
        asm     and     bl, 0Fh
        asm     cmp     bl, bh
        asm     jz      loc_1077D
        asm     out     dx, al         /* EGA port: graphics controller data register */
        asm     and     es:[di], bl
        loc_1077D:
        asm     mov     bl, [si]
        asm     inc     si
        asm     ror     al, 1
        asm     adc     di, 0
        asm     loop    loc_10758
        loc_10787:
        asm     jmp     loc_10834
        loc_1078A:
        asm     mov     bl, [si]
        asm     inc     si
        asm     test    al, 80h
        asm     jnz     loc_107C5
        loc_10791:
        asm     mov     ah, bl
        asm     and     ah, 0Fh
        asm     cmp     ah, bh
        asm     jz      loc_1079E
        asm     out     dx, al         /* EGA port: graphics controller data register */
        asm     and     es:[di], bl
        loc_1079E:
        asm     mov     bl, [si]
        asm     inc     si
        asm     dec     cx
        asm     jz      loc_10801
        asm     ror     al, 1
        asm     jnb     loc_107AB
        asm     jmp     loc_1071B
        loc_107AB:
        asm     mov     ah, bl
        asm     shr     ah, 1
        asm     shr     ah, 1
        asm     shr     ah, 1
        asm     shr     ah, 1
        asm     cmp     ah, bh
        asm     jz      loc_107BD
        asm     out     dx, al         /* EGA port: graphics controller data register */
        asm     and     es:[di], ah
        loc_107BD:
        asm     dec     cx
        asm     jz      loc_10801
        asm     ror     al, 1
        asm     jnb     loc_10791
        loc_107C4:
        asm     inc     di
        loc_107C5:
        asm     test    cx, 0FFF8h
        asm     jz      loc_10803
        asm     push    cx
        asm     shr     cx, 1
        asm     shr     cx, 1
        asm     shr     cx, 1
        loc_107D2:
        asm     mov     ah, bl
        asm     and     ah, 0Fh
        asm     cmp     ah, bh
        asm     jz      loc_107DF
        asm     out     dx, al         /* EGA port: graphics controller data register */
        asm     and     es:[di], bl
        loc_107DF:
        asm     mov     bl, [si]
        asm     inc     si
        asm     ror     al, 1
        asm     mov     ah, bl
        asm     shr     ah, 1
        asm     shr     ah, 1
        asm     shr     ah, 1
        asm     shr     ah, 1
        asm     cmp     ah, bh
        asm     jz      loc_107F6
        asm     out     dx, al         /* EGA port: graphics controller data register */
        asm     and     es:[di], ah
        loc_107F6:
        asm     ror     al, 1
        asm     jnb     loc_107D2
        asm     inc     di
        asm     loop    loc_107D2
        asm     pop     cx
        asm     and     cx, 7
        loc_10801:
        asm     jz      loc_10834
        loc_10803:
        asm     mov     ah, bl
        asm     and     ah, 0Fh
        asm     cmp     ah, bh
        asm     jz      loc_10810
        asm     out     dx, al         /* EGA port: graphics controller data register */
        asm     and     es:[di], bl
        loc_10810:
        asm     mov     bl, [si]
        asm     inc     si
        asm     ror     al, 1
        asm     adc     di, 0
        asm     dec     cx
        asm     jz      loc_10834
        asm     mov     ah, bl
        asm     shr     ah, 1
        asm     shr     ah, 1
        asm     shr     ah, 1
        asm     shr     ah, 1
        asm     cmp     ah, bh
        asm     jz      loc_1082D
        asm     out     dx, al         /* EGA port: graphics controller data register */
        asm     and     es:[di], ah
        loc_1082D:
        asm     ror     al, 1
        asm     adc     di, 0
        asm     loop    loc_10803
        loc_10834:
        asm     pop     ds
        asm     dec     dx
        asm     mov     ax, 5
        asm     out     dx, ax         /* EGA: graph 1 and 2 addr reg: */
                                       /* mode register.Data bits: */
                                       /* 0-1: Write mode 0-2 */
                                       /* 2: test condition */
                                       /* 3: read mode: 1=color compare, 0=direct */
                                       /* 4: 1=use odd/even RAM addressing */
                                       /* 5: 1=use CGA mid-res map (2-bits/pixel) */
        asm     mov     ax, 0FF08h
        asm     out     dx, ax         /* EGA: graph 1 and 2 addr reg: */
                                       /* unknown register */
#endif
#if (EXETYPE == C24_TANDY)
        asm     push    ds
        asm     cld
        asm     les     di, G8134_pc_VideoMemory
        asm     lds     si, G2159_puc_Bitmap_Source
        asm     mov     cx, P2327_i_PixelCount
        asm     mov     bx, offset V0682000_
        asm     mov     al, 0
        asm     mov     ah, P2328_c_TransparentColor
        asm     add     bx, ax
        asm     mov     ax, P2325_i_A
        asm     shr     ax, 1
        asm     jb      loc_2141C
        asm     add     si, ax
        asm     mov     ax, P2326_i_DestinationOffset
        asm     shr     ax, 1
        asm     jnb     loc_213AF
        asm     jmp     loc_2146A
        loc_213AF:
        asm     add     di, ax
        loc_213B1:
        asm     shr     cx, 1
        asm     pushf
        asm     jz      loc_213E6
        loc_106D4:
        asm     lodsb
        asm     mov     ah, al
        asm     mov     dl, al
        asm     xlat    byte ptr cs:[bx]
        asm     xor     ah, es:[di]
        asm     and     al, ah
        asm     xor     al, dl
        asm     stosb
        asm     loop    loc_106D4
        loc_213E6:
        asm     popf
        asm     jnb     loc_21402
        asm     lodsb
        asm     mov     dl, al
        asm     shr     dl, 1
        asm     shr     dl, 1
        asm     shr     dl, 1
        asm     shr     dl, 1
        asm     cmp     dl, P2328_c_TransparentColor
        asm     jz      loc_21402
        asm     mov     ah, es:[di]
        asm     and     ax, 0FF0h
        asm     or      al, ah
        asm     stosb
        loc_21402:
        goto loc_224B8;
        loc_21405:
        asm     add     di, ax
        asm     lodsb
        asm     mov     ah, es:[di]
        asm     and     ax, 0F00Fh
        asm     cmp     al, P2328_c_TransparentColor
        asm     jnz     loc_21416
        asm     inc     di
        asm     jmp     loc_21419
        loc_21416:
        asm     or      al, ah
        asm     stosb
        loc_21419:
        asm     dec     cx
        asm     jmp     loc_213B1
        loc_2141C:
        asm     add     si, ax
        asm     mov     ax, P2326_i_DestinationOffset
        asm     shr     ax, 1
        asm     jb      loc_21405
        asm     add     di, ax
        asm     lodsb
        asm     mov     dh, al
        asm     shr     cx, 1
        asm     pushf
        asm     jz      loc_2144C
        loc_2142F:
        asm     lodsb
        asm     mov     ah, dh
        asm     mov     dh, al
        asm     ror     ax, 1
        asm     ror     ax, 1
        asm     ror     ax, 1
        asm     ror     ax, 1
        asm     mov     ah, al
        asm     mov     dl, al
        asm     xlat    byte ptr cs:[bx]
        asm     xor     ah, es:[di]
        asm     and     al, ah
        asm     xor     al, dl
        asm     stosb
        asm     loop    loc_2142F
        loc_2144C:
        asm     popf
        asm     jnb     loc_21467
        asm     and     dh, 0Fh
        asm     cmp     dh, P2328_c_TransparentColor
        asm     jz      loc_21467
        asm     mov     al, es:[di]
        asm     and     al, 0Fh
        asm     shl     dh, 1
        asm     shl     dh, 1
        asm     shl     dh, 1
        asm     shl     dh, 1
        asm     or      al, dh
        asm     stosb
        loc_21467:
        goto loc_224B8;
        loc_2146A:
        asm     add     di, ax
        asm     mov     ah, es:[di]
        asm     shr     ah, 1
        asm     shr     ah, 1
        asm     shr     ah, 1
        asm     shr     ah, 1
        asm     inc     cx
        asm     shr     cx, 1
        asm     pushf
        asm     jz      loc_2149A
        loc_2147D:
        asm     lodsb
        asm     mov     dl, al
        asm     ror     ax, 1
        asm     ror     ax, 1
        asm     ror     ax, 1
        asm     ror     ax, 1
        asm     mov     ah, dl
        asm     mov     dl, al
        asm     mov     dh, al
        asm     xlat    byte ptr cs:[bx]
        asm     xor     dh, es:[di]
        asm     and     al, dh
        asm     xor     al, dl
        asm     stosb
        asm     loop    loc_2147D
        loc_2149A:
        asm     popf
        asm     jnb     loc_214B5
        asm     and     ah, 0Fh
        asm     cmp     ah, P2328_c_TransparentColor
        asm     jz      loc_214B5
        asm     mov     al, es:[di]
        asm     and     al, 0Fh
        asm     shl     ah, 1
        asm     shl     ah, 1
        asm     shl     ah, 1
        asm     shl     ah, 1
        asm     or      al, ah
        asm     stosb
        loc_214B5:
        goto loc_224B8;
        V0682000_:
        asm     V0682000_ db 0xFF, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0
        asm     db 0x0F, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
        asm     db 0x0F, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
        asm     db 0x0F, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
        asm     db 0x0F, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
        asm     db 0x0F, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
        asm     db 0x0F, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
        asm     db 0x0F, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
        asm     db 0x0F, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
        asm     db 0x0F, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
        asm     db 0x0F, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
        asm     db 0x0F, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
        asm     db 0x0F, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
        asm     db 0x0F, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
        asm     db 0x0F, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
        asm     db 0x0F, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
        asm     db 0x00, 0x0F, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
        asm     db 0xF0, 0xFF, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0
        asm     db 0x00, 0x0F, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
        asm     db 0x00, 0x0F, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
        asm     db 0x00, 0x0F, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
        asm     db 0x00, 0x0F, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
        asm     db 0x00, 0x0F, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
        asm     db 0x00, 0x0F, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
        asm     db 0x00, 0x0F, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
        asm     db 0x00, 0x0F, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
        asm     db 0x00, 0x0F, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
        asm     db 0x00, 0x0F, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
        asm     db 0x00, 0x0F, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
        asm     db 0x00, 0x0F, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
        asm     db 0x00, 0x0F, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
        asm     db 0x00, 0x0F, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
        asm     db 0x00, 0x00, 0x0F, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
        asm     db 0x00, 0x00, 0x0F, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
        asm     db 0xF0, 0xF0, 0xFF, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0
        asm     db 0x00, 0x00, 0x0F, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
        asm     db 0x00, 0x00, 0x0F, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
        asm     db 0x00, 0x00, 0x0F, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
        asm     db 0x00, 0x00, 0x0F, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
        asm     db 0x00, 0x00, 0x0F, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
        asm     db 0x00, 0x00, 0x0F, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
        asm     db 0x00, 0x00, 0x0F, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
        asm     db 0x00, 0x00, 0x0F, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
        asm     db 0x00, 0x00, 0x0F, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
        asm     db 0x00, 0x00, 0x0F, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
        asm     db 0x00, 0x00, 0x0F, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
        asm     db 0x00, 0x00, 0x0F, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
        asm     db 0x00, 0x00, 0x0F, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
        asm     db 0x00, 0x00, 0x00, 0x0F, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
        asm     db 0x00, 0x00, 0x00, 0x0F, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
        asm     db 0x00, 0x00, 0x00, 0x0F, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
        asm     db 0xF0, 0xF0, 0xF0, 0xFF, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0
        asm     db 0x00, 0x00, 0x00, 0x0F, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
        asm     db 0x00, 0x00, 0x00, 0x0F, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
        asm     db 0x00, 0x00, 0x00, 0x0F, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
        asm     db 0x00, 0x00, 0x00, 0x0F, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
        asm     db 0x00, 0x00, 0x00, 0x0F, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
        asm     db 0x00, 0x00, 0x00, 0x0F, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
        asm     db 0x00, 0x00, 0x00, 0x0F, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
        asm     db 0x00, 0x00, 0x00, 0x0F, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
        asm     db 0x00, 0x00, 0x00, 0x0F, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
        asm     db 0x00, 0x00, 0x00, 0x0F, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
        asm     db 0x00, 0x00, 0x00, 0x0F, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
        asm     db 0x00, 0x00, 0x00, 0x0F, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
        asm     db 0x00, 0x00, 0x00, 0x00, 0x0F, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
        asm     db 0x00, 0x00, 0x00, 0x00, 0x0F, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
        asm     db 0x00, 0x00, 0x00, 0x00, 0x0F, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
        asm     db 0x00, 0x00, 0x00, 0x00, 0x0F, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
        asm     db 0xF0, 0xF0, 0xF0, 0xF0, 0xFF, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0
        asm     db 0x00, 0x00, 0x00, 0x00, 0x0F, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
        asm     db 0x00, 0x00, 0x00, 0x00, 0x0F, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
        asm     db 0x00, 0x00, 0x00, 0x00, 0x0F, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
        asm     db 0x00, 0x00, 0x00, 0x00, 0x0F, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
        asm     db 0x00, 0x00, 0x00, 0x00, 0x0F, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
        asm     db 0x00, 0x00, 0x00, 0x00, 0x0F, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
        asm     db 0x00, 0x00, 0x00, 0x00, 0x0F, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
        asm     db 0x00, 0x00, 0x00, 0x00, 0x0F, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
        asm     db 0x00, 0x00, 0x00, 0x00, 0x0F, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
        asm     db 0x00, 0x00, 0x00, 0x00, 0x0F, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
        asm     db 0x00, 0x00, 0x00, 0x00, 0x0F, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
        asm     db 0x00, 0x00, 0x00, 0x00, 0x00, 0x0F, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
        asm     db 0x00, 0x00, 0x00, 0x00, 0x00, 0x0F, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
        asm     db 0x00, 0x00, 0x00, 0x00, 0x00, 0x0F, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
        asm     db 0x00, 0x00, 0x00, 0x00, 0x00, 0x0F, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
        asm     db 0x00, 0x00, 0x00, 0x00, 0x00, 0x0F, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
        asm     db 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xFF, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0
        asm     db 0x00, 0x00, 0x00, 0x00, 0x00, 0x0F, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
        asm     db 0x00, 0x00, 0x00, 0x00, 0x00, 0x0F, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
        asm     db 0x00, 0x00, 0x00, 0x00, 0x00, 0x0F, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
        asm     db 0x00, 0x00, 0x00, 0x00, 0x00, 0x0F, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
        asm     db 0x00, 0x00, 0x00, 0x00, 0x00, 0x0F, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
        asm     db 0x00, 0x00, 0x00, 0x00, 0x00, 0x0F, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
        asm     db 0x00, 0x00, 0x00, 0x00, 0x00, 0x0F, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
        asm     db 0x00, 0x00, 0x00, 0x00, 0x00, 0x0F, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
        asm     db 0x00, 0x00, 0x00, 0x00, 0x00, 0x0F, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
        asm     db 0x00, 0x00, 0x00, 0x00, 0x00, 0x0F, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
        asm     db 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0F, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
        asm     db 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0F, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
        asm     db 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0F, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
        asm     db 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0F, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
        asm     db 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0F, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
        asm     db 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0F, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
        asm     db 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xFF, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0
        asm     db 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0F, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
        asm     db 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0F, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
        asm     db 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0F, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
        asm     db 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0F, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
        asm     db 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0F, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
        asm     db 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0F, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
        asm     db 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0F, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
        asm     db 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0F, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
        asm     db 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0F, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
        asm     db 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0F, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
        asm     db 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0F, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
        asm     db 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0F, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
        asm     db 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0F, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
        asm     db 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0F, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
        asm     db 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0F, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
        asm     db 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0F, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
        asm     db 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xFF, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0
        asm     db 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0F, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
        asm     db 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0F, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
        asm     db 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0F, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
        asm     db 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0F, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
        asm     db 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0F, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
        asm     db 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0F, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
        asm     db 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0F, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
        asm     db 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0F, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
        asm     db 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0F, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
        asm     db 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0F, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
        asm     db 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0F, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
        asm     db 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0F, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
        asm     db 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0F, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
        asm     db 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0F, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
        asm     db 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0F, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
        asm     db 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0F, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
        asm     db 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xFF, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0
        asm     db 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0F, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
        asm     db 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0F, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
        asm     db 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0F, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
        asm     db 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0F, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
        asm     db 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0F, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
        asm     db 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0F, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
        asm     db 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0F, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
        asm     db 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0F, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
        asm     db 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0F, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
        asm     db 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0F, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
        asm     db 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0F, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
        asm     db 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0F, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
        asm     db 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0F, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
        asm     db 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0F, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
        asm     db 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0F, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
        asm     db 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0F, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
        asm     db 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xFF, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0
        asm     db 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0F, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
        asm     db 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0F, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
        asm     db 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0F, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
        asm     db 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0F, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
        asm     db 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0F, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
        asm     db 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0F, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
        asm     db 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0F, 0x00, 0x00, 0x00, 0x00, 0x00
        asm     db 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0F, 0x00, 0x00, 0x00, 0x00, 0x00
        asm     db 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0F, 0x00, 0x00, 0x00, 0x00, 0x00
        asm     db 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0F, 0x00, 0x00, 0x00, 0x00, 0x00
        asm     db 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0F, 0x00, 0x00, 0x00, 0x00, 0x00
        asm     db 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0F, 0x00, 0x00, 0x00, 0x00, 0x00
        asm     db 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0F, 0x00, 0x00, 0x00, 0x00, 0x00
        asm     db 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0F, 0x00, 0x00, 0x00, 0x00, 0x00
        asm     db 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0F, 0x00, 0x00, 0x00, 0x00, 0x00
        asm     db 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0F, 0x00, 0x00, 0x00, 0x00, 0x00
        asm     db 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xFF, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0
        asm     db 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0F, 0x00, 0x00, 0x00, 0x00, 0x00
        asm     db 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0F, 0x00, 0x00, 0x00, 0x00, 0x00
        asm     db 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0F, 0x00, 0x00, 0x00, 0x00, 0x00
        asm     db 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0F, 0x00, 0x00, 0x00, 0x00, 0x00
        asm     db 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0F, 0x00, 0x00, 0x00, 0x00, 0x00
        asm     db 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0F, 0x00, 0x00, 0x00, 0x00
        asm     db 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0F, 0x00, 0x00, 0x00, 0x00
        asm     db 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0F, 0x00, 0x00, 0x00, 0x00
        asm     db 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0F, 0x00, 0x00, 0x00, 0x00
        asm     db 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0F, 0x00, 0x00, 0x00, 0x00
        asm     db 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0F, 0x00, 0x00, 0x00, 0x00
        asm     db 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0F, 0x00, 0x00, 0x00, 0x00
        asm     db 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0F, 0x00, 0x00, 0x00, 0x00
        asm     db 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0F, 0x00, 0x00, 0x00, 0x00
        asm     db 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0F, 0x00, 0x00, 0x00, 0x00
        asm     db 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0F, 0x00, 0x00, 0x00, 0x00
        asm     db 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xFF, 0xF0, 0xF0, 0xF0, 0xF0
        asm     db 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0F, 0x00, 0x00, 0x00, 0x00
        asm     db 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0F, 0x00, 0x00, 0x00, 0x00
        asm     db 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0F, 0x00, 0x00, 0x00, 0x00
        asm     db 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0F, 0x00, 0x00, 0x00, 0x00
        asm     db 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0F, 0x00, 0x00, 0x00
        asm     db 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0F, 0x00, 0x00, 0x00
        asm     db 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0F, 0x00, 0x00, 0x00
        asm     db 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0F, 0x00, 0x00, 0x00
        asm     db 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0F, 0x00, 0x00, 0x00
        asm     db 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0F, 0x00, 0x00, 0x00
        asm     db 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0F, 0x00, 0x00, 0x00
        asm     db 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0F, 0x00, 0x00, 0x00
        asm     db 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0F, 0x00, 0x00, 0x00
        asm     db 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0F, 0x00, 0x00, 0x00
        asm     db 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0F, 0x00, 0x00, 0x00
        asm     db 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0F, 0x00, 0x00, 0x00
        asm     db 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xFF, 0xF0, 0xF0, 0xF0
        asm     db 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0F, 0x00, 0x00, 0x00
        asm     db 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0F, 0x00, 0x00, 0x00
        asm     db 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0F, 0x00, 0x00, 0x00
        asm     db 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0F, 0x00, 0x00
        asm     db 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0F, 0x00, 0x00
        asm     db 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0F, 0x00, 0x00
        asm     db 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0F, 0x00, 0x00
        asm     db 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0F, 0x00, 0x00
        asm     db 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0F, 0x00, 0x00
        asm     db 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0F, 0x00, 0x00
        asm     db 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0F, 0x00, 0x00
        asm     db 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0F, 0x00, 0x00
        asm     db 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0F, 0x00, 0x00
        asm     db 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0F, 0x00, 0x00
        asm     db 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0F, 0x00, 0x00
        asm     db 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0F, 0x00, 0x00
        asm     db 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xFF, 0xF0, 0xF0
        asm     db 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0F, 0x00, 0x00
        asm     db 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0F, 0x00, 0x00
        asm     db 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0F, 0x00
        asm     db 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0F, 0x00
        asm     db 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0F, 0x00
        asm     db 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0F, 0x00
        asm     db 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0F, 0x00
        asm     db 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0F, 0x00
        asm     db 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0F, 0x00
        asm     db 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0F, 0x00
        asm     db 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0F, 0x00
        asm     db 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0F, 0x00
        asm     db 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0F, 0x00
        asm     db 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0F, 0x00
        asm     db 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0F, 0x00
        asm     db 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0F, 0x00
        asm     db 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xFF, 0xF0
        asm     db 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0F, 0x00
        asm     db 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0F
        asm     db 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0F
        asm     db 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0F
        asm     db 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0F
        asm     db 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0F
        asm     db 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0F
        asm     db 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0F
        asm     db 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0F
        asm     db 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0F
        asm     db 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0F
        asm     db 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0F
        asm     db 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0F
        asm     db 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0F
        asm     db 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0F
        asm     db 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0F
        asm     db 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xFF
        loc_224B8:
        asm     pop    ds
#endif
#if (EXETYPE == C25_VGA)
        asm     cld
        asm     push    ds
        asm     mov     di, P2326_i_DestinationOffset
        asm     mov     ax, 0A000h
        asm     mov     es, ax
        asm     mov     bl, G8177_c_ViewportColorIndexOffset
        asm     mov     bh, bl
        asm     mov     dh, P2328_c_TransparentColor
        asm     mov     cx, P2327_i_PixelCount
        asm     lds     si, G2159_puc_Bitmap_Source
        asm     mov     ax, P2325_i_A
        asm     shr     ax, 1
        asm     pushf
        asm     add     si, ax
        asm     popf
        asm     jnb     loc_105E7
        asm     lodsb
        asm     and     al, 0Fh
        asm     cmp     al, dh
        asm     jnz     loc_105E1
        asm     inc     di
        asm     jmp     loc_105E4
        loc_105E1:
        asm     or      al, bl
        asm     stosb
        loc_105E4:
        asm     dec     cx
        asm     jz      loc_10637
        loc_105E7:
        asm     shr     cx, 1
        asm     pushf
        asm     jz      loc_10624
        loc_105EC:
        asm     lodsb
        asm     mov     ah, al
        asm     shr     al, 1
        asm     shr     al, 1
        asm     shr     al, 1
        asm     shr     al, 1
        asm     and     ah, 0Fh
        asm     cmp     al, dh
        asm     jz      loc_10609
        asm     cmp     ah, dh
        asm     jz      loc_1061E
        asm     or      ax, bx
        asm     stosw
        asm     loop    loc_105EC
        asm     jmp     loc_10624
        loc_10609:
        asm     cmp     ah, dh
        asm     jz      loc_10617
        asm     mov     al, ah
        asm     or      al, bl
        asm     inc     di
        asm     stosb
        asm     loop    loc_105EC
        asm     jmp     loc_10624
        loc_10617:
        asm     inc     di
        asm     inc     di
        asm     dec     cx
        asm     jnz     loc_105EC
        asm     jmp     loc_10624
        loc_1061E:
        asm     or      al, bl
        asm     stosb
        asm     inc     di
        asm     loop    loc_105EC
        loc_10624:
        asm     popf
        asm     jnb     loc_10637
        asm     lodsb
        asm     shr     al, 1
        asm     shr     al, 1
        asm     shr     al, 1
        asm     shr     al, 1
        asm     cmp     al, dh
        asm     jz      loc_10637
        asm     or      al, bl
        asm     stosb
        loc_10637:
        asm     pop     ds
#endif
}

#if (EXETYPE == C23_EGA)
FUNC_DEF void F8143_CopyPixelLineFromScreenWithoutTransparency(
int16_t P2501_i_,
int16_t P2502_i_,
int16_t P2503_i_)
{
        asm     cld
        asm     push    ds
        asm     mov     dx, P2502_i_
        asm     shr     dx, 1
        asm     pushf
        asm     les     di, G2160_puc_Bitmap_Destination
        asm     add     di, dx
        asm     mov     bx, P2503_i_
        asm     mov     dx, P2501_i_
        asm     mov     ah, dl
        asm     and     ah, 7
        asm     shr     dx, 1
        asm     shr     dx, 1
        asm     shr     dx, 1
        asm     lds     si, G8134_pc_VideoMemory
        asm     add     si, dx
        asm     push    ax
        asm     mov     dx, 3CEh
        asm     mov     ax, 5
        asm     out     dx, ax         /* EGA: graph 1 and 2 addr reg: */
                                       /* mode register.Data bits: */
                                       /* 0-1: Write mode 0-2 */
                                       /* 2: test condition */
                                       /* 3: read mode: 1=color compare, 0=direct */
                                       /* 4: 1=use odd/even RAM addressing */
                                       /* 5: 1=use CGA mid-res map (2-bits/pixel) */
        asm     mov     al, 4
        asm     out     dx, al         /* EGA: graph 1 and 2 addr reg: */
                                       /* read map select. */
                                       /* Data bits 0-2 select map # for read mode 00. */
        asm     pop     ax
        asm     push    bx
        asm     mov     dx, 3CFh
        asm     mov     al, 0
        asm     out     dx, al         /* EGA port: graphics controller data register */
        asm     mov     cl, [si]
        asm     inc     al
        asm     out     dx, al         /* EGA port: graphics controller data register */
        asm     mov     ch, [si]
        asm     inc     al
        asm     out     dx, al         /* EGA port: graphics controller data register */
        asm     mov     bl, [si]
        asm     inc     al
        asm     out     dx, al         /* EGA port: graphics controller data register */
        asm     mov     bh, [si]
        asm     inc     si
        asm     mov     al, 8
        asm     cmp     ah, 0
        asm     jz      loc_108A2
        loc_10898:
        asm     shl     bx, 1
        asm     shl     cx, 1
        asm     dec     al
        asm     dec     ah
        asm     jnz     loc_10898
        loc_108A2:
        asm     mov     ah, al
        asm     pop     dx
        asm     popf
        asm     jnb     loc_108E8
        asm     rcl     bh, 1
        asm     rcl     al, 1
        asm     rcl     bl, 1
        asm     rcl     al, 1
        asm     rcl     ch, 1
        asm     rcl     al, 1
        asm     rcl     cl, 1
        asm     rcl     al, 1
        asm     dec     ah
        asm     jnz     loc_108DA
        asm     push    dx
        asm     push    ax
        asm     mov     dx, 3CFh
        asm     mov     al, 0
        asm     out     dx, al         /* EGA port: graphics controller data register */
        asm     mov     cl, [si]
        asm     inc     al
        asm     out     dx, al         /* EGA port: graphics controller data register */
        asm     mov     ch, [si]
        asm     inc     al
        asm     out     dx, al         /* EGA port: graphics controller data register */
        asm     mov     bl, [si]
        asm     inc     al
        asm     out     dx, al         /* EGA port: graphics controller data register */
        asm     mov     bh, [si]
        asm     inc     si
        asm     pop     ax
        asm     pop     dx
        asm     mov     ah, 8
        loc_108DA:
        asm     and     byte ptr es:[di], 0F0h
        asm     or      es:[di], al
        asm     inc     di
        asm     dec     dx
        asm     jnz     loc_108E8
        asm     jmp     loc_10967
        loc_108E8:
        asm     rcl     bh, 1
        asm     rcl     al, 1
        asm     rcl     bl, 1
        asm     rcl     al, 1
        asm     rcl     ch, 1
        asm     rcl     al, 1
        asm     rcl     cl, 1
        asm     rcl     al, 1
        asm     dec     ah
        asm     jnz     loc_1091A
        asm     push    dx
        asm     push    ax
        asm     mov     dx, 3CFh
        asm     mov     al, 0
        asm     out     dx, al         /* EGA port: graphics controller data register */
        asm     mov     cl, [si]
        asm     inc     al
        asm     out     dx, al         /* EGA port: graphics controller data register */
        asm     mov     ch, [si]
        asm     inc     al
        asm     out     dx, al         /* EGA port: graphics controller data register */
        asm     mov     bl, [si]
        asm     inc     al
        asm     out     dx, al         /* EGA port: graphics controller data register */
        asm     mov     bh, [si]
        asm     inc     si
        asm     pop     ax
        asm     pop     dx
        asm     mov     ah, 8
        loc_1091A:
        asm     dec     dx
        asm     jnz     loc_10920
        asm     jmp     loc_10958
        loc_10920:
        asm     rcl     bh, 1
        asm     rcl     al, 1
        asm     rcl     bl, 1
        asm     rcl     al, 1
        asm     rcl     ch, 1
        asm     rcl     al, 1
        asm     rcl     cl, 1
        asm     rcl     al, 1
        asm     dec     ah
        asm     jnz     loc_10952
        asm     push    dx
        asm     push    ax
        asm     mov     dx, 3CFh
        asm     mov     al, 0
        asm     out     dx, al         /* EGA port: graphics controller data register */
        asm     mov     cl, [si]
        asm     inc     al
        asm     out     dx, al         /* EGA port: graphics controller data register */
        asm     mov     ch, [si]
        asm     inc     al
        asm     out     dx, al         /* EGA port: graphics controller data register */
        asm     mov     bl, [si]
        asm     inc     al
        asm     out     dx, al         /* EGA port: graphics controller data register */
        asm     mov     bh, [si]
        asm     inc     si
        asm     pop     ax
        asm     pop     dx
        asm     mov     ah, 8
        loc_10952:
        asm     stosb
        asm     dec     dx
        asm     jz      loc_10967
        asm     jmp     loc_108E8
        loc_10958:
        asm     shl     al, 1
        asm     shl     al, 1
        asm     shl     al, 1
        asm     shl     al, 1
        asm     and     byte ptr es:[di], 0Fh
        asm     or      es:[di], al
        loc_10967:
        asm     pop     ds
}

FUNC_DEF void F8144_CopyPixelLineFromScreenWithoutTransparencyFlippedHorizontally(
)
{
}

FUNC_DEF void F0681_CopyPixelLineToScreenWithoutTransparencyFlippedHorizontally(
)
{
}
#endif

#if ((EXETYPE == C23_EGA) || (EXETYPE == C25_VGA))
FUNC_DEF void F0683_CopyPixelLineToScreenWithTransparencyFlippedHorizontally(
)
{
}
#endif

#if ((EXETYPE == C23_EGA) || (EXETYPE == C24_TANDY))
FUNC_DEF void F8147_(
unsigned char* P2504_puc_,
int16_t P2505_i_)
{
#if (EXETYPE == C23_EGA)
        asm     cld
        asm     push    ds
        asm     mov     dx, 3CEh
        asm     mov     ax, 5
        asm     out     dx, ax         /* EGA: graph 1 and 2 addr reg: */
                                       /* mode register.Data bits: */
                                       /* 0-1: Write mode 0-2 */
                                       /* 2: test condition */
                                       /* 3: read mode: 1=color compare, 0=direct */
                                       /* 4: 1=use odd/even RAM addressing */
                                       /* 5: 1=use CGA mid-res map (2-bits/pixel) */
        asm     mov     ax, 0FF08h
        asm     out     dx, ax         /* EGA: graph 1 and 2 addr reg: */
                                       /* unknown register */
        asm     mov     ax, 3
        asm     out     dx, ax         /* EGA: graph 1 and 2 addr reg: */
                                       /* data rotate and function select for write mode 00. Bits: */
                                       /* 0-2: set rotate count for write mode 00 */
                                       /* 3-4: fn for write modes 00 and 02 */
                                       /*      00=no change; 01=AND; 10=OR; 11=XOR */
        asm     mov     ax, 1
        asm     out     dx, ax         /* EGA: graph 1 and 2 addr reg: */
                                       /* enable set/reset */
        asm     mov     dx, 3C4h
        asm     mov     al, 2
        asm     out     dx, al         /* EGA: sequencer address reg */
                                       /* map mask: data bits 0-3 enable writes to bit planes 0-3 */
        asm     lds     si, P2504_puc_
        asm     mov     ax, 0A000h
        asm     mov     es, ax
        asm     mov     di, P2505_i_
        asm     mov     cx, 2
        loc_109A9:
        asm     push    si
        asm     push    di
        asm     push    cx
        asm     mov     cx, 44h
        loc_109AF:
        asm     push    si
        asm     push    di
        asm     push    cx
        asm     push    bp
        asm     mov     cx, 0Eh
        loc_109B6:
        asm     push    cx
        asm     mov     dx, 0FFh
        asm     mov     bp, [si]
        asm     and     bp, dx
        asm     add     bp, bp
        asm     mov     ax, cs:[bp+V8149007_rawdata7]
        asm     mov     bx, cs:[bp+V8149006_rawdata6]
        asm     mov     bp, [si+1]
        asm     and     bp, dx
        asm     add     bp, bp
        asm     or      ax, cs:[bp+V8149005_rawdata5]
        asm     or      bx, cs:[bp+V8149004_rawdata4]
        asm     mov     bp, [si+2]
        asm     and     bp, dx
        asm     add     bp, bp
        asm     or      ax, cs:[bp+V8149003_rawdata3]
        asm     or      bx, cs:[bp+V8149002_rawdata2]
        asm     mov     bp, [si+3]
        asm     and     bp, dx
        asm     add     bp, bp
        asm     or      ax, cs:[bp+V8149001_rawdata1]
        asm     or      bx, cs:[bp+V8149000_rawdata0]
        asm     mov     bp, [si+4]
        asm     and     bp, dx
        asm     add     bp, bp
        asm     mov     cx, cs:[bp+V8149007_rawdata7]
        asm     mov     dx, cs:[bp+V8149006_rawdata6]
        asm     mov     bp, [si+5]
        asm     and     bp, 0FFh
        asm     add     bp, bp
        asm     or      cx, cs:[bp+V8149005_rawdata5]
        asm     or      dx, cs:[bp+V8149004_rawdata4]
        asm     mov     bp, [si+6]
        asm     and     bp, 0FFh
        asm     add     bp, bp
        asm     or      cx, cs:[bp+V8149003_rawdata3]
        asm     or      dx, cs:[bp+V8149002_rawdata2]
        asm     mov     bp, [si+7]
        asm     and     bp, 0FFh
        asm     add     bp, bp
        asm     or      cx, cs:[bp+V8149001_rawdata1]
        asm     or      dx, cs:[bp+V8149000_rawdata0]
        asm     add     si, 8
        asm     xchg    ah, cl
        asm     xchg    bh, dl
        asm     push    si
        asm     mov     bp, ax
        asm     mov     si, dx
        asm     mov     dx, 3C5h
        asm     mov     al, 1
        asm     out     dx, al         /* EGA port: sequencer data register */
        asm     mov     es:[di], bp
        asm     mov     al, 2
        asm     out     dx, al         /* EGA port: sequencer data register */
        asm     mov     es:[di], cx
        asm     mov     al, 4
        asm     out     dx, al         /* EGA port: sequencer data register */
        asm     mov     es:[di], bx
        asm     mov     al, 8
        asm     out     dx, al         /* EGA port: sequencer data register */
        asm     mov     es:[di], si
        asm     add     di, 2
        asm     pop     si
        asm     pop     cx
        asm     dec     cx
        asm     jz      loc_10A79
        asm     jmp     loc_109B6
        loc_10A79:
        asm     pop     bp
        asm     pop     cx
        asm     pop     di
        asm     pop     si
        asm     add     di, 50h
        asm     add     si, 0E0h
        asm     dec     cx
        asm     jz      loc_10A8A
        asm     jmp     loc_109AF
        loc_10A8A:
        asm     pop     cx
        asm     pop     di
        asm     pop     si
        asm     add     di, 28h
        asm     add     si, 70h
        asm     dec     cx
        asm     jz      loc_10A99
        asm     jmp     loc_109A9
        loc_10A99:
        asm     mov     dx, 3CEh
        asm     mov     ax, 5
        asm     out     dx, ax         /* EGA: graph 1 and 2 addr reg: */
                                       /* mode register.Data bits: */
                                       /* 0-1: Write mode 0-2 */
                                       /* 2: test condition */
                                       /* 3: read mode: 1=color compare, 0=direct */
                                       /* 4: 1=use odd/even RAM addressing */
                                       /* 5: 1=use CGA mid-res map (2-bits/pixel) */
        asm     mov     ax, 0FF08h
        asm     out     dx, ax         /* EGA: graph 1 and 2 addr reg: */
                                       /* unknown register */
        asm     mov     ax, 0F01h
        asm     out     dx, ax         /* EGA: graph 1 and 2 addr reg: */
                                       /* unknown register */
        asm     mov     dx, 3C4h
        asm     mov     ax, 0F02h
        asm     out     dx, ax         /* EGA: sequencer address reg */
                                       /* unknown register */
        asm     pop     ds
#endif
#if (EXETYPE == C24_TANDY)
        asm     cld
        asm     push    ds
        asm     mov     bx, offset V8149000_rawdata0
        asm     mov     ax, 0B800h
        asm     mov     es, ax
        asm     mov     dx, P2505_i_
        asm     lds     si, P2504_puc_
        asm     mov     cx, 88h
        loc_117D4:
        asm     push    di
        asm     push    cx
        asm     push    dx
        asm     mov     ax, dx
        asm     shr     ax, 1
        asm     shr     ax, 1
        asm     mov     cl, 0A0h
        asm     mul     cl
        asm     and     dx, 3
        asm     mov     cl, 0Dh
        asm     shl     dx, cl
        asm     or      ax, dx
        asm     mov     di, ax
        asm     mov     cx, 38h
        loc_117EF:
        asm     lodsw
        asm     xlat    byte ptr cs:[bx]
        asm     xchg    ah, al
        asm     xlat    byte ptr cs:[bx]
        asm     xchg    ah, al
        asm     stosw
        asm     loop    loc_117EF
        asm     pop     dx
        asm     inc     dx
        asm     pop     cx
        asm     pop     di
        asm     loop    loc_117D4
        asm     pop     ds
#endif
}

FUNC_DEF void F8149_(
)
{
#if (EXETYPE == C23_EGA)
        asm     V8149000_rawdata0 dw 0
        asm              db 510 dup (0)
        asm     V8149001_rawdata1 dw 0
        asm              db 510 dup (0)
        asm     V8149002_rawdata2 dw 0
        asm              db 510 dup (0)
        asm     V8149003_rawdata3 dw 0
        asm              db 510 dup (0)
        asm     V8149004_rawdata4 dw 0
        asm              db 510 dup (0)
        asm     V8149005_rawdata5 dw 0
        asm              db 510 dup (0)
        asm     V8149006_rawdata6 dw 0
        asm              db 510 dup (0)
        asm     V8149007_rawdata7 dw 0
        asm              db 510 dup (0)
#endif
#if (EXETYPE == C24_TANDY)
        asm     V8149000_rawdata0 dw 0
        asm              db 510 dup (0)
#endif
}

FUNC_DEF void F8150_(
unsigned char* P2506_puc_)
{
        unsigned int16_t L2499_ui_;
        int16_t L2500_i_;
#if (EXETYPE == C23_EGA)
        int16_t L2501_i_;
        unsigned char L2502_uc_;
        unsigned long L2503_aul_[16] = { 0x00000000, 0x00000001, 0x00000100, 0x00000101, 0x00010000, 0x00010001, 0x00010100, 0x00010101, 0x01000000, 0x01000001, 0x01000100, 0x01000101, 0x01010000, 0x01010001, 0x01010100, 0x01010101 };
#endif


        for (L2499_ui_ = 0; L2499_ui_ < 256; L2499_ui_++) {
#if (EXETYPE == C23_EGA)
                L2500_i_ = (L2503_aul_[L2502_uc_ = P2506_puc_[L2499_ui_ >> 4]] >> 15) & 0xFFFE;
                L2501_i_ = (L2503_aul_[L2502_uc_] & 0xFFFF) << 1;
                L2500_i_ |= L2503_aul_[L2502_uc_ = P2506_puc_[L2499_ui_ & 0x0F]] >> 16;
                L2501_i_ |= L2503_aul_[L2502_uc_] & 0xFFFF;
#endif
#if (EXETYPE == C24_TANDY)
                L2500_i_ = (P2506_puc_[L2499_ui_ >> 4] << 4) | P2506_puc_[L2499_ui_ & 0x0F];
#endif
                asm     mov     bx, L2499_ui_
#if (EXETYPE == C23_EGA)
                asm     shl     bx, 1
#endif
                asm     mov     ax, L2500_i_
                asm     mov     cs:[bx+V8149000_rawdata0], ax
#if (EXETYPE == C23_EGA)
                asm     shl     ax, 1
                asm     shl     ax, 1
                asm     mov     cs:[bx+V8149002_rawdata2], ax
                asm     shl     ax, 1
                asm     shl     ax, 1
                asm     mov     cs:[bx+V8149004_rawdata4], ax
                asm     shl     ax, 1
                asm     shl     ax, 1
                asm     mov     cs:[bx+V8149006_rawdata6], ax
                asm     mov     ax, L2501_i_
                asm     mov     cs:[bx+V8149001_rawdata1], ax
                asm     shl     ax, 1
                asm     shl     ax, 1
                asm     mov     cs:[bx+V8149003_rawdata3], ax
                asm     shl     ax, 1
                asm     shl     ax, 1
                asm     mov     cs:[bx+V8149005_rawdata5], ax
                asm     shl     ax, 1
                asm     shl     ax, 1
                asm     mov     cs:[bx+V8149007_rawdata7], ax
#endif
        }
}
#endif

FUNC_DEF void F8151_VIDRV_02_Blit( /* Similar to F0684_Blit */
unsigned char* P2333_puc_Bitmap_Source,
unsigned char* P2334_puc_Bitmap_Destination,
int16_t* P2335_pi_Box,
int16_t P2336_i_X,
int16_t P2337_i_Y,
int16_t P2338_i_SourceWidth,
int16_t P2339_i_DestinationWidth,
int16_t P2340_i_TransparentColor,
int16_t P2341_i_Flip)
{
        int16_t L2504_i_Left; /* Cannot be a 'Box' array */
        int16_t L2505_i_Right;
        int16_t L2506_i_Top;
        int16_t L2507_i_Bottom;
        unsigned int16_t L2508_ui_Height;
        unsigned int16_t L2509_ui_Width;
        unsigned int16_t L2510_ui_LineIndex;
        int16_t L2511_i_SourcePixelIndex;
        int16_t L2512_i_DestinationPixelIndex;


        ASM_STUB_PREFIX
        G2159_puc_Bitmap_Source = P2333_puc_Bitmap_Source;
        G2160_puc_Bitmap_Destination = P2334_puc_Bitmap_Destination;
        L2504_i_Left = M768_BOX_LEFT(P2335_pi_Box);
        L2505_i_Right = M769_BOX_RIGHT(P2335_pi_Box);
        L2506_i_Top = M770_BOX_TOP(P2335_pi_Box);
        L2507_i_Bottom = M771_BOX_BOTTOM(P2335_pi_Box);
        P2338_i_SourceWidth = M104_EVEN_INTEGER(P2338_i_SourceWidth);
        P2339_i_DestinationWidth = M104_EVEN_INTEGER(P2339_i_DestinationWidth);
        L2509_ui_Width = L2505_i_Right - L2504_i_Left + 1;
        L2508_ui_Height = L2507_i_Bottom - L2506_i_Top + 1;
        if ((L2509_ui_Width <= 0) || (L2508_ui_Height <= 0)) {
                return;
        }
        L2512_i_DestinationPixelIndex = (L2506_i_Top * P2339_i_DestinationWidth) + L2504_i_Left;
        switch (P2341_i_Flip) {
                default:
                        L2511_i_SourcePixelIndex = (P2337_i_Y * P2338_i_SourceWidth) + P2336_i_X;
                        if (P2334_puc_Bitmap_Destination == NULL) {
#if (EXETYPE == C24_TANDY)
                                L2512_i_DestinationPixelIndex = F8172_(L2512_i_DestinationPixelIndex);
#endif
                                for (L2510_ui_LineIndex = 0; L2510_ui_LineIndex < L2508_ui_Height; L2510_ui_LineIndex++) {
                                        if (P2340_i_TransparentColor < 0) {
                                                F0680_CopyPixelsToScreenWithoutTransparency(L2511_i_SourcePixelIndex, L2512_i_DestinationPixelIndex, L2509_ui_Width);
                                        } else {
                                                F0682_CopyPixelLineToScreenWithTransparency(L2511_i_SourcePixelIndex, L2512_i_DestinationPixelIndex, L2509_ui_Width, P2340_i_TransparentColor);
                                        }
                                        L2511_i_SourcePixelIndex += P2338_i_SourceWidth;
#if ((EXETYPE == C23_EGA) || (EXETYPE == C25_VGA))
                                        L2512_i_DestinationPixelIndex += P2339_i_DestinationWidth;
#endif
#if (EXETYPE == C24_TANDY)
                                        if (((L2512_i_DestinationPixelIndex += 0x4000) & 0xC000) == 0) {
                                                L2512_i_DestinationPixelIndex += 320;
                                        }
#endif
                                }
                                break;
                        } else {
                                if (P2333_puc_Bitmap_Source == NULL) {
#if (EXETYPE == C24_TANDY)
                                        L2511_i_SourcePixelIndex = F8172_(L2511_i_SourcePixelIndex);
#endif
                                        for (L2510_ui_LineIndex = 0; L2510_ui_LineIndex < L2508_ui_Height; L2510_ui_LineIndex++) {
                                                if (P2340_i_TransparentColor < 0) {
                                                        F8143_CopyPixelLineFromScreenWithoutTransparency(L2511_i_SourcePixelIndex, L2512_i_DestinationPixelIndex, L2509_ui_Width);
                                                } else {
                                                }
#if ((EXETYPE == C23_EGA) || (EXETYPE == C25_VGA))
                                                L2511_i_SourcePixelIndex += P2338_i_SourceWidth;
#endif
#if (EXETYPE == C24_TANDY)
                                                if (((L2511_i_SourcePixelIndex += 0x4000) & 0xC000) == 0) {
                                                        L2511_i_SourcePixelIndex += 320;
                                                }
#endif
                                                L2512_i_DestinationPixelIndex += P2339_i_DestinationWidth;
                                        }
                                }
                        }
                        break;
                case MASK0x0002_FLIP_VERTICAL:
                        L2511_i_SourcePixelIndex = ((P2337_i_Y + L2508_ui_Height - 1) * P2338_i_SourceWidth) + P2336_i_X;
                        if (P2334_puc_Bitmap_Destination == NULL) {
#if (EXETYPE == C24_TANDY)
                                L2512_i_DestinationPixelIndex = F8172_(L2512_i_DestinationPixelIndex);
#endif
                                for (L2510_ui_LineIndex = 0; L2510_ui_LineIndex < L2508_ui_Height; L2510_ui_LineIndex++) {
                                        if (P2340_i_TransparentColor < 0) {
                                                F0680_CopyPixelsToScreenWithoutTransparency(L2511_i_SourcePixelIndex, L2512_i_DestinationPixelIndex, L2509_ui_Width);
                                        } else {
                                                F0682_CopyPixelLineToScreenWithTransparency(L2511_i_SourcePixelIndex, L2512_i_DestinationPixelIndex, L2509_ui_Width, P2340_i_TransparentColor);
                                        }
                                        L2511_i_SourcePixelIndex -= P2338_i_SourceWidth;
#if ((EXETYPE == C23_EGA) || (EXETYPE == C25_VGA))
                                        L2512_i_DestinationPixelIndex += P2339_i_DestinationWidth;
#endif
#if (EXETYPE == C24_TANDY)
                                        if (((L2512_i_DestinationPixelIndex += 0x4000) & 0xC000) == 0) {
                                                L2512_i_DestinationPixelIndex += 320;
                                        }
#endif
                                }
                        } else {
                                if (P2333_puc_Bitmap_Source == NULL) {
                                        for (L2510_ui_LineIndex = 0; L2510_ui_LineIndex < L2508_ui_Height; L2510_ui_LineIndex++) {
                                                if (P2340_i_TransparentColor < 0) {
#if ((EXETYPE == C23_EGA) || (EXETYPE == C25_VGA))
                                                        F8143_CopyPixelLineFromScreenWithoutTransparency(L2511_i_SourcePixelIndex, L2512_i_DestinationPixelIndex, L2509_ui_Width);
#endif
#if (EXETYPE == C24_TANDY)
                                                        F8143_CopyPixelLineFromScreenWithoutTransparency(F8172_(L2511_i_SourcePixelIndex), L2512_i_DestinationPixelIndex, L2509_ui_Width);
#endif
                                                } else {
                                                }
#if ((EXETYPE == C23_EGA) || (EXETYPE == C25_VGA))
                                                L2511_i_SourcePixelIndex -= P2338_i_SourceWidth;
#endif
#if (EXETYPE == C24_TANDY)
                                                L2511_i_SourcePixelIndex -= 320;
#endif
                                                L2512_i_DestinationPixelIndex += P2339_i_DestinationWidth;
                                        }
                                }
                        }
                        break;
#if ((EXETYPE == C23_EGA) || (EXETYPE == C25_VGA))
                case MASK0x0001_FLIP_HORIZONTAL:
                        L2511_i_SourcePixelIndex = (P2337_i_Y * P2338_i_SourceWidth) + P2336_i_X;
                        if (P2334_puc_Bitmap_Destination == NULL) {
                                for (L2510_ui_LineIndex = 0; L2510_ui_LineIndex < L2508_ui_Height; L2510_ui_LineIndex++) {
                                        if (P2340_i_TransparentColor < 0) {
                                                F0681_CopyPixelLineToScreenWithoutTransparencyFlippedHorizontally(L2511_i_SourcePixelIndex, L2512_i_DestinationPixelIndex, L2509_ui_Width);
                                        } else {
                                                F0683_CopyPixelLineToScreenWithTransparencyFlippedHorizontally(L2511_i_SourcePixelIndex, L2512_i_DestinationPixelIndex, L2509_ui_Width, P2340_i_TransparentColor);
                                        }
                                        L2511_i_SourcePixelIndex += P2338_i_SourceWidth;
                                        L2512_i_DestinationPixelIndex += P2339_i_DestinationWidth;
                                }
                        } else {
                                if (P2333_puc_Bitmap_Source == NULL) {
                                        for (L2510_ui_LineIndex = 0; L2510_ui_LineIndex < L2508_ui_Height; L2510_ui_LineIndex++) {
                                                if (P2340_i_TransparentColor < 0) {
                                                        F8144_CopyPixelLineFromScreenWithoutTransparencyFlippedHorizontally(L2511_i_SourcePixelIndex, L2512_i_DestinationPixelIndex, L2509_ui_Width);
                                                } else {
                                                }
                                                L2511_i_SourcePixelIndex += P2338_i_SourceWidth;
                                                L2512_i_DestinationPixelIndex += P2339_i_DestinationWidth;
                                        }
                                }
                        }
                        break;
                case MASK0x0001_FLIP_HORIZONTAL | MASK0x0002_FLIP_VERTICAL:
                        L2511_i_SourcePixelIndex = ((P2337_i_Y + L2508_ui_Height - 1) * P2338_i_SourceWidth) + P2336_i_X;
                        if (P2334_puc_Bitmap_Destination == NULL) {
                                for (L2510_ui_LineIndex = 0; L2510_ui_LineIndex < L2508_ui_Height; L2510_ui_LineIndex++) {
                                        if (P2340_i_TransparentColor < 0) {
                                                F0681_CopyPixelLineToScreenWithoutTransparencyFlippedHorizontally(L2511_i_SourcePixelIndex, L2512_i_DestinationPixelIndex, L2509_ui_Width);
                                        } else {
                                                F0683_CopyPixelLineToScreenWithTransparencyFlippedHorizontally(L2511_i_SourcePixelIndex, L2512_i_DestinationPixelIndex, L2509_ui_Width, P2340_i_TransparentColor);
                                        }
                                        L2511_i_SourcePixelIndex -= P2338_i_SourceWidth;
                                        L2512_i_DestinationPixelIndex += P2339_i_DestinationWidth;
                                }
                        } else {
                                if (P2333_puc_Bitmap_Source == NULL) {
                                        for (L2510_ui_LineIndex = 0; L2510_ui_LineIndex < L2508_ui_Height; L2510_ui_LineIndex++) {
                                                if (P2340_i_TransparentColor < 0) {
                                                        F8144_CopyPixelLineFromScreenWithoutTransparencyFlippedHorizontally(L2511_i_SourcePixelIndex, L2512_i_DestinationPixelIndex, L2509_ui_Width);
                                                } else {
                                                }
                                                L2511_i_SourcePixelIndex -= P2338_i_SourceWidth;
                                                L2512_i_DestinationPixelIndex += P2339_i_DestinationWidth;
                                        }
                                }
                        }
#endif
        }
        ASM_STUB_SUFFIX
}

FUNC_DEF void F8152_VIDRV_01_FillBox(
unsigned char* P2516_puc_Bitmap,
int16_t* P2517_pi_Box,
int16_t P2518_i_,
int16_t P2519_i_Width)
{
        int16_t L2513_i_Left;
        int16_t L2514_i_Right;
        int16_t L2515_i_Top;
        int16_t L2516_i_Bottom;
        int16_t L2517_i_Height;
        unsigned int16_t L2518_ui_Width;
        int16_t L2519_i_DestinationOffset;
        unsigned int16_t L2520_ui_LineIndex;


        ASM_STUB_PREFIX
        L2513_i_Left = M768_BOX_LEFT(P2517_pi_Box);
        L2514_i_Right = M769_BOX_RIGHT(P2517_pi_Box);
        L2515_i_Top = M770_BOX_TOP(P2517_pi_Box);
        L2516_i_Bottom = M771_BOX_BOTTOM(P2517_pi_Box);
        L2518_ui_Width = L2514_i_Right - L2513_i_Left + 1;
        L2517_i_Height = L2516_i_Bottom - L2515_i_Top + 1;
        L2519_i_DestinationOffset = L2515_i_Top * 320 + L2513_i_Left;
        for (L2520_ui_LineIndex = 0; L2520_ui_LineIndex < L2517_i_Height; L2520_ui_LineIndex++) {
#if ((EXETYPE == C23_EGA) || (EXETYPE == C25_VGA))
                F8137_SetMultiplePixels(L2519_i_DestinationOffset, P2518_i_, L2518_ui_Width);
#endif
#if (EXETYPE == C24_TANDY)
                F8137_SetMultiplePixels(F8172_(L2519_i_DestinationOffset), P2518_i_, L2518_ui_Width);
#endif
                L2519_i_DestinationOffset += 320;
        }
        ASM_STUB_SUFFIX
}

FUNC_DEF void F8153_VIDRV_07_WaitVerticalBlank(
)
{
        asm     mov     dx, 3DAh
        loc_10990:
        asm     in      al, dx
        asm     and     al, 8
        asm     jnz     loc_10990
        /*         Video status bits:
                   0: retrace.  1=display is in vert or horiz retrace.
                   1: 1=light pen is triggered; 0=armed
                   2: 1=light pen switch is open; 0=closed
                   3: 1=vertical sync pulse is occurring. */
        loc_10995:
        asm     in      al, dx
        asm     and     al, 8
        asm     jz      loc_10995
        /* Video status bits:
           0: retrace.  1=display is in vert or horiz retrace.
           1: 1=light pen is triggered; 0=armed
           2: 1=light pen switch is open; 0=closed
           3: 1=vertical sync pulse is occurring.*/
}

FUNC_DEF void F8154_VIDRV_05_InvertBox(
int16_t P2520_i_X1,
int16_t P2521_i_X2,
int16_t P2522_i_Y1,
int16_t P2523_i_Y2)
{
#if (EXETYPE == C25_VGA)
        char* L3772_pc_;
        int16_t L2524_i_;
#endif
        int16_t L2521_i_;
#if ((EXETYPE == C23_EGA) || (EXETYPE == C24_TANDY))
        int16_t L2522_i_;
        int16_t L2523_i_;
        int16_t L2524_i_;
        int16_t L2525_i_;
#endif


        ASM_STUB_PREFIX
#if ((EXETYPE == C23_EGA) || (EXETYPE == C24_TANDY))
        G2159_puc_Bitmap_Source = G2160_puc_Bitmap_Destination = G8138_;
        L2525_i_ = (P2522_i_Y1 * 320) + P2520_i_X1;
        L2523_i_ = ((L2522_i_ = P2521_i_X2 - P2520_i_X1 + 1) + 1) / 2;
#endif
        for (L2521_i_ = P2522_i_Y1; L2521_i_ <= P2523_i_Y2; L2521_i_++) {
#if (EXETYPE == C23_EGA)
                F8143_CopyPixelLineFromScreenWithoutTransparency(L2525_i_, 0, L2522_i_);
#endif
#if (EXETYPE == C24_TANDY)
                F8143_CopyPixelLineFromScreenWithoutTransparency(F8172_(L2525_i_), 0, L2522_i_);
#endif
#if ((EXETYPE == C23_EGA) || (EXETYPE == C24_TANDY))
                for (L2524_i_ = 0; L2524_i_ < L2523_i_; L2524_i_++) {
                        G8138_[L2524_i_] ^= 0x44;
                }
#endif
#if (EXETYPE == C23_EGA)
                F0680_CopyPixelsToScreenWithoutTransparency(0, L2525_i_, L2522_i_);
#endif
#if (EXETYPE == C24_TANDY)
                F0680_CopyPixelsToScreenWithoutTransparency(0, F8172_(L2525_i_), L2522_i_);
#endif
#if ((EXETYPE == C23_EGA) || (EXETYPE == C24_TANDY))
                L2525_i_ += 320;
#endif
#if (EXETYPE == C25_VGA)
                L3772_pc_ = (char*)(0xA0000000 | (unsigned int16_t)((L2521_i_ * 320) + P2520_i_X1));
                for (L2524_i_ = P2520_i_X1; L2524_i_ <= P2521_i_X2; L2524_i_++) {
                        *L3772_pc_++ ^= 4;
                }
#endif
        }
        ASM_STUB_SUFFIX
}

FUNC_DEF void F8155_VIDRV_06_HatchScreenBox(
int16_t P2524_i_X1,
int16_t P2525_i_X2,
int16_t P2526_i_Y1,
int16_t P2527_i_Y2)
{
#if (EXETYPE == C25_VGA)
        char* L3775_pc_;
#endif
#if ((EXETYPE == C23_EGA) || (EXETYPE == C24_TANDY))
        int16_t L2526_i_;
        int16_t L2527_i_;
        int16_t L2528_i_;
#endif
        int16_t L2529_i_;
        int16_t L2530_i_;


        ASM_STUB_PREFIX
#if ((EXETYPE == C23_EGA) || (EXETYPE == C24_TANDY))
        G2159_puc_Bitmap_Source = G2160_puc_Bitmap_Destination = G8138_;
        L2526_i_ = (P2526_i_Y1 * 320) + P2524_i_X1;
        L2528_i_ = ((L2527_i_ = P2525_i_X2 - P2524_i_X1 + 1) + 1) / 2;
#endif
        for (L2530_i_ = P2526_i_Y1; L2530_i_ <= P2527_i_Y2; L2530_i_++) {
#if (EXETYPE == C23_EGA)
                F8143_CopyPixelLineFromScreenWithoutTransparency(L2526_i_, 0, L2527_i_);
#endif
#if (EXETYPE == C24_TANDY)
                F8143_CopyPixelLineFromScreenWithoutTransparency(F8172_(L2526_i_), 0, L2527_i_);
#endif
#if ((EXETYPE == C23_EGA) || (EXETYPE == C24_TANDY))
                for (L2529_i_ = 0; L2529_i_ < L2528_i_; L2529_i_++) {
                        G8138_[L2529_i_] = (L2530_i_ & 1) ? (G8138_[L2529_i_] & 0x0F) : (G8138_[L2529_i_] & 0xF0);
                }
#endif
#if (EXETYPE == C23_EGA)
                F0680_CopyPixelsToScreenWithoutTransparency(0, L2526_i_, L2527_i_);
#endif
#if (EXETYPE == C24_TANDY)
                F0680_CopyPixelsToScreenWithoutTransparency(0, F8172_(L2526_i_), L2527_i_);
#endif
#if ((EXETYPE == C23_EGA) || (EXETYPE == C24_TANDY))
                L2526_i_ += 320;
#endif
#if (EXETYPE == C25_VGA)
                L3775_pc_ = (char*)(0xA0000000 | (unsigned int16_t)((L2530_i_ * 320) + P2524_i_X1));
                for (L2529_i_ = P2524_i_X1; L2529_i_ <= P2525_i_X2; L2529_i_++) {
                        if ((L2529_i_ ^ L2530_i_) & 1) {
                                L3775_pc_++;
                        } else {
                                *L3775_pc_++ = 0;
                        }
                }
#endif
        }
        ASM_STUB_SUFFIX
}

FUNC_DEF void F8156_SetPalette(
#if (EXETYPE == C23_EGA)
char* P2528_pc_
#endif
)
{
#if (EXETYPE == C25_VGA)
        char L3778_c_Red;
        char L3779_c_Green;
        char L3780_c_Blue;
#endif
        int16_t L2531_i_;
#if ((EXETYPE == C23_EGA) || (EXETYPE == C24_TANDY))
        char L2532_c_;
#endif


        F8153_VIDRV_07_WaitVerticalBlank();
#if ((EXETYPE == C23_EGA) || (EXETYPE == C24_TANDY))
        for (L2531_i_ = 0; L2531_i_ < 16; L2531_i_++) {
#endif
#if (EXETYPE == C23_EGA)
                L2532_c_ = (P2528_pc_[L2531_i_] & 0x07) | ((P2528_pc_[L2531_i_] & 0x08) << 1);
                asm     mov     ax, 40h         /* BIOS segment 40h */
                asm     mov     es, ax
                asm     mov     dx, es:63h      /* Read Video CRT controller base address (color=03D4h, mono=03B4h) */
                asm     add     dl, 6           /* 03DAh / 03BAh Status register 1 */
                asm     pushf                   /* Save flags */
                asm     cli                     /* Disable interrupts */
                asm     push    dx
                asm     in      al, dx          /* Select the address function of the attribute controller */
                asm     mov     dl, 0C0h        /* 03C0h Attribute Address and Palette Address register */
                asm     mov     al, byte ptr L2531_i_
                asm     out     dx, al          /* Send color index */
                asm     mov     al, L2532_c_
                asm     out     dx, al          /* Send color value */
                asm     pop     dx
                asm     in      al, dx          /* Select the address function of the attribute controller */
                asm     mov     dl, 0C0h
                asm     mov     al, 20h
                asm     out     dx, al          /* Send Color select */
                asm     popf                    /* Enable interrupts by restoring flags */
        }
#endif
#if (EXETYPE == C24_TANDY)
                L2532_c_ = G8135_ac_EGATandyColorPalette[L2531_i_];
                asm     mov     dx, 3DAh
                asm     mov     al, byte ptr L2531_i_
                asm     or      al, 10h
                asm     out     dx, al         /* Video: bits 0-1 control */
                                               /* Feature Control outputs FC0 and FC1 */
                asm     mov     dx, 3DEh
                asm     mov     al, L2532_c_
                asm     out     dx, al
        }
        L2532_c_ = G8135_ac_EGATandyColorPalette[16];
        asm     mov     dx, 3DAh
        asm     mov     al, 2
        asm     out     dx, al         /* Video: bits 0-1 control */
                                       /* Feature Control outputs FC0 and FC1 */
        asm     mov     dx, 3DEh
        asm     mov     al, L2532_c_
        asm     out     dx, al
        F8150_(G8136_);
#endif
#if (EXETYPE == C25_VGA)
        /* Port 3C8h : VGA color index in palette */
        asm     pushf
        asm     cli
        asm     mov     dx, 3C8h
        asm     mov     al, 0
        asm     out     dx, al
        /* Write color components for all 32 colors to port 3C9h */
        for (L2531_i_ = 0; L2531_i_ < 32; L2531_i_++) {
                L3778_c_Red = G8183_aac_FullPalette[L2531_i_][0]; /* Size 3 */
                L3779_c_Green = G8183_aac_FullPalette[L2531_i_][1]; /* Size 3 */
                L3780_c_Blue = G8183_aac_FullPalette[L2531_i_][2]; /* Size 3 */
                asm     mov     dx, 3C9h
                asm     mov     al, L3778_c_Red
                asm     out     dx, al
                asm     mov     al, L3779_c_Green
                asm     out     dx, al
                asm     mov     al, L3780_c_Blue
                asm     out     dx, al
        }
        asm     popf
#endif
}

#if ((EXETYPE == C23_EGA) || (EXETYPE == C24_TANDY))
char G4094_CURTAIN_FLAG = 0;
#endif

FUNC_DEF void F8157_VIDRV_08_SetMultipleColorsInPalette(
int16_t P2529_i_PaletteIndex)
{
#if (EXETYPE == C23_EGA)
        BOOLEAN L2533_B_;
#endif
#if ((EXETYPE == C23_EGA) || (EXETYPE == C24_TANDY))
        unsigned char L2534_uc_;
#endif
        char L2535_c_ColorIndex;
        int16_t L2536_i_;


        ASM_STUB_PREFIX
        L2536_i_ = 0;
#if (EXETYPE == C23_EGA)
        L2533_B_ = C0_FALSE;
#endif
        while ((L2535_c_ColorIndex = G8176_PaletteTable[P2529_i_PaletteIndex][L2536_i_].Index) >= 0) {
#if ((EXETYPE == C23_EGA) || (EXETYPE == C24_TANDY))
                if (L2535_c_ColorIndex < 16) {
                        if ((L2534_uc_ = G8176_PaletteTable[P2529_i_PaletteIndex][L2536_i_].Val1) != 0xFF) {
                                G8135_ac_EGATandyColorPalette[L2535_c_ColorIndex] = L2534_uc_;
                        }
#if (EXETYPE == C23_EGA)
                        if ((L2534_uc_ = G8176_PaletteTable[P2529_i_PaletteIndex][L2536_i_].Val2) != 0xFF) {
                                G8136_[L2535_c_ColorIndex] = L2534_uc_;
                                L2533_B_ = C1_TRUE;
                        }
#endif
#if (EXETYPE == C24_TANDY)
                        G8136_[L2535_c_ColorIndex] = G8176_PaletteTable[P2529_i_PaletteIndex][L2536_i_].Val2;
#endif
                }
#endif
#if (EXETYPE == C25_VGA)
                if (L2535_c_ColorIndex < 32) {
                        G8183_aac_FullPalette[L2535_c_ColorIndex][0] = G8176_PaletteTable[P2529_i_PaletteIndex][L2536_i_].Red;
                        G8183_aac_FullPalette[L2535_c_ColorIndex][1] = G8176_PaletteTable[P2529_i_PaletteIndex][L2536_i_].Green;
                        G8183_aac_FullPalette[L2535_c_ColorIndex][2] = G8176_PaletteTable[P2529_i_PaletteIndex][L2536_i_].Blue;
                }
#endif
                L2536_i_++;
        }
        if (G4094_CURTAIN_FLAG == 1) {
#if (EXETYPE == C23_EGA)
                F8156_SetPalette(G8135_ac_EGATandyColorPalette);
#endif
#if ((EXETYPE == C24_TANDY) || (EXETYPE == C25_VGA))
                F8156_SetPalette();
#endif
        }
#if (EXETYPE == C23_EGA)
        if (L2533_B_) {
                F8150_(G8136_);
        }
#endif
        ASM_STUB_SUFFIX
}

#if (EXETYPE == C25_VGA)
FUNC_DEF void F8230_VIDRV_16_SetSingleColorComponentsInPalette(
int16_t P3234_i_ColorIndex,
char P3235_c_Red,
char P3236_c_Green,
char P3237_c_Blue)
{
        ASM_STUB_PREFIX
        G8183_aac_FullPalette[P3234_i_ColorIndex][0] = (P3235_c_Red << 2) + 3;
        G8183_aac_FullPalette[P3234_i_ColorIndex][1] = (P3236_c_Green << 2) + 3;
        G8183_aac_FullPalette[P3234_i_ColorIndex][2] = (P3237_c_Blue << 2) + 3;
        if (G4094_CURTAIN_FLAG == 1) {
                F8156_SetPalette();
        }
        ASM_STUB_SUFFIX
}
#endif

#if ((EXETYPE == C23_EGA) || (EXETYPE == C24_TANDY))
FUNC_DEF void F8158_VIDRV_18_SetSingleColorInPalette(
int16_t P2530_i_ColorIndex,
int16_t P2531_i_)
{
        ASM_STUB_PREFIX
        G8135_ac_EGATandyColorPalette[P2530_i_ColorIndex] = P2531_i_;
        if (G4094_CURTAIN_FLAG == 1) {
                F8156_SetPalette(G8135_ac_EGATandyColorPalette);
        }
        ASM_STUB_SUFFIX
}
#endif

FUNC_DEF void F8159_VIDRV_11_PALETTE_SetCurtain(
char P2532_c_State)
{
#if (EXETYPE == C23_EGA)
        char L2537_ac_[17];
#endif
        int16_t L2538_i_;


        ASM_STUB_PREFIX
        if (P2532_c_State == C0_BLACK_PALETTE) {
#if ((EXETYPE == C23_EGA) || (EXETYPE == C24_TANDY))
                for (L2538_i_ = 0; L2538_i_ < 17; L2538_i_++) {
#if (EXETYPE == C23_EGA)
                        L2537_ac_[L2538_i_] = 0;
#endif
#if (EXETYPE == C24_TANDY)
                        G8135_ac_EGATandyColorPalette[L2538_i_] = 0;
#endif
                }
#endif
#if (EXETYPE == C23_EGA)
                F8156_SetPalette(L2537_ac_);
        } else {
                F8156_SetPalette(G8135_ac_EGATandyColorPalette);
#endif
#if (EXETYPE == C25_VGA)
                F8153_VIDRV_07_WaitVerticalBlank();
                /* Set palette to full black */
                asm     pushf
                asm     cli
                asm     mov     dx, 3C8h
                asm     mov     al, 0
                asm     out     dx, al
                for (L2538_i_ = 0; L2538_i_ < 32; L2538_i_++) {
                        asm     mov     dx, 3C9h
                        asm     mov     al, 0
                        asm     out     dx, al
                        asm     out     dx, al
                        asm     out     dx, al
                }
                asm     popf
#endif
        }
#if (EXETYPE == C24_TANDY)
        F8156_SetPalette();
#endif
#if (EXETYPE == C25_VGA)
        if (P2532_c_State == C1_NORMAL_PALETTE) {
                F8156_SetPalette();
        }
#endif
        G4094_CURTAIN_FLAG = P2532_c_State;
        ASM_STUB_SUFFIX
}

FUNC_DEF void F8160_VIDRV_12_SetCreatureReplacementColors(
int16_t P2533_i_,
int16_t P2534_i_)
{
        COLOR_DEF* L2539_ps_;
        int16_t L2540_i_;


        ASM_STUB_PREFIX
        for (L2540_i_ = 0; L2540_i_ < 6; L2540_i_++) {
                L2539_ps_ = G8176_PaletteTable[L2540_i_];
#if ((EXETYPE == C23_EGA) || (EXETYPE == C24_TANDY))
                L2539_ps_[P2533_i_].Val2 = G8132_[P2534_i_][L2540_i_];
#endif
#if (EXETYPE == C25_VGA)
                L2539_ps_[P2533_i_].Red = G8175_CREAT_PAL[P2534_i_][L2540_i_].Red;
                L2539_ps_[P2533_i_].Green = G8175_CREAT_PAL[P2534_i_][L2540_i_].Green;
                L2539_ps_[P2533_i_].Blue = G8175_CREAT_PAL[P2534_i_][L2540_i_].Blue;
#endif
        }
        ASM_STUB_SUFFIX
}

FUNC_DEF void F8161_VIDRV_09_BlitViewPort(
unsigned char* P2535_puc_Bitmap,
int16_t* P2536_pi_Box)
{
        ASM_STUB_PREFIX
#if (EXETYPE == C23_EGA)
        F8147_(P2535_puc_Bitmap, M770_BOX_TOP(P2536_pi_Box) * 40);
#endif
#if (EXETYPE == C24_TANDY)
        F8147_(P2535_puc_Bitmap, M770_BOX_TOP(P2536_pi_Box));
#endif
#if (EXETYPE == C25_VGA)
        G8177_c_ViewportColorIndexOffset = 0x10;
        F8151_VIDRV_02_Blit(P2535_puc_Bitmap, NULL, P2536_pi_Box, 0, 0, 224, 320, CM1_COLOR_NO_TRANSPARENCY, MASK0x0000_NO_FLIP);
        G8177_c_ViewportColorIndexOffset = 0;
#endif
        ASM_STUB_SUFFIX
}

FUNC_DEF void F8162_VIDRV_10_ScrollMessageAreaUp(
int16_t* P2537_pi_Box,
int16_t P2538_i_)
{
        int16_t L2541_i_;


        ASM_STUB_PREFIX
        for (L2541_i_ = M770_BOX_TOP(P2537_pi_Box) + P2538_i_; M771_BOX_BOTTOM(P2537_pi_Box) >= L2541_i_; L2541_i_++) {
#if (EXETYPE == C23_EGA)
                F8140_ScrollMessageAreaUp((L2541_i_ - P2538_i_) * 320, L2541_i_ * 320, M769_BOX_RIGHT(P2537_pi_Box) - M768_BOX_LEFT(P2537_pi_Box) + 1);
#endif
#if (EXETYPE == C24_TANDY)
                F8140_ScrollMessageAreaUp(F8172_((L2541_i_ - P2538_i_) * 320), F8172_(L2541_i_ * 320), M769_BOX_RIGHT(P2537_pi_Box) - M768_BOX_LEFT(P2537_pi_Box) + 1);
#endif
#if (EXETYPE == C25_VGA)
                F8140_ScrollMessageAreaUp((char*)(0xA0000000 | (unsigned int16_t)(L2541_i_ * 320)), (char*)(0xA0000000 | (unsigned int16_t)((L2541_i_ - P2538_i_) * 320)), M769_BOX_RIGHT(P2537_pi_Box) - M768_BOX_LEFT(P2537_pi_Box) + 1);
#endif
        }
        ASM_STUB_SUFFIX
}

FUNC_DEF void F8163_VIDRV_00_CopyPixelsToScreenWithoutTransparency(
unsigned char* P2539_puc_Bitmap,
unsigned int16_t P2540_ui_SourcePixelIndex,
unsigned int16_t P2541_ui_DestinationPixelIndex,
unsigned int16_t P2542_ui_PixelCount)
{
#if (EXETYPE == C24_TANDY)
        long L3216_l_PixelCount;
        int16_t L3217_i_FirstLinePixelCount = 0;


#endif
        ASM_STUB_PREFIX
        G2159_puc_Bitmap_Source = P2539_puc_Bitmap;
#if ((EXETYPE == C23_EGA) || (EXETYPE == C25_VGA))
        F0680_CopyPixelsToScreenWithoutTransparency(P2540_ui_SourcePixelIndex, P2541_ui_DestinationPixelIndex, P2542_ui_PixelCount);
#endif
#if (EXETYPE == C24_TANDY)
        L3217_i_FirstLinePixelCount = 320 - (P2541_ui_DestinationPixelIndex % 320);
        if (L3217_i_FirstLinePixelCount > P2542_ui_PixelCount) {
                L3217_i_FirstLinePixelCount = P2542_ui_PixelCount;
        }
        if (L3217_i_FirstLinePixelCount) { /* Copy pixels on first line */
                F0680_CopyPixelsToScreenWithoutTransparency(P2540_ui_SourcePixelIndex, F8172_(P2541_ui_DestinationPixelIndex), L3217_i_FirstLinePixelCount);
                P2542_ui_PixelCount -= L3217_i_FirstLinePixelCount;
                P2541_ui_DestinationPixelIndex += L3217_i_FirstLinePixelCount;
                P2540_ui_SourcePixelIndex += L3217_i_FirstLinePixelCount;
        }
        L3216_l_PixelCount = P2542_ui_PixelCount;
        while (L3216_l_PixelCount > 320) { /* Copy full lines of pixels */
                F0680_CopyPixelsToScreenWithoutTransparency(P2540_ui_SourcePixelIndex, F8172_(P2541_ui_DestinationPixelIndex), 320);
                L3216_l_PixelCount -= 320;
                P2541_ui_DestinationPixelIndex += 320;
                P2540_ui_SourcePixelIndex += 320;
        }
        if (L3216_l_PixelCount > 0) { /* Copy pixels remaining on last line */
                F0680_CopyPixelsToScreenWithoutTransparency(P2540_ui_SourcePixelIndex, F8172_(P2541_ui_DestinationPixelIndex), L3216_l_PixelCount);
        }
#endif
        ASM_STUB_SUFFIX
}

FUNC_DEF void F8164_VIDRV_13_InitializeUnusedGlobalVariables(
char** P2543_pc_A,
char** P2544_pc_B)
{
        *P2543_pc_A = NULL;
        *P2544_pc_B = NULL;
}

FUNC_DEF long F8165_VIDRV_14_GetPrefixedBitmapByteCountOrBlitFromScreenNoTransparency(
int16_t* P2545_pi_, /* Pointer to a box followed by bitmap */
unsigned int16_t P2546_ui_X,
int16_t P2547_i_Y,
int16_t P2548_i_Width,
unsigned int16_t P2549_ui_Height,
int16_t P2550_i_Operation)
{
        int16_t* L2542_pi_Box = P2545_pi_;
#if (EXETYPE == C25_VGA)
        int16_t L3220_i_;
#endif
        long L2543_l_;
#if ((EXETYPE == C23_EGA) || (EXETYPE == C24_TANDY))
        int16_t L2544_ai_Box[4];
#endif
#if (EXETYPE == C25_VGA)
        int16_t L3223_i_Unreferenced;
        int16_t L3224_i_Unreferenced;
#endif


        ASM_STUB_PREFIX
        if (P2550_i_Operation == 0) { /* GetPrefixedBitmapByteCount */
#if ((EXETYPE == C23_EGA) || (EXETYPE == C24_TANDY))
                L2543_l_ = (P2548_i_Width * P2549_ui_Height) + 8; /* 8 bytes for a Box + Bitmap size */
#endif
#if (EXETYPE == C25_VGA)
                L2543_l_ = (P2548_i_Width * P2549_ui_Height) + 6; /* 6 bytes for a partial Box + Bitmap size */
#endif
        } else {
#if ((EXETYPE == C23_EGA) || (EXETYPE == C24_TANDY))
                *L2542_pi_Box = P2546_ui_X;
                *(L2542_pi_Box + 1) = P2547_i_Y;
                *(L2542_pi_Box + 2) = P2548_i_Width;
                *(L2542_pi_Box + 3) = P2549_ui_Height;
                P2545_pi_ += 4;
                M768_BOX_LEFT(L2544_ai_Box) = 0;
                M769_BOX_RIGHT(L2544_ai_Box) = P2548_i_Width - 1;
                M770_BOX_TOP(L2544_ai_Box) = 0;
                M771_BOX_BOTTOM(L2544_ai_Box) = P2549_ui_Height - 1;
                F8151_VIDRV_02_Blit(NULL, (char*)P2545_pi_, L2544_ai_Box, P2546_ui_X, P2547_i_Y, 320, P2548_i_Width, CM1_COLOR_NO_TRANSPARENCY, MASK0x0000_NO_FLIP);
#endif
#if (EXETYPE == C25_VGA)
                L3220_i_ = P2547_i_Y * 320 + P2546_ui_X;
                *L2542_pi_Box = P2548_i_Width;
                *(L2542_pi_Box + 1) = P2549_ui_Height;
                *(L2542_pi_Box + 2) = L3220_i_;
                P2545_pi_ += 3;
                asm     cld
                asm     push    si
                asm     push    di
                asm     les     di, P2545_pi_
                asm     mov     si, L3220_i_
                asm     mov     bx, P2549_ui_Height
                asm     mov     cx, P2548_i_Width
                asm     push    ds
                asm     mov     ax, 0A000h      /* VGA screen memory segment address */
                asm     mov     ds, ax
                loc_10E20:
                asm     push    si
                asm     push    cx
                loc_10E22:
                asm     rep movsb               /* Copy bytes from ds:si to es:di */
                asm     or      cx, cx
                asm     jnz     loc_10E22
                asm     pop     cx
                asm     pop     si
                asm     add     si, 320
                asm     dec     bx
                asm     jnz     loc_10E20
                asm     pop     ds
                asm     pop     di
                asm     pop     si
#endif
        }
        ASM_STUB_SUFFIX
        return L2543_l_;
}

FUNC_DEF void F8166_VIDRV_15_BlitToScreenNoTransparency(
int16_t* P2551_pi_) /* Pointer to a box followed by bitmap */
{
        int16_t* L2545_pi_ = P2551_pi_;
#if (EXETYPE == C25_VGA)
        int16_t L2549_i_;
#endif
        int16_t L2546_i_;
#if (EXETYPE == C25_VGA)
        int16_t L2548_i_;
#endif
        int16_t L2547_i_;
#if ((EXETYPE == C23_EGA) || (EXETYPE == C24_TANDY))
        int16_t L3685_ai_Box[4];
        int16_t L2548_i_;
        int16_t L2549_i_;
#endif
#if (EXETYPE == C25_VGA)
        int16_t L3800_i_;
#endif


        ASM_STUB_PREFIX
        L2546_i_ = *L2545_pi_;
        L2548_i_ = *(L2545_pi_ + 1);
        L2549_i_ = *(L2545_pi_ + 2);
#if ((EXETYPE == C23_EGA) || (EXETYPE == C24_TANDY))
        L2547_i_ = *(L2545_pi_ + 3);
        P2551_pi_ += 4;
        M768_BOX_LEFT(L3685_ai_Box) = L2546_i_;
        M769_BOX_RIGHT(L3685_ai_Box) = L2546_i_ + L2549_i_ - 1;
        M770_BOX_TOP(L3685_ai_Box) = L2548_i_;
        M771_BOX_BOTTOM(L3685_ai_Box) = L2548_i_ + L2547_i_ - 1;
        F8151_VIDRV_02_Blit((char*)P2551_pi_, NULL, L3685_ai_Box, 0, 0, L2549_i_, 320, CM1_COLOR_NO_TRANSPARENCY, MASK0x0000_NO_FLIP);
#endif
#if (EXETYPE == C25_VGA)
        P2551_pi_ += 3;
        asm     cld
        asm     push    si
        asm     push    di
        asm     mov     di, L2549_i_
        asm     mov     bx, L2548_i_
        asm     mov     cx, L2546_i_
        asm     mov     ax, 0A000h
        asm     mov     es, ax
        asm     push    ds
        asm     lds     si, P2551_pi_
        loc_10E8C:
        asm     push    di
        asm     push    cx
        loc_10E8E:
        asm     rep movsb
        asm     or      cx, cx
        asm     jnz     loc_10E8E
        asm     pop     cx
        asm     pop     di
        asm     add     di, 320
        asm     dec     bx
        asm     jnz     loc_10E8C
        asm     pop     ds
        asm     pop     di
        asm     pop     si
#endif
        ASM_STUB_SUFFIX
}

FUNC_DEF void F8167_VIDRV_03_BlitMousePointerPrefixedBitmapFromScreen(
int16_t P2552_i_X,
int16_t P2553_i_Y)
{
        unsigned int16_t L2550_ui_;
        unsigned int16_t L2551_ui_;


        ASM_STUB_PREFIX
        L2550_ui_ = 320 - P2552_i_X;
        if (L2550_ui_ > 18) {
                L2550_ui_ = 18;
        }
        L2551_ui_ = 200 - P2553_i_Y;
        if (L2551_ui_ > 18) {
                L2551_ui_ = 18;
        }
        F8165_VIDRV_14_GetPrefixedBitmapByteCountOrBlitFromScreenNoTransparency(G8133_PrefixedBitmap, P2552_i_X, P2553_i_Y, L2550_ui_, L2551_ui_, 1);
        ASM_STUB_SUFFIX
}

FUNC_DEF void F8168_VIDRV_04_BlitMousePointerPrefixedBitmapToScreen(
)
{
        ASM_STUB_PREFIX
        F8166_VIDRV_15_BlitToScreenNoTransparency(G8133_PrefixedBitmap);
        ASM_STUB_SUFFIX
}

FUNC_DEF void F8169_VIDRV_19_BlackenAllPixelsOneByOne(
void)
{
        unsigned int16_t L2552_ui_;


        ASM_STUB_PREFIX
        L2552_ui_ = 1;
        do {
                if (L2552_ui_ < 64000) {
                        F8137_SetMultiplePixels(L2552_ui_, C00_COLOR_BLACK, 1); /* Set one pixel */
                }
                L2552_ui_ = (L2552_ui_ & 1) ? ((L2552_ui_ >> 1) ^ 0xB400) : (L2552_ui_ >> 1);
        } while (L2552_ui_ != 1);
        F8137_SetMultiplePixels(0, C00_COLOR_BLACK, 1);     /* Set last pixel */
        ASM_STUB_SUFFIX
}

FUNC_DEF int16_t F8170_Return0(
)
{
        return 0;
}

FUNC_DEF void F8171_ExecuteProgram(
char* P2554_pc_FileName,
char* P2555_pc_)
{
        asm     jmp     loc_12515
        asm     V8171000_ParamBlock     dw 0
        asm     V8171001_               dd 0
        asm                             dd V8171002_
        asm                             dd V8171002_
        asm     V8171002_               db 0, 0Bh dup(20h), 19h dup(0)
        asm     V8171003_               dd 0
        loc_12515:
        asm     les     ax, P2555_pc_
        asm     mov     word ptr cs:V8171001_, ax
        asm     mov     ax, es
        asm     mov     word ptr cs:V8171001_+2, ax
        asm     push    ds
        asm     mov     bx, offset V8171000_ParamBlock
        asm     mov     ax, cs
        asm     mov     es, ax
        asm     lds     dx, P2554_pc_FileName
        asm     mov     ax, 4B00h
        asm     mov     word ptr cs:V8171003_, sp
        asm     mov     word ptr cs:V8171003_+2, ss
        asm     cld
        asm     int     21h     /* DOS - 2+ - LOAD OR EXECUTE (EXEC) */
                                /* DS:DX -> ASCIZ filename */
                                /* ES:BX -> parameter block */
                                /* AL = subfunc: load & execute program */
        asm     mov     ss, word ptr cs:V8171003_+2
        asm     mov     sp, word ptr cs:V8171003_
        asm     pop     ds
}

#if ((EXETYPE == C23_EGA) || (EXETYPE == C24_TANDY))
char* G8141_apc_VideoDriverVector[32] = {
        (char*)F8163_VIDRV_00_CopyPixelsToScreenWithoutTransparency,                              /*  0 */
        (char*)F8152_VIDRV_01_FillBox,                              /*  1 */
        (char*)F8151_VIDRV_02_Blit,                          /*  2 */
        (char*)F8167_VIDRV_03_BlitMousePointerPrefixedBitmapFromScreen,                              /*  3 */
        (char*)F8168_VIDRV_04_BlitMousePointerPrefixedBitmapToScreen,                              /*  4 */
        (char*)F8154_VIDRV_05_InvertBox,                              /*  5 */
        (char*)F8155_VIDRV_06_HatchScreenBox,                              /*  6 */
        (char*)F8153_VIDRV_07_WaitVerticalBlank,              /*  7 */
        (char*)F8157_VIDRV_08_SetMultipleColorsInPalette,    /*  8 */
        (char*)F8161_VIDRV_09_BlitViewPort,                  /*  9 */
        (char*)F8162_VIDRV_10_ScrollMessageAreaUp,                              /* 10 */
        (char*)F8159_VIDRV_11_PALETTE_SetCurtain,            /* 11 */
        (char*)F8160_VIDRV_12_SetCreatureReplacementColors,  /* 12 */
        (char*)F8164_VIDRV_13_InitializeUnusedGlobalVariables,                              /* 13 */
        (char*)F8165_VIDRV_14_GetPrefixedBitmapByteCountOrBlitFromScreenNoTransparency,                              /* 14 */
        (char*)F8166_VIDRV_15_BlitToScreenNoTransparency,                              /* 15 */
        (char*)F8170_Return0,                               /* 16 */
        (char*)F8170_Return0,                               /* 17 */
#if (EXETYPE == C23_EGA)
        (char*)F8158_VIDRV_18_SetSingleColorInPalette,                              /* 18 */
#endif
#if (EXETYPE == C24_TANDY)
        (char*)F8170_Return0,                               /* 18 */
#endif
        (char*)F8169_VIDRV_19_BlackenAllPixelsOneByOne,                              /* 19 */
        (char*)F8170_Return0,                               /* 20 */
        (char*)F8170_Return0,                               /* 21 */
        (char*)F8170_Return0,                               /* 22 */
        (char*)F8170_Return0,                               /* 23 */
        (char*)F8170_Return0,                               /* 24 */
        (char*)F8170_Return0,                               /* 25 */
        (char*)F8170_Return0,                               /* 26 */
        (char*)F8170_Return0,                               /* 27 */
        (char*)F8170_Return0,                               /* 28 */
        (char*)F8170_Return0,                               /* 29 */
        (char*)F8170_Return0,                               /* 30 */
        (char*)F8170_Return0 };                             /* 31 */
#endif

FUNC_DEF void main(
int16_t argc,
char* argv[])
{
        char L2553_c_BackupVideoMode;
        unsigned char L2554_uc_ArgumentCharacter;
        int16_t L2555_i_CharacterIndex;
        unsigned char L2556_auc_ArgumentString[80] = "";
        int16_t L2557_i_ArgumentCharacterIndex;
        int16_t L2558_i_ArgumentIndex;


        asm     mov     ax, ds
        asm     mov     cs:V0000000_DataSegment, ax
#if ((EXETYPE == C23_EGA) || (EXETYPE == C25_VGA))
        G8134_pc_VideoMemory = (char*)0xA0000000;
#endif
#if (EXETYPE == C24_TANDY)
        G8134_pc_VideoMemory = (char*)0xB8000000;
#endif
        asm     mov     ah, 0Fh
        asm     int     10h
        asm     mov     L2553_c_BackupVideoMode, al
        asm     mov     ah, 0
#if (EXETYPE == C24_TANDY)
        asm     mov     al, 9
#endif
#if (EXETYPE == C23_EGA)
        asm     mov     al, 0Dh
#endif
#if (EXETYPE == C25_VGA)
        asm     mov     al, 13h
#endif
        asm     int     10h
        /* ; - VIDEO - GET CURRENT VIDEO MODE
        ; Return: AH = number of columns on screen
        ; AL = current video mode
        ; BH = current active display page

        ; - VIDEO - SET VIDEO MODE
        ; AL = mode */
        /* Mode 0Dh = 320x200 pixels 16 colors EGA */
        /* Mode 13h = 320x200 pixels 256 colors */
        setvect(C255_DM_VIDEO_INTERRUPT, (void interrupt (*)())&G8141_apc_VideoDriverVector);
        for (L2558_i_ArgumentIndex = 2, L2555_i_CharacterIndex = 1; L2558_i_ArgumentIndex < argc; L2558_i_ArgumentIndex++) { /* Prepare command line arguments */
                if (L2555_i_CharacterIndex > 1) {
                        L2556_auc_ArgumentString[L2555_i_CharacterIndex++] = ' ';
                }
                for (L2557_i_ArgumentCharacterIndex = 0; L2557_i_ArgumentCharacterIndex < 80; L2557_i_ArgumentCharacterIndex++) {
                        if ((L2554_uc_ArgumentCharacter = argv[L2558_i_ArgumentIndex][L2557_i_ArgumentCharacterIndex]) == '\0') {
                                break;
                        }
                        L2556_auc_ArgumentString[L2555_i_CharacterIndex++] = L2554_uc_ArgumentCharacter;
                }
                L2556_auc_ArgumentString[L2555_i_CharacterIndex] = '\r';
        }
        L2556_auc_ArgumentString[L2555_i_CharacterIndex++] = ' ';
        L2556_auc_ArgumentString[L2555_i_CharacterIndex++] = '-';
        L2556_auc_ArgumentString[L2555_i_CharacterIndex++] = 'v';
        L2556_auc_ArgumentString[L2555_i_CharacterIndex] = '\r';
        L2556_auc_ArgumentString[0] = L2555_i_CharacterIndex - 1;
        F8171_ExecuteProgram(argv[1], L2556_auc_ArgumentString);
        /* Restore previous video mode */
        asm     mov     ah, 0
        asm     mov     al, L2553_c_BackupVideoMode
        asm     int     10h
        /*           ; - VIDEO - SET VIDEO MODE
                     ; AL = mode */
        asm     jmp     loc_1311E
        asm     V0000000_DataSegment     dw 0
        loc_1311E: ;
}
#endif
