#ifndef COMPILE_H
#include "COMPILE.H"
#endif
#ifdef MEDIA463_P20JA_P20JB_I34E_I34M_P31J
FUNC_DEF static void F0680_CopyPixelsToScreenWithoutTransparency( /* For VGA: writes a byte (8 bit) to video memory for each source pixel (4 bit) from G2159_puc_Bitmap_Source */
int16_t P2494_i_SourcePixelIndex,               /* From beginning of G2159_puc_Bitmap_Source */
int16_t P2495_i_DestinationPixelIndex,          /* From beginning of video memory */
int16_t P2496_i_PixelCount)
{
#if ((EXETYPE == C20_NEC8) || (EXETYPE == C21_NEC16))
        asm     push    ds
        asm     cld
        asm     les     si, G2159_puc_Bitmap_Source
#ifdef MEDIA472_P20JB_P31J
        asm     mov     ax, es
        asm     dec     ax
        asm     mov     es, ax
        asm     add     si, 10h
#endif
        asm     mov     ax, P2494_i_SourcePixelIndex
        asm     mov     bx, P2495_i_DestinationPixelIndex
        asm     mov     di, bx
        asm     shr     ax, 1
        asm     rcl     bx, 1
        asm     shl     bx, 1
        asm     and     bx, 0Eh
        asm     add     si, ax
        asm     shr     di, 1
        asm     shr     di, 1
        asm     mov     ax, di
        asm     mov     ch, C80_BITPLANE_LINE_BYTE_COUNT
        asm     div     ch
        asm     mov     cl, ah
        asm     mov     ch, 0A0h
        asm     mul     ch
        asm     xor     ch, ch
        asm     add     ax, cx
        asm     mov     di, ax
        asm     push    bp
        asm     mov     bp, P2496_i_PixelCount
        asm     mov     ax, es
        asm     mov     ds, ax
        asm     add     bx, offset V8386000_jumptable1
        asm     jmp     word ptr cs:[bx]
        asm     V8386000_jumptable1      dw      asm_loc_1167F
        asm     dw      asm_loc_11849
        asm     dw      asm_loc_1196F
        asm     dw      asm_loc_11774
        asm     dw      asm_loc_11799
        asm     dw      asm_loc_11995
        asm     dw      asm_loc_119B4
        asm     dw      asm_loc_117B9
        loc_1167F:
        asm     asm_loc_1167F:
        asm     push    bp
        asm     shr     bp, 1
        asm     shr     bp, 1
        asm     shr     bp, 1
        asm     inc     bp
        loc_11687:
        asm     mov     es, bp
        asm     lodsw
        asm     xor     bx, bx
        asm     xchg    bl, ah
        asm     mov     bp, ax
        asm     add     bx, bx
        asm     mov     cx, V8382000_+bx+512
        asm     mov     dx, V8382000_+bx+1536
        asm     add     bp, bp
        asm     or      cx, V8382000_+bp
        asm     or      dx, V8382000_+bp+1024
        asm     lodsw
        asm     xor     bx, bx
        asm     xchg    bl, ah
        asm     mov     bp, ax
        asm     add     bx, bx
        asm     mov     ax, V8382000_+bx+512
        asm     mov     bx, V8382000_+bx+1536
        asm     add     bp, bp
        asm     or      ax, V8382000_+bp
        asm     or      bx, V8382000_+bp+1024
        asm     xchg    ch, al
        asm     xchg    dh, bl
        asm     mov     bp, es
        asm     dec     bp
        asm     jz      loc_116FE
        asm     mov     es, cs:V8384001_BitPlane0Offset
#if EXETYPE == C20_NEC8
        asm     mov     es:[di], bx
        asm     and     bx, dx
        asm     mov     es:[di+C80_BITPLANE_LINE_BYTE_COUNT], bx
        asm     mov     es:[di-8000h], ax
        asm     and     ax, dx
        asm     mov     es:[di-7FB0h], ax
#endif
#if EXETYPE == C21_NEC16
        asm     mov     es:[di], dx
        asm     mov     es:[di+C80_BITPLANE_LINE_BYTE_COUNT], dx
        asm     mov     es:[di-8000h], bx
        asm     mov     es:[di-7FB0h], bx
#endif
        asm     mov     es, cs:V8384002_BitPlane2Offset
        asm     mov     es:[di], cx
#if EXETYPE == C20_NEC8
        asm     and     cx, dx
#endif
        asm     mov     es:[di+C80_BITPLANE_LINE_BYTE_COUNT], cx
#if EXETYPE == C20_NEC8
        asm     add     di, 2
#endif
#if EXETYPE == C21_NEC16
        asm     mov     es, cs:V8384003_
        asm     stosw
        asm     mov     es:[di+4Eh], ax
#endif
        asm     jmp     loc_11687
        loc_116FE:
        asm     pop     bp
        asm     and     bp, 7
        asm     jnz     loc_11707
        asm     jmp     loc_11A56
        loc_11707:
        asm     push    cx
        asm     push    bx
        asm     mov     cx, bp
        asm     shl     cl, 1
        asm     mov     bx, 0FFFFh
        asm     shr     bx, cl
        asm     not     bx
        asm     xchg    bh, bl
        asm     mov     bp, bx
        asm     pop     bx
        asm     pop     cx
        asm     and     ax, bp
        asm     and     bx, bp
        asm     and     cx, bp
        asm     and     dx, bp
        asm     not     bp
        asm     mov     es, cs:V8384001_BitPlane0Offset
        asm     and     es:[di], bp
#if EXETYPE == C20_NEC8
        asm     or      es:[di], bx
        asm     and     es:[di+C80_BITPLANE_LINE_BYTE_COUNT], bp
        asm     and     bx, dx
        asm     or      es:[di+C80_BITPLANE_LINE_BYTE_COUNT], bx
        asm     and     es:[di-8000h], bp
        asm     or      es:[di-8000h], ax
        asm     and     es:[di-7FB0h], bp
        asm     and     ax, dx
        asm     or      es:[di-7FB0h], ax
#endif
#if EXETYPE == C21_NEC16
        asm     or      es:[di], dx
        asm     and     es:[di+C80_BITPLANE_LINE_BYTE_COUNT], bp
        asm     or      es:[di+C80_BITPLANE_LINE_BYTE_COUNT], dx
        asm     and     es:[di-8000h], bp
        asm     or      es:[di-8000h], bx
        asm     and     es:[di-7FB0h], bp
        asm     or      es:[di-7FB0h], bx
#endif
        asm     mov     es, cs:V8384002_BitPlane2Offset
        asm     and     es:[di], bp
        asm     or      es:[di], cx
        asm     and     es:[di+C80_BITPLANE_LINE_BYTE_COUNT], bp
#if EXETYPE == C20_NEC8
        asm     and     cx, dx
#endif
        asm     or      es:[di+C80_BITPLANE_LINE_BYTE_COUNT], cx
#if EXETYPE == C21_NEC16
        asm     mov     es, cs:V8384003_
        asm     and     es:[di], bp
        asm     or      es:[di], ax
        asm     and     es:[di+C80_BITPLANE_LINE_BYTE_COUNT], bp
        asm     or      es:[di+C80_BITPLANE_LINE_BYTE_COUNT], ax
#endif
        asm     jmp     loc_11A56
        loc_11774:
        asm     asm_loc_11774:
#ifdef MEDIA472_P20JB_P31J
        asm     cmp     bp, 2
        asm     jg      loc_11788
        asm     mov     dl, 3Ch
        asm     cmp     bp, 1
        asm     jg      loc_11782
        asm     mov     dl, 30h
        loc_11782:
        asm     call    F8387_
        asm     jmp     loc_11A56
        loc_11788:
#endif
        asm     mov     dl, 3Fh
        asm     call    F8387_
        asm     add     si, 2
        asm     inc     di
        asm     sub     bp, 3
#ifdef MEDIA472_P20JB_P31J
        asm     jz      loc_117C9
#endif
        asm     jmp     loc_1167F
        loc_11799:
        asm     asm_loc_11799:
#ifdef MEDIA472_P20JB_P31J
        asm     cmp     bp, 1
        asm     jg      loc_117A7
        asm     mov     dl, 0Ch
        asm     dec     si
        asm     call    F8387_
        asm     jmp     loc_11A56
        loc_117A7:
#endif
        asm     mov     dl, 0Fh
        asm     dec     si
        asm     call    F8387_
        asm     add     si, 2
        asm     inc     di
        asm     sub     bp, 2
#ifdef MEDIA472_P20JB_P31J
        asm     jz      loc_117C9
#endif
        asm     jmp     loc_1167F
        loc_117B9:
        asm     asm_loc_117B9:
        asm     mov     dl, 3
        asm     dec     si
        asm     call    F8387_
        asm     add     si, 2
        asm     inc     di
        asm     dec     bp
#ifdef MEDIA472_P20JB_P31J
        asm     jz      loc_117C9
#endif
        asm     jmp     loc_1167F
#ifdef MEDIA472_P20JB_P31J
        loc_117C9:
        asm     jmp     loc_11A56
#endif
        asm     F8387_:
        asm     push    bp
        asm     mov     bp, [si]
        asm     and     bp, 0FFh
        asm     add     bp, bp
        asm     mov     ax, V8382000_+bp
        asm     mov     bx, V8382000_+bp+1024
        asm     mov     bp, [si+1]
        asm     and     bp, 0FFh
        asm     add     bp, bp
        asm     or      ax, V8382000_+bp+512
        asm     or      bx, V8382000_+bp+1536
        asm     mov     dh, dl
        asm     and     ax, dx
        asm     and     bx, dx
        asm     not     dl
        asm     mov     es, cs:V8384001_BitPlane0Offset
        asm     and     es:[di], dl
#if EXETYPE == C20_NEC8
        asm     or      es:[di], bh
        asm     and     es:[di+C80_BITPLANE_LINE_BYTE_COUNT], dl
        asm     and     bh, bl
        asm     or      es:[di+C80_BITPLANE_LINE_BYTE_COUNT], bh
        asm     and     es:[di-8000h], dl
        asm     or      es:[di-8000h], ah
        asm     and     es:[di-7FB0h], dl
        asm     and     ah, bl
        asm     or      es:[di-7FB0h], ah
#endif
#if EXETYPE == C21_NEC16
        asm     or      es:[di], bl
        asm     and     es:[di+C80_BITPLANE_LINE_BYTE_COUNT], dl
        asm     or      es:[di+C80_BITPLANE_LINE_BYTE_COUNT], bl
        asm     and     es:[di-8000h], dl
        asm     or      es:[di-8000h], bh
        asm     and     es:[di-7FB0h], dl
        asm     or      es:[di-7FB0h], bh
#endif
        asm     mov     es, cs:V8384002_BitPlane2Offset
        asm     and     es:[di], dl
        asm     or      es:[di], al
        asm     and     es:[di+C80_BITPLANE_LINE_BYTE_COUNT], dl
#if EXETYPE == C20_NEC8
        asm     and     al, bl
#endif
        asm     or      es:[di+C80_BITPLANE_LINE_BYTE_COUNT], al
#if EXETYPE == C21_NEC16
        asm     mov     es, cs:V8384003_
        asm     and     es:[di], dl
        asm     or      es:[di], ah
        asm     and     es:[di+C80_BITPLANE_LINE_BYTE_COUNT], dl
        asm     or      es:[di+C80_BITPLANE_LINE_BYTE_COUNT], ah
#endif
        asm     pop     bp
        asm     retn
        loc_11849:
        asm     asm_loc_11849:
        asm     push    bp
        asm     shr     bp, 1
        asm     shr     bp, 1
        asm     shr     bp, 1
        asm     inc     bp
        loc_11851:
        asm     mov     es, bp
        asm     mov     bp, [si]
        asm     rol     bp, 1
        asm     rol     bp, 1
        asm     rol     bp, 1
        asm     rol     bp, 1
        asm     and     bp, 0FFh
        asm     add     bp, bp
        asm     mov     ax, V8382000_+bp
        asm     mov     bx, V8382000_+bp+1024
        asm     mov     bp, [si+1]
        asm     rol     bp, 1
        asm     rol     bp, 1
        asm     rol     bp, 1
        asm     rol     bp, 1
        asm     and     bp, 0FFh
        asm     add     bp, bp
        asm     or      ax, V8382000_+bp+512
        asm     or      bx, V8382000_+bp+1536
        asm     mov     bp, [si+2]
        asm     rol     bp, 1
        asm     rol     bp, 1
        asm     rol     bp, 1
        asm     rol     bp, 1
        asm     and     bp, 0FFh
        asm     add     bp, bp
        asm     mov     cx, V8382000_+bp
        asm     mov     dx, V8382000_+bp+1024
        asm     mov     bp, [si+3]
        asm     rol     bp, 1
        asm     rol     bp, 1
        asm     rol     bp, 1
        asm     rol     bp, 1
        asm     and     bp, 0FFh
        asm     add     bp, bp
        asm     or      cx, V8382000_+bp+512
        asm     or      dx, V8382000_+bp+1536
        asm     xchg    ah, cl
        asm     xchg    bh, dl
        asm     mov     bp, es
        asm     dec     bp
        asm     jz      loc_118F9
        asm     mov     es, cs:V8384001_BitPlane0Offset
#if EXETYPE == C20_NEC8
        asm     mov     es:[di], dx
        asm     and     dx, bx
        asm     mov     es:[di+C80_BITPLANE_LINE_BYTE_COUNT], dx
        asm     mov     es:[di-8000h], cx
        asm     and     cx, bx
        asm     mov     es:[di-7FB0h], cx
#endif
#if EXETYPE == C21_NEC16
        asm     mov     es:[di], bx
        asm     mov     es:[di+C80_BITPLANE_LINE_BYTE_COUNT], bx
        asm     mov     es:[di-8000h], dx
        asm     mov     es:[di-7FB0h], dx
        asm     mov     es, cs:V8384003_
        asm     mov     es:[di], cx
        asm     mov     es:[di+C80_BITPLANE_LINE_BYTE_COUNT], cx
#endif
        asm     mov     es, cs:V8384002_BitPlane2Offset
#if EXETYPE == C20_NEC8
        asm     mov     es:[di], ax
        asm     and     ax, bx
        asm     mov     es:[di+C80_BITPLANE_LINE_BYTE_COUNT], ax
        asm     add     di, 2
#endif
#if EXETYPE == C21_NEC16
        asm     stosw
        asm     mov     es:[di+4Eh], ax
#endif
        asm     add     si, 4
        asm     jmp     loc_11851
        loc_118F9:
        asm     pop     bp
        asm     and     bp, 7
        asm     jnz     loc_11902
        asm     jmp     loc_11A56
        loc_11902:
        asm     push    cx
        asm     push    bx
        asm     mov     cx, bp
        asm     shl     cl, 1
        asm     mov     bx, 0FFFFh
        asm     shr     bx, cl
        asm     not     bx
        asm     xchg    bh, bl
        asm     mov     bp, bx
        asm     pop     bx
        asm     pop     cx
        asm     and     ax, bp
        asm     and     bx, bp
        asm     and     cx, bp
        asm     and     dx, bp
        asm     not     bp
        asm     mov     es, cs:V8384001_BitPlane0Offset
        asm     and     es:[di], bp
#if EXETYPE == C20_NEC8
        asm     or      es:[di], dx
        asm     and     es:[di+C80_BITPLANE_LINE_BYTE_COUNT], bp
        asm     and     dx, bx
        asm     or      es:[di+C80_BITPLANE_LINE_BYTE_COUNT], dx
        asm     and     es:[di-8000h], bp
        asm     or      es:[di-8000h], cx
        asm     and     es:[di-7FB0h], bp
        asm     and     cx, bx
        asm     or      es:[di-7FB0h], cx
#endif
#if EXETYPE == C21_NEC16
        asm     or      es:[di], bx
        asm     and     es:[di+C80_BITPLANE_LINE_BYTE_COUNT], bp
        asm     or      es:[di+C80_BITPLANE_LINE_BYTE_COUNT], bx
        asm     and     es:[di-8000h], bp
        asm     or      es:[di-8000h], dx
        asm     and     es:[di-7FB0h], bp
        asm     or      es:[di-7FB0h], dx
#endif
        asm     mov     es, cs:V8384002_BitPlane2Offset
        asm     and     es:[di], bp
        asm     or      es:[di], ax
        asm     and     es:[di+C80_BITPLANE_LINE_BYTE_COUNT], bp
#if EXETYPE == C20_NEC8
        asm     and     ax, bx
#endif
        asm     or      es:[di+C80_BITPLANE_LINE_BYTE_COUNT], ax
#if EXETYPE == C21_NEC16
        asm     mov     es, cs:V8384003_
        asm     and     es:[di], bp
        asm     or      es:[di], cx
        asm     and     es:[di+C80_BITPLANE_LINE_BYTE_COUNT], bp
        asm     or      es:[di+C80_BITPLANE_LINE_BYTE_COUNT], cx
#endif
        asm     jmp     loc_11A56
        loc_1196F:
        asm     asm_loc_1196F:
#ifdef MEDIA472_P20JB_P31J
        asm     cmp     bp, 2
        asm     jg      loc_11983
        asm     mov     dl, 3Ch
        asm     cmp     bp, 1
        asm     jg      loc_1197D
        asm     mov     dl, 30h
        loc_1197D:
        asm     call    F8388_
        asm     jmp     loc_11A56
        loc_11983:
#endif
        asm     mov     dl, 3Fh
        asm     dec     si
        asm     call    F8388_
        asm     add     si, 2
        asm     inc     di
        asm     sub     bp, 3
#ifdef MEDIA472_P20JB_P31J
        asm     jz      loc_119C6
#endif
        asm     jmp     loc_11849
        loc_11995:
        asm     asm_loc_11995:
#ifdef MEDIA472_P20JB_P31J
        asm     cmp     bp, 1
        asm     jg      loc_119A2
        asm     mov     dl, 0Ch
        asm     call    F8388_
        asm     jmp     loc_11A56
        loc_119A2:
#endif
        asm     mov     dl, 0Fh
        asm     dec     si
        asm     call    F8388_
        asm     add     si, 2
        asm     inc     di
        asm     sub     bp, 2
#ifdef MEDIA472_P20JB_P31J
        asm     jz      loc_119C6
#endif
        asm     jmp     loc_11849
        loc_119B4:
        asm     asm_loc_119B4:
        asm     mov     dl, 3
        asm     sub     si, 2
        asm     call    F8388_
        asm     add     si, 2
        asm     inc     di
        asm     dec     bp
#ifdef MEDIA472_P20JB_P31J
        asm     jz      loc_119C6
#endif
        asm     jmp     loc_11849
#ifdef MEDIA472_P20JB_P31J
        loc_119C6:
        asm     jmp     loc_11A56
#endif
        asm     F8388_:
        asm     push    bp
        asm     mov     bp, [si]
        asm     rol     bp, 1
        asm     rol     bp, 1
        asm     rol     bp, 1
        asm     rol     bp, 1
        asm     and     bp, 0FFh
        asm     add     bp, bp
        asm     mov     ax, V8382000_+bp
        asm     mov     bx, V8382000_+bp+1024
        asm     mov     bp, [si+1]
        asm     rol     bp, 1
        asm     rol     bp, 1
        asm     rol     bp, 1
        asm     rol     bp, 1
        asm     and     bp, 0FFh
        asm     add     bp, bp
        asm     or      ax, V8382000_+bp+512
        asm     or      bx, V8382000_+bp+1536
        asm     mov     dh, dl
        asm     and     ax, dx
        asm     and     bx, dx
        asm     not     dl
        asm     mov     es, cs:V8384001_BitPlane0Offset
        asm     and     es:[di], dl
#if EXETYPE == C20_NEC8
        asm     or      es:[di], bh
        asm     and     es:[di+C80_BITPLANE_LINE_BYTE_COUNT], dl
        asm     and     bh, bl
        asm     or      es:[di+C80_BITPLANE_LINE_BYTE_COUNT], bh
        asm     and     es:[di-8000h], dl
        asm     or      es:[di-8000h], ah
        asm     and     es:[di-7FB0h], dl
        asm     and     ah, bl
        asm     or      es:[di-7FB0h], ah
#endif
#if EXETYPE == C21_NEC16
        asm     or      es:[di], bl
        asm     and     es:[di+C80_BITPLANE_LINE_BYTE_COUNT], dl
        asm     or      es:[di+C80_BITPLANE_LINE_BYTE_COUNT], bl
        asm     and     es:[di-8000h], dl
        asm     or      es:[di-8000h], bh
        asm     and     es:[di-7FB0h], dl
        asm     or      es:[di-7FB0h], bh
#endif
        asm     mov     es, cs:V8384002_BitPlane2Offset
        asm     and     es:[di], dl
        asm     or      es:[di], al
        asm     and     es:[di+C80_BITPLANE_LINE_BYTE_COUNT], dl
#if EXETYPE == C20_NEC8
        asm     and     al, bl
#endif
        asm     or      es:[di+C80_BITPLANE_LINE_BYTE_COUNT], al
#if EXETYPE == C21_NEC16
        asm     mov     es, cs:V8384003_
        asm     and     es:[di], dl
        asm     or      es:[di], ah
        asm     and     es:[di+C80_BITPLANE_LINE_BYTE_COUNT], dl
        asm     or      es:[di+C80_BITPLANE_LINE_BYTE_COUNT], ah
#endif
        asm     pop     bp
        asm     retn
        loc_11A56:
        asm     pop     bp
        asm     pop     ds
#endif
#if (EXETYPE == C23_EGA)
        asm     cld
        asm     push    ds
        asm     mov     bx, P2495_i_DestinationPixelIndex
        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, P2496_i_PixelCount
        asm     mov     dx, P2494_i_SourcePixelIndex
        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
        loc_10554:
        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     inc     dx
        asm     pop     ax
        asm     popf
        asm     jnb     loc_1056E
        asm     jmp     loc_10601
        loc_1056E:
        asm     test    al, 80h
        asm     jnz     loc_10599
        loc_10572:
        asm     mov     bl, [si]
        asm     inc     si
        asm     out     dx, al         /* EGA port: graphics controller data register */
        asm     mov     ah, bl
        asm     shr     ah, 1
        asm     shr     ah, 1
        asm     shr     ah, 1
        asm     shr     ah, 1
        asm     and     es:[di], ah
        asm     dec     cx
        asm     jz      loc_105FE
        asm     ror     al, 1
        asm     jnb     loc_1058D
        asm     jmp     loc_1062F
        loc_1058D:
        asm     out     dx, al         /* EGA port: graphics controller data register */
        asm     and     es:[di], bl
        asm     dec     cx
        asm     jz      loc_105FE
        asm     ror     al, 1
        asm     jnb     loc_10572
        loc_10598:
        asm     inc     di
        loc_10599:
        asm     test    cx, 0FFF8h
        asm     jz      loc_105DA
        asm     push    cx
        asm     shr     cx, 1
        asm     shr     cx, 1
        asm     shr     cx, 1
        loc_105A6:
        asm     push    cx
        loc_105A7:
        asm     mov     bx, [si]
        asm     add     si, 2
        asm     mov     cx, bx
        asm     shr     cx, 1
        asm     shr     cx, 1
        asm     shr     cx, 1
        asm     shr     cx, 1
        asm     out     dx, al         /* EGA port: graphics controller data register */
        asm     and     es:[di], cl
        asm     ror     al, 1
        asm     out     dx, al         /* EGA port: graphics controller data register */
        asm     and     es:[di], bl
        asm     ror     al, 1
        asm     out     dx, al         /* EGA port: graphics controller data register */
        asm     and     es:[di], ch
        asm     ror     al, 1
        asm     out     dx, al         /* EGA port: graphics controller data register */
        asm     and     es:[di], bh
        asm     ror     al, 1
        asm     jnb     loc_105A7
        asm     pop     cx
        asm     inc     di
        asm     loop    loc_105A6
        asm     pop     cx
        asm     and     cx, 7
        asm     jz      loc_105FE
        loc_105DA:
        asm     mov     bl, [si]
        asm     inc     si
        asm     out     dx, al         /* EGA port: graphics controller data register */
        asm     mov     ah, bl
        asm     shr     ah, 1
        asm     shr     ah, 1
        asm     shr     ah, 1
        asm     shr     ah, 1
        asm     and     es:[di], ah
        asm     ror     al, 1
        asm     adc     di, 0
        asm     dec     cx
        asm     jz      loc_105FE
        asm     out     dx, al         /* EGA port: graphics controller data register */
        asm     and     es:[di], bl
        asm     ror     al, 1
        asm     adc     di, 0
        asm     loop    loc_105DA
        loc_105FE:
        asm     jmp     loc_10685
        loc_10601:
        asm     mov     bl, [si]
        asm     inc     si
        asm     test    al, 80h
        asm     jnz     loc_10630
        loc_10608:
        asm     out     dx, al         /* EGA port: graphics controller data register */
        asm     and     es:[di], bl
        asm     mov     bl, [si]
        asm     inc     si
        asm     dec     cx
        asm     jz      loc_105FE
        asm     ror     al, 1
        asm     jnb     loc_1061A
        asm     dec     si
        asm     jmp     loc_10598
        loc_1061A:
        asm     out     dx, al         /* EGA port: graphics controller data register */
        asm     mov     ah, bl
        asm     shr     ah, 1
        asm     shr     ah, 1
        asm     shr     ah, 1
        asm     shr     ah, 1
        asm     and     es:[di], ah
        asm     dec     cx
        asm     jz      loc_10685
        asm     ror     al, 1
        asm     jnb     loc_10608
        loc_1062F:
        asm     inc     di
        loc_10630:
        asm     test    cx, 0FFF8h
        asm     jz      loc_10661
        asm     push    cx
        asm     shr     cx, 1
        asm     shr     cx, 1
        asm     shr     cx, 1
        loc_1063D:
        asm     out     dx, al         /* EGA port: graphics controller data register */
        asm     and     es:[di], bl
        asm     mov     bl, [si]
        asm     inc     si
        asm     ror     al, 1
        asm     out     dx, al         /* EGA port: graphics controller data register */
        asm     mov     ah, bl
        asm     shr     ah, 1
        asm     shr     ah, 1
        asm     shr     ah, 1
        asm     shr     ah, 1
        asm     and     es:[di], ah
        asm     ror     al, 1
        asm     jnb     loc_1063D
        asm     inc     di
        asm     loop    loc_1063D
        asm     pop     cx
        asm     and     cx, 7
        asm     jz      loc_10685
        loc_10661:
        asm     out     dx, al         /* EGA port: graphics controller data register */
        asm     and     es:[di], bl
        asm     mov     bl, [si]
        asm     inc     si
        asm     ror     al, 1
        asm     adc     di, 0
        asm     dec     cx
        asm     jz      loc_10685
        asm     out     dx, al         /* EGA port: graphics controller data register */
        asm     mov     ah, bl
        asm     shr     ah, 1
        asm     shr     ah, 1
        asm     shr     ah, 1
        asm     shr     ah, 1
        asm     and     es:[di], ah
        asm     ror     al, 1
        asm     adc     di, 0
        asm     loop    loc_10661
        loc_10685:
        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) || (EXETYPE == C03_GAME) || (EXETYPE == C06_CEDT) || (EXETYPE == C11_SELECTOR) || (EXETYPE == C05_ANIM))
        asm     push    ds
        asm     cld
#if (EXETYPE == C24_TANDY)
        asm     les     di, G8134_pc_VideoMemory
#endif
#if ((EXETYPE == C03_GAME) || (EXETYPE == C06_CEDT) || (EXETYPE == C11_SELECTOR))
        asm     les     di, G2160_puc_Bitmap_Destination
#endif
#if ((EXETYPE == C24_TANDY) || (EXETYPE == C03_GAME) || (EXETYPE == C06_CEDT) || (EXETYPE == C11_SELECTOR))
        asm     lds     si, G2159_puc_Bitmap_Source
#endif
#if (EXETYPE == C05_ANIM)
        asm     les     di, G8210_puc_Bitmap
        asm     lds     si, G8206_
#endif
        asm     mov     cx, P2496_i_PixelCount
        asm     mov     ax, P2494_i_SourcePixelIndex
        asm     shr     ax, 1
        asm     jb      loc_210F6
        asm     add     si, ax
        asm     mov     ax, P2495_i_DestinationPixelIndex
        asm     shr     ax, 1
        asm     jnb     loc_210C2
        asm     jmp     loc_21152
        loc_210C2:
        asm     add     di, ax
        loc_210C4:
        asm     shr     cx, 1
        asm     pushf
        asm     shr     cx, 1
        asm     jnb     loc_210CC
        asm     movsb
        loc_210CC:
        asm     cmp     cx, 0
        asm     jz      loc_210D7
        loc_210D1:
        asm     rep movsw
        asm     or      cx, cx
        asm     jnz     loc_210D1
        loc_210D7:
        asm     popf
        asm     jnb     loc_210E4
        asm     lodsb
        asm     mov     ah, es:[di]
        asm     and     ax, 0FF0h
        asm     or      al, ah
        asm     stosb
        loc_210E4:
        asm     jmp     loc_211A0
        loc_210E7:
        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_210C4
        loc_210F6:
        asm     add     si, ax
        asm     mov     ax, P2495_i_DestinationPixelIndex
        asm     shr     ax, 1
        asm     jb      loc_210E7
        asm     add     di, ax
        asm     lodsb
        asm     mov     bh, al
        asm     shr     cx, 1
        asm     pushf
        asm     jz      loc_2113C
        asm     shr     cx, 1
        asm     jnb     loc_2111F
        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_2111F:
        asm     jz      loc_2113C
        asm     and     bh, 0Fh
        loc_21124:
        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_21124
        loc_2113C:
        asm     popf
        asm     jnb     loc_2114F
        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_2114F:
        asm     jmp     loc_211A0
        loc_21152:
        asm     add     di, ax
        asm     mov     bh, es:[di]
        asm     inc     cx
        asm     shr     cx, 1
        asm     pushf
        asm     jz      loc_21195
        asm     shr     cx, 1
        asm     jnb     loc_21178
        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_21178:
        asm     jz      loc_21195
        asm     and     bh, 0F0h
        loc_2117D:
        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_2117D
        loc_21195:
        asm     popf
        asm     jnb     loc_211A0
        asm     mov     al, es:[di]
        asm     and     al, 0Fh
        asm     or      al, bh
        asm     stosb
        loc_211A0:
        asm     pop     ds
#endif
#if (EXETYPE == C25_VGA)
        asm     cld
        asm     push    ds
        asm     mov     di, P2495_i_DestinationPixelIndex
        asm     mov     ax, 0A000h
        asm     mov     es, ax
        asm     mov     dh, G8177_c_ViewportColorIndexOffset
        asm     mov     dl, dh
        asm     mov     cx, P2496_i_PixelCount
        asm     lds     si, G2159_puc_Bitmap_Source
        asm     mov     ax, P2494_i_SourcePixelIndex
        asm     shr     ax, 1
        asm     pushf
        asm     add     si, ax
        asm     popf
        asm     jnb     loc_10554
        asm     lodsb
        asm     and     al, 0Fh
        asm     or      al, dl
        asm     stosb
        asm     dec     cx
        asm     jz      loc_105A1
        loc_10554:
        asm     shr     cx, 1
        asm     jz      loc_10593
        asm     pushf
        asm     shr     cx, 1
        asm     jz      loc_1057F
        asm     pushf
        asm     push    bp
        asm     mov     bp, 0F0Fh
        loc_10562:
        asm     lodsw
        asm     mov     bx, ax
        asm     shr     ax, 1
        asm     shr     ax, 1
        asm     shr     ax, 1
        asm     shr     ax, 1
        asm     xchg    bl, ah
        asm     and     ax, bp
        asm     and     bx, bp
        asm     or      ax, dx
        asm     or      bx, dx
        asm     stosw
        asm     mov     ax, bx
        asm     stosw
        asm     loop    loc_10562
        asm     pop     bp
        asm     popf
        loc_1057F:
        asm     jnb     loc_10592
        asm     lodsb
        asm     mov     ah, al
        asm     shr     al, 1
        asm     shr     al, 1
        asm     shr     al, 1
        asm     shr     al, 1
        asm     and     ax, 0F0Fh
        asm     or      ax, dx
        asm     stosw
        loc_10592:
        asm     popf
        loc_10593:
        asm     jnb     loc_105A1
        asm     lodsb
        asm     shr     al, 1
        asm     shr     al, 1
        asm     shr     al, 1
        asm     shr     al, 1
        asm     or      al, dl
        asm     stosb
        loc_105A1:
        asm     pop     ds
        asm     jmp     $+2
#endif
}
#endif
