Annotation of ntddk/src/video/displays/vga/i386/strblt.asm, revision 1.1.1.1

1.1       root        1: ;---------------------------Module-Header------------------------------;
                      2: ; Module Name: strblt.asm
                      3: ;
                      4: ; Output a string of glyphs onto VGA screen
                      5: ;
                      6: ; Created: Fri 19-Jul-1991 13:06:49
                      7: ; Author: Viroon Touranachun [viroont]
                      8: ;
                      9: ; Copyright (c) 1991 Microsoft Corporation
                     10: ;-----------------------------------------------------------------------;
                     11:         page    ,132
                     12:         title   String Display
                     13: 
                     14:         .386
                     15: 
                     16: ifndef  DOS_PLATFORM
                     17:         .model  small,c
                     18: else
                     19: ifdef   STD_CALL
                     20:         .model  small,c
                     21: else
                     22:         .model  small,pascal
                     23: endif;  STD_CALL
                     24: endif;  DOS_PLATFORM
                     25: 
                     26:         assume cs:FLAT,ds:FLAT,es:FLAT,ss:FLAT
                     27:         assume fs:nothing,gs:nothing
                     28: 
                     29:         .xlist
                     30:         include stdcall.inc             ;calling convention cmacros
                     31:         include i386\egavga.inc
                     32:         include i386\strucs.inc
                     33:         .list
                     34: 
                     35:         include i386\strblt.inc
                     36: 
                     37: ; characteristic flags for glyphs and strings
                     38: 
                     39: VSB_MIX_STRING      equ     00000001h       ; the glyph is mixed
                     40: VSB_OPAQUE_BKGND    equ     00000002h       ; the glyph bakground is opaque
                     41: VSB_LMB_ZERO        equ     00000004h       ; the left-most bit in left mask is zero
                     42: VSB_SAVE_BITS       equ     00000008h       ; save the glyph bits in buffer
                     43: VSB_FIRST_GLYPH     equ     00000010h       ; the first glyph
                     44: 
                     45:         .code
                     46: 
                     47:         EXTRNP      vGlyphBlt,32
                     48: 
                     49: ;---------------------------Public-Routine------------------------------;
                     50: ; vStringBlt
                     51: ;
                     52: ;   Draw an entire string to the VGA screen
                     53: ;
                     54: ; History:
                     55: ;   Mon 08-Jul-1991 15:13:54 -by- Viroon Touranachun [viroont]
                     56: ;   Created.
                     57: ;-----------------------------------------------------------------------;
                     58: 
                     59: ProcName    xxxvStringBlt,vStringBlt,32
                     60: 
                     61:         ALIGN 4
                     62: xxxvStringBlt   proc uses    esi edi ebx,   \
                     63:         pdsurf: ptr DEVSURF,            \
                     64:         prcl:   ptr RECTL,              \
                     65:         cStr:   DWORD,                  \
                     66:         pgp:    ptr GLYPHPOS,           \
                     67:         iForeClr: dword,                \
                     68:         iBackClr: dword,                \
                     69:         ulMode:   dword,                \
                     70:         flOption: dword
                     71: 
                     72:         local   pjScreen    :ptr        ; screen pointer
                     73:         local   pjGlyph     :ptr        ; pointer to glyph bits
                     74:         local   pjImage     :ptr        ; pointer to image buffer
                     75:         local   flAccel     :dword      ; accelarator flags
                     76:         local   pfnFirstByte:dword      ; pointer to the first glyph byte function
                     77:         local   pfnLastGlyph:dword      ; pointer to the last glyph byte function
                     78:         local   pfnMidGlyph :dword      ; pointer to the middle glyph byte entry
                     79:         local   cGlyph      :dword      ; # of glyphs invloved
                     80:         local   pjFirstGlyph:dword      ; ptr to the first glyph
                     81:         local   cScan       :dword      ; visible glyph height
                     82:         local   cScanBlock  :dword      ; visible glyph scan block
                     83:         local   cLeadScan   :dword      ; visible glyph leading scan
                     84:         local   cOffsetScan :dword      ; offset to the 1st scan
                     85:         local   cBufferOffset:dword     ; offset into buffer for leading scans
                     86:         local   xStartCell  :dword      ; start of the current glyph cell
                     87:         local   xNextCell   :dword      ; start of the next glyph cell
                     88:         local   cjBytes     :dword      ; glyph scan size in bytes
                     89:         local   cScanCount  :dword      ; temporary scan count
                     90:         local   cScreenInc  :dword      ; temporary screen increment
                     91:         local   cInnerBytes :dword      ; glyph's middle full byte count
                     92:         local   cFixGlyphWidth:dword    ; glyph's middle fixed byte count
                     93:         local   cFixScanOffset:dword    ; byte offset into the 1st visible scan
                     94:         local   ulNextScan  :dword      ; distance from start of one dest scan
                     95:                                         ; to start of next
                     96:         local   fjLastMask  :byte       ; glyph's last byte screen mask
                     97:         local   cfLastBits  :byte       ; glyph's last byte screen mask bitcount
                     98:         local   fjOBOSMask  :byte       ; accumulated screen byte mask
                     99:         local   bAlign      :byte       ; dword aligned
                    100: ; BUGBUG this should should come from the work buffer pointed to by the DSURF,
                    101: ; or, if it's on the stack, should be allocated to the minimum needed size
                    102:         local   abStrImage[CY_SCREEN_MAX]:byte
                    103: 
                    104: 
                    105: ;----------------------------------------------------------------------------
                    106: ; Initialize stuff
                    107: ;----------------------------------------------------------------------------
                    108: 
                    109:         cld
                    110: 
                    111: ; Calculate the screen location
                    112: 
                    113: 
                    114:         mov     edi,pdsurf
                    115:         mov     esi,prcl
                    116:         mov     eax,[esi].yTop
                    117:         mov     ecx,[edi].dsurf_lNextScan
                    118:         mov     ulNextScan,ecx
                    119:         mul     ecx                     ; EAX = byte offset to scan
                    120: 
                    121: ; Initialize some parameters to zero (EDX = 0 from multiplication above)
                    122: 
                    123:         mov     xStartCell,edx          ; byte offset into 1st glyph
                    124:         mov     cOffsetScan,edx         ; offset to the 1st glyph scan
                    125:         mov     cInnerBytes,edx         ; assume no middle byte
                    126:         mov     fjLastMask,dl           ; assume no last byte
                    127:         mov     fjOBOSMask,dl           ; Init mask = DL = 0
                    128:         lea     ecx,abStrImage
                    129:         mov     pjImage,ecx
                    130: 
                    131: ; Calculate pointer to the 1st screen byte to blt
                    132: 
                    133:         mov     ecx,[esi].xLeft
                    134:         shr     ecx,3
                    135:         add     eax,ecx
                    136:         add     eax,[edi].dsurf_pvBitmapStart
                    137:         mov     pjScreen,eax            ; Base address of blit
                    138: 
                    139: ;----------------------------------------------------------------------------
                    140: ; Get the glyph information
                    141: ; Look for the 1st glyph and count the number of glyphs displayed
                    142: ;----------------------------------------------------------------------------
                    143: 
                    144: sblt_glyph_search:
                    145:         mov     edi,pgp                 ; the first glyph to display
                    146:         mov     edx,cStr                ; # of glyphs in string
                    147: 
                    148:         .errnz  VGB_HORIZ_CLIPPED_GLYPH-1 ; flag must match those in flClipRect
                    149: 
                    150:         test    byte ptr flOption,VGB_HORIZ_CLIPPED_GLYPH
                    151:         jz      short sblt_found_both   ; if non-clipped, display entire string
                    152: 
                    153: sblt_glyph_search_last:
                    154:         mov     ecx,edx                 ; # of glyphs in string
                    155:         dec     edx                     ; index to the last glyph in string
                    156:         imul    edx,size GLYPHPOS
                    157:         add     edi,edx                 ; EDI => last glyph in the string
                    158:         mov     eax,[esi].xRight
                    159: 
                    160:         ALIGN 4
                    161: sblt_glyph_search_last_loop:
                    162:         mov     ebx,[edi].gp_pgdf
                    163:         mov     ebx,[ebx].gdf_pgb       ; ptr to glyph bits
                    164:         mov     ebx,[ebx].gb_x          ; glyph cell offset
                    165:         add     ebx,[edi].gp_x          ; actual glyph position
                    166:         cmp     ebx,eax
                    167:         jl      short sblt_glyph_search_1st ; we found the last glyph
                    168:         sub     edi,size GLYPHPOS       ; back one glyph
                    169:         loop    sblt_glyph_search_last_loop
                    170:         jmp     sblt_exit               ; nothing to show
                    171: 
                    172:         ALIGN 4
                    173: sblt_glyph_search_1st:
                    174:         mov     edx,ecx                 ; mark the last visible glyph
                    175:         mov     eax,[esi].xLeft
                    176:         jmp     short @F                ; we have not advance to next glyph
                    177: 
                    178:         ALIGN 4
                    179: sblt_glyph_search_1st_loop:
                    180:         mov     ebx,[edi].gp_pgdf
                    181:         mov     ebx,[ebx].gdf_pgb       ; ptr to glyph bits
                    182:         mov     ebx,[ebx].gb_x          ; glyph cell offset
                    183:         add     ebx,[edi].gp_x          ; actual glyph position
                    184: @@:
                    185:         cmp     ebx,eax
                    186:         jle     short sblt_count_glyph  ; we found the first glyph
                    187:         sub     edi,size GLYPHPOS       ; back one glyph
                    188:         loop    sblt_glyph_search_1st_loop
                    189:         jmp     sblt_exit               ; something wrong! bail out!
                    190: 
                    191:         ALIGN 4
                    192: sblt_count_glyph:
                    193:         dec     ecx                     ; also include the current glyph
                    194:         sub     edx,ecx                 ; glyph count = last - first
                    195: 
                    196: sblt_found_both:
                    197:         mov     pjFirstGlyph,edi        ; pointer to the first glyph
                    198:         mov     cGlyph,edx              ; # of glyphs to display
                    199: 
                    200: ;----------------------------------------------------------------------------
                    201: ; Calculate number of scans to bltting cell
                    202: ;----------------------------------------------------------------------------
                    203: 
                    204: sblt_calc_glyph_height:
                    205:         mov     eax,[esi].yBottom       ; bottom of display rectangle
                    206:         mov     ecx,[esi].yTop          ; top of display rectangle
                    207:         sub     eax,ecx                 ; Number of scans = bottom - top
                    208:         mov     cScan,eax
                    209: 
                    210:         .errnz  VGB_VERT_CLIPPED_GLYPH-2 ; flags must match those in flClipRect
                    211: 
                    212:         test    byte ptr flOption,VGB_VERT_CLIPPED_GLYPH ; if non-clipped,
                    213:         jz      short @F                ; we display from the first glyph scan
                    214:         mov     ebx,[edi].gp_pgdf
                    215:         mov     ebx,[ebx].gdf_pgb       ; ptr to glyph bits
                    216:         mov     ebx,[ebx].gb_y          ; glyph cell offset
                    217:         add     ebx,[edi].gp_y          ; actual glyph position
                    218:         sub     ecx,ebx                 ; Vertical offset into glyph
                    219:         mov     cOffsetScan,ecx         ; offset to the 1st glyph scan
                    220: @@:
                    221:         mov     ecx,eax                 ; EAX = # of scans
                    222:         add     ecx,7
                    223:         shr     ecx,3                   ; we will transfer 8 scans at a time
                    224:          and     eax,07h                 ; so we may have these leading scans
                    225:         mov     cLeadScan,eax
                    226:         mov     cScanBlock,ecx
                    227: 
                    228:         xor     ebx,ebx                 ; because of leading scans, we
                    229:         mov     bl,offset FLAT:xgi_buffer_offset[eax]
                    230:         mov     cBufferOffset,ebx       ; cache the byte offset to image buffer
                    231: 
                    232: ;----------------------------------------------------------------------------
                    233: ; Setup accelerator flags
                    234: ;----------------------------------------------------------------------------
                    235: 
                    236: sblt_accel_flag:
                    237:         .errnz  VGB_MIX_STRING
                    238:         .errnz  VGB_OPAQUE_STRING-1
                    239:         .errnz  VGB_OPAQUE_BKGRND and 0FFFFFF00h
                    240:         .errnz  VSB_OPAQUE_BKGND-2
                    241:         .errnz  VSB_MIX_STRING-1
                    242: 
                    243:         xor     eax,eax                 ; no need for this 'cause EAX and 07 above
                    244:         mov     ebx,flOption            ; get the option flag
                    245:         test    bl,VGB_OPAQUE_BKGRND    ; get OPAQUE_BKGND flag
                    246:         setnz   al                      ; AL = EAX = 1 if opaque background
                    247:         shr     ulMode,1                ; get VGB_OPAQUE_STRING flag
                    248:         cmc                             ; convert to VSB_MIX_STRING flag
                    249:         adc     eax,eax                 ; combine two flags in EAX
                    250:         or      al,VSB_FIRST_GLYPH      ; indicate the first glyph
                    251:         mov     flAccel,eax
                    252: 
                    253: ; Since we always have opaque solid color background, if it is a mixed glyph
                    254: ; we can mix the foreground solid color now and treat it as an opaque glyph
                    255: 
                    256:         cmp     al,VSB_FIRST_GLYPH or VSB_OPAQUE_BKGND or VSB_MIX_STRING
                    257:         jne     short sblt_special_case
                    258:         mov     al,byte ptr iBackClr
                    259:         xor     byte ptr iForeClr,al    ; !! We only have XOR !!??
                    260:         and     byte ptr flAccel,not VSB_MIX_STRING
                    261: 
                    262: ;----------------------------------------------------------------------------
                    263: ; We can treat the following as special cases:
                    264: ;   1) Non-clipped String with exact-byte glyphs with phase aligned with screen
                    265: ;   1) Clipped String with exact-byte glyphs with phase aligned with screen
                    266: ;----------------------------------------------------------------------------
                    267: 
                    268: sblt_special_case:
                    269:         and     bl,VGB_BYTE_ALIGNED or VGB_MULTIPLE_BYTE or VGB_HORIZ_CLIPPED_GLYPH
                    270:         cmp     bl,VGB_BYTE_ALIGNED or VGB_MULTIPLE_BYTE
                    271:         jne     short @F
                    272:         push    offset FLAT:sblt_exit       ; we have a non-clipped string
                    273:         jmp     fixed_pitch_aligned_sblt    ; we handle entire string at once
                    274: 
                    275: @@:
                    276:         mov     pfnMidGlyph,offset FLAT:sblt_next_glyph_cell
                    277:         cmp     bl,VGB_BYTE_ALIGNED or VGB_MULTIPLE_BYTE or VGB_HORIZ_CLIPPED_GLYPH
                    278:         jne     short sblt_init_jmp_table
                    279:         mov     pfnMidGlyph,offset FLAT:sblt_middle_fpa_glyph
                    280: 
                    281: ;----------------------------------------------------------------------------
                    282: ; Not a special case. Initialize some function pointers
                    283: ;----------------------------------------------------------------------------
                    284: 
                    285: sblt_init_jmp_table:
                    286:         mov     pfnFirstByte,offset FLAT:xgi_1st_byte_1st_scrn
                    287:         mov     pfnLastGlyph,offset FLAT:xgi_last_byte_table
                    288:         dec     edx                     ; if only glyph, specially handle it
                    289:         jnz     short sblt_1st_glyph_cell
                    290: 
                    291: comment~
                    292: ;----------------------------------------------------------------------------
                    293: ; We should go right to vGlyphBlt() if there is only one glyph
                    294: ;----------------------------------------------------------------------------
                    295: 
                    296: sblt_call_vglyphblt:
                    297: 
                    298:         test    byte ptr flOption,VGB_OPAQUE_BKGRND
                    299:         jnz     short @F
                    300:         mov     ebx,[edi].gp_pgdf
                    301:         mov     ebx,[ebx].gdf_pgb       ; ptr to glyph bits
                    302:         mov     ebx,[ebx].gb_y          ; glyph cell offset
                    303:         add     [edi].gp_y,ebx          ; actual glyph position
                    304: 
                    305:         cCall   vGlyphBlt,<pdsurf,prcl,cStr,edi,iForeClr,iBackClr,ulMode,flOption>
                    306: 
                    307:         jmp     sblt_exit
                    308: comment~
                    309: 
                    310: @@:
                    311:         mov     pfnLastGlyph,offset FLAT:xgi_last_byte_last_glyph
                    312: 
                    313: ; This is bad! If we have only one glyph and it will fall within only one
                    314: ; screen byte, we will have to treat the visible byte as the last byte of the
                    315: ; last glyph.
                    316: 
                    317:         mov     eax,[esi].xLeft         ; left edge
                    318:         shr     eax,3                   ; the screen byte of the left edge
                    319:         mov     ecx,[esi].xRight        ; right edge
                    320:         shr     ecx,3                   ; the screen byte of the right edge
                    321:         cmp     eax,ecx                 ; equal if in the same byte
                    322:         jne     short sblt_1st_glyph_cell
                    323:         mov     pfnFirstByte,offset FLAT:xgi_last_byte_last_glyph
                    324:         and     byte ptr flAccel,not VSB_FIRST_GLYPH
                    325: 
                    326: ;----------------------------------------------------------------------------
                    327: ; Let's display glyphs one byte at a time.
                    328: ;----------------------------------------------------------------------------
                    329: 
                    330: ; Starting from the first glyph. Find the glyph dimension.
                    331: 
                    332:         ALIGN 4
                    333: sblt_1st_glyph_cell:
                    334:         mov     ecx,[esi].xLeft         ; certainly within 1st glyph
                    335:         mov     xNextCell,ecx           ; position of the first glyph cell
                    336: 
                    337:         test    byte ptr flOption,VGB_HORIZ_CLIPPED_GLYPH ; if non-clipped,
                    338:         jz      sblt_full_glyph_cell          ; it is a full glyph cell
                    339: 
                    340:         mov     ebx,[esi].xRight        ; assume we have only one glyph
                    341:         mov     esi,[edi].gp_pgdf
                    342:         mov     esi,[esi].gdf_pgb       ; ptr to glyph bits
                    343:         mov     eax,[edi].gp_x
                    344:         add     eax,[esi].gb_x          ; glyph cell offset
                    345:         or      edx,edx                 ; EDX = cGlyph-1 => 0 if one glyph
                    346:         jz      short @F                ; yes, we have the right edge
                    347:         mov     ebx,[esi].gb_cx         ; full glyph cell width
                    348:         add     ebx,eax
                    349:         mov     xNextCell,ebx           ; position of the next glyph
                    350: @@:
                    351:         sub     ebx,ecx                 ; EBX = RightEdge-LeftEdge = width in pels
                    352: 
                    353:         mov     edx,ecx                 ; ECX = string left edge
                    354:         sub     edx,eax                 ; EAX = 1st glyph left edge
                    355:         mov     eax,edx                 ; EDX = pel offset into 1st glyph
                    356:         shr     edx,3
                    357:         mov     xStartCell,edx          ; byte offset into 1st glyph
                    358: 
                    359:         and     al,7                    ; AL = bit offset within 1st glyph byte
                    360:         sub     al,8
                    361:         neg     al
                    362:         mov     dl,al                   ; DL = # of bits left in 1st glyph byte
                    363:         jmp     short sblt_left_mask
                    364: 
                    365: ;----------------------------------------------------------------------------
                    366: ; Update information for the last glyph
                    367: ;----------------------------------------------------------------------------
                    368: 
                    369:         ALIGN 4
                    370: sblt_last_glyph_cell:
                    371:         mov     ecx,xNextCell           ; start of the last glyph
                    372:         mov     edi,pjFirstGlyph
                    373:         add     edi,size GLYPHPOS       ; move to the next glyph
                    374:         mov     esi,[edi].gp_pgdf
                    375:         mov     esi,[esi].gdf_pgb       ; ptr to glyph bits
                    376: 
                    377: sblt_last_fpa_glyph_cell:
                    378:         mov     dl,8                    ; guarantee full byte from glyph
                    379:         mov     ebx,prcl                ; clipped rectangle
                    380:         mov     ebx,[ebx].xRight        ; right-trimmed glyph width
                    381:         sub     ebx,ecx
                    382:         mov     pfnFirstByte,offset FLAT:xgi_1st_byte_last_glyph
                    383:         mov     pfnLastGlyph,offset FLAT:xgi_last_byte_last_glyph
                    384:         jmp     short sblt_left_mask
                    385: 
                    386: ;----------------------------------------------------------------------------
                    387: ; Update information for the middle pfa glyphs
                    388: ;----------------------------------------------------------------------------
                    389: 
                    390:         ALIGN 4
                    391: sblt_middle_fpa_glyph:
                    392:         mov     edi,pjFirstGlyph
                    393:         add     edi,size GLYPHPOS       ; advance to the next glyph
                    394:         dec     cGlyph                  ; we will not do the last glyph
                    395:         push    cInnerBytes             ; save it because it may change
                    396:         call    fixed_pitch_aligned_sblt_inner
                    397:         pop     cInnerBytes             ; restore it
                    398:         inc     cGlyph                  ; cGlyph = 1 for the last glyph
                    399:         add     edi,size GLYPHPOS       ; move to the next glyph
                    400:         mov     esi,[edi].gp_pgdf
                    401:         mov     esi,[esi].gdf_pgb       ; ptr to glyph bits
                    402:         mov     ecx,[edi].gp_x
                    403:         add     ecx,[esi].gb_x          ; start of the last glyph
                    404:         jmp     short sblt_last_fpa_glyph_cell
                    405: 
                    406: ;----------------------------------------------------------------------------
                    407: ; Update information for the next glyph
                    408: ;----------------------------------------------------------------------------
                    409: 
                    410:         ALIGN 4
                    411: sblt_next_glyph_cell:
                    412:         mov     ecx,xNextCell           ; position of the next glyph cell
                    413:         mov     edi,pjFirstGlyph
                    414:         add     edi,size GLYPHPOS       ; advance to the next glyph
                    415:         mov     pjFirstGlyph,edi
                    416: 
                    417: sblt_full_glyph_cell:
                    418:         mov     esi,[edi].gp_pgdf
                    419:         mov     esi,[esi].gdf_pgb       ; ptr to glyph bits
                    420:         mov     dl,8                    ; guarantee full byte from glyph
                    421: 
                    422: ; For full glyph, we will always start from the left edge.
                    423: 
                    424:         mov     ebx,[esi].gb_cx         ; full glyph cell width
                    425:         add     xNextCell,ebx           ; advance to the following glyph cell
                    426: 
                    427: ;----------------------------------------------------------------------------
                    428: ; Calculate screen bit masks
                    429: ;----------------------------------------------------------------------------
                    430: 
                    431: ; Calculate the screen left edge mask
                    432: 
                    433:         ALIGN 4
                    434: sblt_left_mask:
                    435:         and     ecx,7                   ; CH = 0, CL = bits offset into 1st byte
                    436:         setnz   al                      ; AL = 1 if left most bit is zero
                    437:         neg     al                      ; AL = FF if left most bit is zero
                    438:         and     eax,VSB_LMB_ZERO        ; AL = VSB_LMB_ZERO if left most bit is zero
                    439:         or      byte ptr flAccel,al
                    440: 
                    441:         .errnz  VSB_LMB_ZERO and 0FFFFFF00h
                    442: 
                    443:         mov     al,8
                    444:         sub     al,cl                   ; AL = bits in mask
                    445: 
                    446:         dec     ch                      ; CH = FF
                    447:         shr     ch,cl                   ; CH = left mask
                    448: 
                    449: 
                    450: ; Assume cell is at least one byte wide
                    451: 
                    452:         sub     ebx,eax                 ; EBX = glyph width, EAX = bits in left mask
                    453:         jg      short sblt_inner_count  ; But is it true?
                    454:         je      short sblt_left_bitcount; we know there is only one byte
                    455: 
                    456: ; It is less than one byte wide, calculate the right edge mask
                    457: 
                    458: sblt_one_byte_mask:
                    459:         mov     cl,bl
                    460:         neg     cl                      ; CL = bits in mask - glyph width
                    461:         inc     ah                      ; AH = 1
                    462:         shl     ah,cl
                    463:         neg     ah                      ; AH = right mask
                    464:         and     ch,ah                   ; composite mask = leftmask & rightmask
                    465:         cmp     cGlyph,1                ; is it the last glyph?
                    466:         je      short sblt_left_bitcount; yes, display it
                    467:         or      byte ptr flAccel,VSB_SAVE_BITS ; no, save glyph bits in buffer
                    468:         jmp     short sblt_left_bitcount; we know there is only one glyph byte
                    469: 
                    470: ; Calculate the inner count
                    471: 
                    472:         ALIGN 4
                    473: sblt_inner_count:
                    474:         mov     cl,bl                   ; EBX = # bits left in cell
                    475:         shr     ebx,3                   ; EBX = inner bytecount
                    476:         mov     cInnerBytes,ebx
                    477: 
                    478: ; Calculate the last byte mask
                    479: 
                    480: sblt_last_mask:
                    481:         and     cl,7                    ; CL = # of trailing bits
                    482:         mov     cfLastBits,cl
                    483:         dec     ah                      ; AH = 0FFh
                    484:         shr     ah,cl
                    485:         not     ah                      ; AH = trailing byte mask
                    486:         mov     fjLastMask,ah
                    487: 
                    488:         ALIGN 4
                    489: sblt_left_bitcount:
                    490:         mov     cl,al                   ; CL = left mask bitcount
                    491: 
                    492: ;----------------------------------------------------------------------------
                    493: ; Now get information of the current glyph
                    494: ;----------------------------------------------------------------------------
                    495: 
                    496: ; Calculate the glyph scan size
                    497: 
                    498: sblt_glyph_info:
                    499:         mov     eax,[esi].gb_cx         ; Glyph width in pels
                    500:         add     eax,7
                    501:         shr     eax,3
                    502:         mov     cjBytes,eax             ; bytecount for glyph scan increment
                    503: 
                    504: ; Assume the glyph is not clipped
                    505: 
                    506:         lea     esi,[esi].gb_aj
                    507:         mov     pjGlyph,esi             ; Start of glyph
                    508:         test    byte ptr flOption,VGB_VERT_CLIPPED_GLYPH or VGB_HORIZ_CLIPPED_GLYPH
                    509:         jz      short sblt_xfer_glyph_image
                    510: 
                    511: ; Calculate byte offset of the 1st scan in glyph
                    512: 
                    513: sblt_glyph_offset:
                    514:         mov     ebx,cOffsetScan         ; EBX = 1st visible glyph scan
                    515:         imul    eax,ebx
                    516:         xor     ebx,ebx
                    517:         xchg    ebx,xStartCell          ; other glyph always start from 1st bit
                    518:         add     eax,ebx                 ; offset to the 1st visible glyph byte
                    519:         add     esi,eax                 ; ESI = ptr to 1st visible glyph byte
                    520:         mov     pjGlyph,esi
                    521: 
                    522: ;----------------------------------------------------------------------------
                    523: ; Transfer the current glyph bits to screen or buffer
                    524: ;       CH = 1st byte screen mask
                    525: ;       CL = 1st byte screen mask bitcount
                    526: ;       DL = 1st glyph byte bitcount
                    527: ;----------------------------------------------------------------------------
                    528: 
                    529: sblt_xfer_glyph_image:
                    530:         mov     eax,flAccel             ; Accelarator flag
                    531:         and     flAccel,VSB_OPAQUE_BKGND or VSB_MIX_STRING; Prepare for next glyph
                    532: 
                    533:         sub     cl,dl                   ; if screen mask bitcount > bitcount
                    534:         setg    dl                      ; in 1st glyph byte, we need two bytes
                    535:         shr     dl,1                    ; CY =1 if two byte fetch
                    536:         adc     eax,eax
                    537:         and     cl,7                    ; CL = phase shift
                    538:         mov     ebx,pfnFirstByte        ; use the appropriate jump table
                    539:         call    [ebx][eax*4]            ; transfer 1st image byte
                    540: 
                    541: xgi_inner_bytes:
                    542:         mov     edx,cInnerBytes
                    543:         or      edx,edx                 ; do we have inner bytes?
                    544:         jz      short xgi_last_byte     ; no. go to last byte
                    545:         mov     esi,pjGlyph             ; Read glyph from here
                    546:         mov     eax,flAccel             ; Accelerator flags
                    547:         xor     ch,ch
                    548:         sub     ch,cl                   ; CY = 1 if we need another byte
                    549:         adc     eax,eax                 ; EAX = offset to jump table
                    550:         dec     edx                     ; is there only one middle byte?
                    551:         jnz     short xgi_multi_inner_bytes
                    552: 
                    553: xgi_single_inner_byte:
                    554:         mov     cInnerBytes,edx         ; clear inner bytecount for next glyph
                    555:         push    offset FLAT:xgi_last_byte
                    556:         jmp     offset FLAT:xgi_middle_byte_table[eax*4]
                    557: 
                    558: xgi_multi_inner_bytes:
                    559:         inc     edx                     ; restore the bytes count
                    560:         mov     edi,pjScreen            ; Always write glyph to screen
                    561:         add     pjGlyph,edx             ; advance pointer to last glyph byte
                    562:         add     pjScreen,edx            ; advance screen pointer to last column
                    563:         sub     cjBytes,edx             ; glyph scan incremental
                    564:         mov     ebx,ulNextScan
                    565:         sub     ebx,edx                 ; screen scan incremental
                    566:         mov     edx,cScan               ; display area height
                    567:         mov     cScanCount,edx
                    568:         call    offset FLAT:xgi_middle_bytes_table[eax*4]
                    569:         xor     eax,eax
                    570:         xchg    eax,cInnerBytes         ; clear inner bytecount for next glyph
                    571:         add     cjBytes,eax             ; restore its original value
                    572: 
                    573: xgi_last_byte:
                    574:         mov     ch,fjLastMask           ; CH = last byte mask
                    575:         or      ch,ch                   ; do we have the last byte?
                    576:         jz      short sblt_xfer_one_glyph; no. then we are done
                    577: 
                    578:         mov     esi,pjGlyph             ; Read glyph from here
                    579:         mov     eax,flAccel             ; AL = EAX = Accelerator flags, AH = 0
                    580:         mov     fjLastMask,ah           ; clear last mask for next glyph
                    581:         mov     dh,8
                    582:         sub     dh,cl                   ; DH = # bits available in next byte
                    583:         sub     dh,cfLastBits           ; CY = 1 if we need another byte
                    584:         adc     eax,eax
                    585:         mov     ebx,pfnLastGlyph        ; use an appropriate jump table
                    586:         call    [ebx][eax*4]            ; transfer the last glyph byte
                    587: 
                    588: sblt_xfer_one_glyph:
                    589:         dec     cGlyph
                    590:         jz      short sblt_exit         ; we are finished
                    591:         cmp     cGlyph,1
                    592:         je      sblt_last_glyph_cell    ; the last glyph to transfer
                    593:         jmp     [pfnMidGlyph]           ; to the right entry point
                    594: 
                    595: ;----------------------------------------------------------------------------
                    596: ; Everything is done, go home
                    597: ;----------------------------------------------------------------------------
                    598: 
                    599: sblt_exit:
                    600:         cRet    vStringBlt
                    601: 
                    602: ;---------------------------Private-Routine------------------------------;
                    603: ; fixed_pitch_aligned_sblt
                    604: ;
                    605: ;   Draw string of fixed-pitch glyph with byte width that is byte aligned
                    606: ;   onto screen.
                    607: ;
                    608: ; History:
                    609: ;   Wed 02-Oct-1991 09:16:15 -by- Viroon Touranachun [viroont]
                    610: ;   Created.
                    611: ;-----------------------------------------------------------------------;
                    612: 
                    613:         ALIGN 4
                    614: fixed_pitch_aligned_sblt::
                    615:         test    byte ptr flAccel,VSB_OPAQUE_BKGND
                    616:         jz      short fixed_pitch_aligned_sblt_inner; if we do opaque background
                    617:         mov     esi,edi                 ; save ptr to 1st glyph
                    618:         call    xgi_set_opaque_bkgnd    ; we need to init VGA registers
                    619:         mov     edi,esi                 ; restore ptr to 1st glyph
                    620: 
                    621:         ALIGN 4
                    622: fixed_pitch_aligned_sblt_inner:
                    623:         mov     esi,[edi].gp_pgdf
                    624:         mov     esi,[esi].gdf_pgb       ; ptr to glyph bits
                    625:         mov     edx,[esi].gb_cx         ; full glyph cell width
                    626:         mov     eax,edx
                    627:         shr     edx,3                   ; number of bytes it covers
                    628:         mov     cFixGlyphWidth,edx
                    629: 
                    630:         add     eax,7
                    631:         shr     eax,3
                    632:         mov     cjBytes,eax             ; bytecount for glyph scan increment
                    633:         imul    eax,cOffsetScan
                    634:         mov     cFixScanOffset,eax      ; fixed byte offset to 1st visible scan
                    635: 
                    636:         mov     eax,flAccel             ; mix modes are here
                    637:         and     eax,VSB_OPAQUE_BKGND or VSB_MIX_STRING
                    638:         add     eax,eax                 ; we will always do one fetch
                    639: 
                    640:         sub     edi,size GLYPHPOS       ; prepare to advance to 1st glyph
                    641:         dec     edx                     ; use different routine if one byte
                    642:         jnz     short fpa_multi_byte_glyph
                    643: 
                    644: fpa_single_byte_glyph:
                    645:         mov     eax,offset FLAT:xgi_middle_byte_table[eax*4]
                    646:         mov     pfnFirstByte,eax
                    647: 
                    648:         ALIGN 4
                    649: fpa_next_single_byte_glyph:
                    650:         add     edi,size GLYPHPOS       ; move to the next glyph
                    651:         mov     esi,[edi].gp_pgdf
                    652:         mov     esi,[esi].gdf_pgb       ; ptr to glyph bits
                    653:         lea     esi,[esi].gb_aj         ; start of the glyph bits
                    654:         add     esi,cFixScanOffset      ; advance to 1st visible byte
                    655:         push    edi                     ; save pointer to the current glyph
                    656:         call    [pfnFirstByte]          ; display the current glyph
                    657:         pop     edi                     ; restore the current glyph ptr
                    658:         dec     cGlyph
                    659:         jnz     short fpa_next_single_byte_glyph
                    660:         jmp     short fpa_exit          ; we are done
                    661: 
                    662:         ALIGN 4
                    663: fpa_multi_byte_glyph:
                    664:         mov     eax,offset FLAT:xgi_middle_bytes_table[eax*4]
                    665:         mov     pfnFirstByte,eax
                    666:         inc     edx                     ; restore the glyph width
                    667:         mov     cInnerBytes,edx
                    668:         sub     cjBytes,edx             ; glyph scan incremental
                    669:         mov     ebx,ulNextScan
                    670:         sub     ebx,edx                 ; screen scan incremental
                    671: 
                    672:         ALIGN 4
                    673: fpa_next_multi_byte_glyph:
                    674:         add     edi,size GLYPHPOS       ; move to the next glyph
                    675:         mov     esi,[edi].gp_pgdf
                    676:         mov     esi,[esi].gdf_pgb       ; ptr to glyph bits
                    677:         lea     esi,[esi].gb_aj         ; start of the glyph bits
                    678:         add     esi,cFixScanOffset      ; advance to 1st visible byte
                    679:         push    edi                     ; save pointer to the current glyph
                    680:         mov     edi,pjScreen            ; Always write glyph to screen
                    681:         mov     eax,cFixGlyphWidth      ; glyph width in byte
                    682:         add     pjScreen,eax            ; advance screen pointer to last column
                    683:         mov     eax,cScan               ; display area height
                    684:         mov     cScanCount,eax
                    685:         call    [pfnFirstByte]
                    686:         pop     edi                     ; restore the current glyph ptr
                    687:         dec     cGlyph
                    688:         jnz     short fpa_next_multi_byte_glyph
                    689: 
                    690:         ALIGN 4
                    691: fpa_exit:
                    692:         retn
                    693: 
                    694: ;*************************************************************************
                    695: ;
                    696: ;   The following routines transfer the glyph image to reserved memory area.
                    697: ;
                    698: ;*************************************************************************
                    699: 
                    700: ;---------------------------Private-Routine------------------------------;
                    701: ; xgi1_buffer_overwrite
                    702: ;
                    703: ;   Draw a glyph byte onto the reserved memory area.
                    704: ;   For opaque background, collect the current mask for displaying it later.
                    705: ;
                    706: ; History:
                    707: ;   Thu 18-Jul-1991 13:10:27 -by- Viroon Touranachun [viroont]
                    708: ;   Created.
                    709: ;-----------------------------------------------------------------------;
                    710: 
                    711:         ALIGN 4
                    712: xgi1_buffer_over_obos::
                    713:         mov     fjOBOSMask,ch           ; new mask for new byte
                    714: 
                    715:         ALIGN 4
                    716: xgi1_buffer_over::
                    717:         mov     ebx,cScanBlock          ; Scans to draw
                    718:         mov     edi,pjImage             ; we are just saving the bits
                    719:         mov     eax,cLeadScan
                    720:         mov     edx,cjBytes
                    721:         jmp     offset FLAT:xgi1_fob_over[eax*4]; start at the correct location
                    722: 
                    723:         ALIGN 4
                    724: xgi_fetch_one_byte_over_loop8:
                    725:         mov     al,[esi]                ; AL = glyph data
                    726:         add     esi,edx                 ; Next line of glyph
                    727:         rol     al,cl                   ; Put usable glyph data in place
                    728:         and     al,ch
                    729: 
                    730: xgi_fetch_one_byte_over_loop7:
                    731:         mov     ah,[esi]                ; AL = glyph data
                    732:         add     esi,edx                 ; Next line of glyph
                    733:         rol     ah,cl                   ; Put usable glyph data in place
                    734:         and     ah,ch
                    735:         shl     eax,16
                    736: 
                    737: xgi_fetch_one_byte_over_loop6:
                    738:         mov     al,[esi]                ; AL = glyph data
                    739:         add     esi,edx                 ; Next line of glyph
                    740:         rol     al,cl                   ; Put usable glyph data in place
                    741:         and     al,ch
                    742: 
                    743: xgi_fetch_one_byte_over_loop5:
                    744:         mov     ah,[esi]                ; AL = glyph data
                    745:         add     esi,edx                 ; Next line of glyph
                    746:         rol     ah,cl                   ; Put usable glyph data in place
                    747:         and     ah,ch
                    748:         rol     eax,16
                    749:         stosd
                    750: 
                    751: xgi_fetch_one_byte_over_loop4:
                    752:         mov     al,[esi]                ; AL = glyph data
                    753:         add     esi,edx                 ; Next line of glyph
                    754:         rol     al,cl                   ; Put usable glyph data in place
                    755:         and     al,ch
                    756: 
                    757: xgi_fetch_one_byte_over_loop3:
                    758:         mov     ah,[esi]                ; AL = glyph data
                    759:         add     esi,edx                 ; Next line of glyph
                    760:         rol     ah,cl                   ; Put usable glyph data in place
                    761:         and     ah,ch
                    762:         shl     eax,16
                    763: 
                    764: xgi_fetch_one_byte_over_loop2:
                    765:         mov     al,[esi]                ; AL = glyph data
                    766:         add     esi,edx                 ; Next line of glyph
                    767:         rol     al,cl                   ; Put usable glyph data in place
                    768:         and     al,ch
                    769: 
                    770: xgi_fetch_one_byte_over_loop1:
                    771:         mov     ah,[esi]                ; AL = glyph data
                    772:         add     esi,edx                 ; Next line of glyph
                    773:         rol     ah,cl                   ; Put usable glyph data in place
                    774:         and     ah,ch
                    775:         rol     eax,16
                    776:         stosd
                    777: 
                    778:         dec     ebx
                    779:         jnz     short xgi_fetch_one_byte_over_loop8 ; finish column
                    780: 
                    781: xbov1_exit:
                    782:         retn
                    783: 
                    784: ;---------------------------Private-Routine------------------------------;
                    785: ; xgi1_buffer_or
                    786: ;
                    787: ;   Merge a glyph byte with bits in the reserved memory area.
                    788: ;   For opaque background, collect the current mask for displaying it later.
                    789: ;
                    790: ; History:
                    791: ;   Thu 18-Jul-1991 13:10:27 -by- Viroon Touranachun [viroont]
                    792: ;   Created.
                    793: ;-----------------------------------------------------------------------;
                    794: 
                    795:         ALIGN 4
                    796: xgi1_buffer_or_obos::
                    797:         or      fjOBOSMask,ch           ; accumulate mask for new byte
                    798: 
                    799:         ALIGN 4
                    800: xgi1_buffer_or::
                    801:         mov     ebx,cScanBlock          ; Scans to draw
                    802:         mov     edi,pjImage             ; we are just saving the bits
                    803:         mov     eax,cLeadScan
                    804:         mov     edx,cjBytes
                    805:         jmp     offset FLAT:xgi1_fob_or[eax*4]; start at the correct location
                    806: 
                    807:         ALIGN 4
                    808: xgi_fetch_one_byte_or_loop8:
                    809:         mov     al,[esi]                ; AL = glyph data
                    810:         add     esi,edx                 ; Next line of glyph
                    811:         rol     al,cl                   ; Put usable glyph data in place
                    812:         and     al,ch
                    813: 
                    814: xgi_fetch_one_byte_or_loop7:
                    815:         mov     ah,[esi]                ; AL = glyph data
                    816:         add     esi,edx                 ; Next line of glyph
                    817:         rol     ah,cl                   ; Put usable glyph data in place
                    818:         and     ah,ch
                    819:         shl     eax,16
                    820: 
                    821: xgi_fetch_one_byte_or_loop6:
                    822:         mov     al,[esi]                ; AL = glyph data
                    823:         add     esi,edx                 ; Next line of glyph
                    824:         rol     al,cl                   ; Put usable glyph data in place
                    825:         and     al,ch
                    826: 
                    827: xgi_fetch_one_byte_or_loop5:
                    828:         mov     ah,[esi]                ; AL = glyph data
                    829:         add     esi,edx                 ; Next line of glyph
                    830:         rol     ah,cl                   ; Put usable glyph data in place
                    831:         and     ah,ch
                    832:         rol     eax,16
                    833:         or      [edi],eax
                    834:         add     edi,4                   ; advance buffer pointer
                    835: 
                    836: xgi_fetch_one_byte_or_loop4:
                    837:         mov     al,[esi]                ; AL = glyph data
                    838:         add     esi,edx                 ; Next line of glyph
                    839:         rol     al,cl                   ; Put usable glyph data in place
                    840:         and     al,ch
                    841: 
                    842: xgi_fetch_one_byte_or_loop3:
                    843:         mov     ah,[esi]                ; AL = glyph data
                    844:         add     esi,edx                 ; Next line of glyph
                    845:         rol     ah,cl                   ; Put usable glyph data in place
                    846:         and     ah,ch
                    847:         shl     eax,16
                    848: 
                    849: xgi_fetch_one_byte_or_loop2:
                    850:         mov     al,[esi]                ; AL = glyph data
                    851:         add     esi,edx                 ; Next line of glyph
                    852:         rol     al,cl                   ; Put usable glyph data in place
                    853:         and     al,ch
                    854: 
                    855: xgi_fetch_one_byte_or_loop1:
                    856:         mov     ah,[esi]                ; AL = glyph data
                    857:         add     esi,edx                 ; Next line of glyph
                    858:         rol     ah,cl                   ; Put usable glyph data in place
                    859:         and     ah,ch
                    860:         rol     eax,16
                    861:         or      [edi],eax
                    862:         add     edi,4                   ; advance buffer pointer
                    863: 
                    864:         dec     ebx
                    865:         jnz     short xgi_fetch_one_byte_or_loop8 ; finish column
                    866: 
                    867: xbor1_exit:
                    868:         retn
                    869: 
                    870: ;---------------------------Private-Routine------------------------------;
                    871: ; xgi2_buffer_over
                    872: ;
                    873: ;   Draw two glyph bytes onto the reserved memory area.
                    874: ;   For opaque background, collect the current mask for displaying it later.
                    875: ;
                    876: ; History:
                    877: ;   Thu 18-Jul-1991 13:10:27 -by- Viroon Touranachun [viroont]
                    878: ;   Created.
                    879: ;-----------------------------------------------------------------------;
                    880: 
                    881:         ALIGN 4
                    882: xgi2_buffer_over_obos::
                    883:         mov     fjOBOSMask,ch           ; new mask for new byte
                    884: 
                    885:         ALIGN 4
                    886: xgi2_buffer_over::
                    887:         mov     ebx,cScanBlock          ; Scans to draw
                    888:         mov     edi,pjImage             ; we are just saving the bits
                    889:         mov     eax,cLeadScan
                    890: 
                    891:         push    ebp                     ; *************************************
                    892:         mov     ebp,cjBytes             ; ** No parameter access beyond this **
                    893: 
                    894:         jmp     offset FLAT:xgi2_ftb_over[eax*4] ; start at the correct location
                    895: 
                    896:         ALIGN 4
                    897: xgi_fetch_two_bytes_over_loop8:
                    898:         mov     ax,[esi]                ; AL = curr byte, AH = next byte
                    899:         add     esi,ebp                 ; Next line of glyph
                    900:         rol     ax,cl                   ; AL = glyph data
                    901:         and     al,ch
                    902: 
                    903: xgi_fetch_two_bytes_over_loop7:
                    904:         mov     dx,[esi]                ; AL = curr byte, AH = next byte
                    905:         add     esi,ebp                 ; Next line of glyph
                    906:         rol     dx,cl                   ; AL = glyph data
                    907:         and     dl,ch
                    908:         mov     ah,dl
                    909:         shl     eax,16
                    910: 
                    911: xgi_fetch_two_bytes_over_loop6:
                    912:         mov     ax,[esi]                ; AL = curr byte, AH = next byte
                    913:         add     esi,ebp                 ; Next line of glyph
                    914:         rol     ax,cl                   ; AL = glyph data
                    915:         and     al,ch
                    916: 
                    917: xgi_fetch_two_bytes_over_loop5:
                    918:         mov     dx,[esi]                ; AL = curr byte, AH = next byte
                    919:         add     esi,ebp                 ; Next line of glyph
                    920:         rol     dx,cl                   ; AL = glyph data
                    921:         and     dl,ch
                    922:         mov     ah,dl
                    923:         rol     eax,16
                    924:         stosd
                    925: 
                    926: xgi_fetch_two_bytes_over_loop4:
                    927:         mov     ax,[esi]                ; AL = curr byte, AH = next byte
                    928:         add     esi,ebp                 ; Next line of glyph
                    929:         rol     ax,cl                   ; AL = glyph data
                    930:         and     al,ch
                    931: 
                    932: xgi_fetch_two_bytes_over_loop3:
                    933:         mov     dx,[esi]                ; AL = curr byte, AH = next byte
                    934:         add     esi,ebp                 ; Next line of glyph
                    935:         rol     dx,cl                   ; AL = glyph data
                    936:         and     dl,ch
                    937:         mov     ah,dl
                    938:         shl     eax,16
                    939: 
                    940: xgi_fetch_two_bytes_over_loop2:
                    941:         mov     ax,[esi]                ; AL = curr byte, AH = next byte
                    942:         add     esi,ebp                 ; Next line of glyph
                    943:         rol     ax,cl                   ; AL = glyph data
                    944:         and     al,ch
                    945: 
                    946: xgi_fetch_two_bytes_over_loop1:
                    947:         mov     dx,[esi]                ; AL = curr byte, AH = next byte
                    948:         add     esi,ebp                 ; Next line of glyph
                    949:         rol     dx,cl                   ; AL = glyph data
                    950:         and     dl,ch
                    951:         mov     ah,dl
                    952:         rol     eax,16
                    953:         stosd
                    954: 
                    955:         dec     ebx
                    956:         jnz     short xgi_fetch_two_bytes_over_loop8 ; finish column
                    957: 
                    958:         pop     ebp                     ; ** Parameter can be accessed ********
                    959:         inc     pjGlyph                 ; always advance glyph ptr for 2 bytes
                    960: 
                    961: xbov2_exit:
                    962:         retn
                    963: 
                    964: ;---------------------------Private-Routine------------------------------;
                    965: ; xgi2_buffer_or
                    966: ;
                    967: ;   Merge two glyph bytes with bits in the reserved memory area.
                    968: ;   For opaque background, collect the current mask for displaying it later.
                    969: ;
                    970: ; History:
                    971: ;   Thu 18-Jul-1991 13:10:27 -by- Viroon Touranachun [viroont]
                    972: ;   Created.
                    973: ;-----------------------------------------------------------------------;
                    974: 
                    975:         ALIGN 4
                    976: xgi2_buffer_or_obos::
                    977:         or      fjOBOSMask,ch           ; accumulate mask for new byte
                    978: 
                    979:         ALIGN 4
                    980: xgi2_buffer_or::
                    981:         mov     ebx,cScanBlock          ; Scans to draw
                    982:         mov     edi,pjImage             ; we are just saving the bits
                    983:         mov     eax,cLeadScan
                    984: 
                    985:         push    ebp                     ; *************************************
                    986:         mov     ebp,cjBytes             ; ** No parameter access beyond this **
                    987: 
                    988:         jmp     offset FLAT:xgi2_ftb_or[eax*4] ; start at the correct location
                    989: 
                    990:         ALIGN 4
                    991: xgi_fetch_two_bytes_or_loop8:
                    992:         mov     ax,[esi]                ; AL = curr byte, AH = next byte
                    993:         add     esi,ebp                 ; Next line of glyph
                    994:         rol     ax,cl                   ; AL = glyph data
                    995:         and     al,ch
                    996: 
                    997: xgi_fetch_two_bytes_or_loop7:
                    998:         mov     dx,[esi]                ; AL = curr byte, AH = next byte
                    999:         add     esi,ebp                 ; Next line of glyph
                   1000:         rol     dx,cl                   ; AL = glyph data
                   1001:         and     dl,ch
                   1002:         mov     ah,dl
                   1003:         shl     eax,16
                   1004: 
                   1005: xgi_fetch_two_bytes_or_loop6:
                   1006:         mov     ax,[esi]                ; AL = curr byte, AH = next byte
                   1007:         add     esi,ebp                 ; Next line of glyph
                   1008:         rol     ax,cl                   ; AL = glyph data
                   1009:         and     al,ch
                   1010: 
                   1011: xgi_fetch_two_bytes_or_loop5:
                   1012:         mov     dx,[esi]                ; AL = curr byte, AH = next byte
                   1013:         add     esi,ebp                 ; Next line of glyph
                   1014:         rol     dx,cl                   ; AL = glyph data
                   1015:         and     dl,ch
                   1016:         mov     ah,dl
                   1017:         rol     eax,16
                   1018:         or      [edi],eax
                   1019:         add     edi,4                   ; Next scan on VGA
                   1020: 
                   1021: xgi_fetch_two_bytes_or_loop4:
                   1022:         mov     ax,[esi]                ; AL = curr byte, AH = next byte
                   1023:         add     esi,ebp                 ; Next line of glyph
                   1024:         rol     ax,cl                   ; AL = glyph data
                   1025:         and     al,ch
                   1026: 
                   1027: xgi_fetch_two_bytes_or_loop3:
                   1028:         mov     dx,[esi]                ; AL = curr byte, AH = next byte
                   1029:         add     esi,ebp                 ; Next line of glyph
                   1030:         rol     dx,cl                   ; AL = glyph data
                   1031:         and     dl,ch
                   1032:         mov     ah,dl
                   1033:         shl     eax,16
                   1034: 
                   1035: xgi_fetch_two_bytes_or_loop2:
                   1036:         mov     ax,[esi]                ; AL = curr byte, AH = next byte
                   1037:         add     esi,ebp                 ; Next line of glyph
                   1038:         rol     ax,cl                   ; AL = glyph data
                   1039:         and     al,ch
                   1040: 
                   1041: xgi_fetch_two_bytes_or_loop1:
                   1042:         mov     dx,[esi]                ; AL = curr byte, AH = next byte
                   1043:         add     esi,ebp                 ; Next line of glyph
                   1044:         rol     dx,cl                   ; AL = glyph data
                   1045:         and     dl,ch
                   1046:         mov     ah,dl
                   1047:         rol     eax,16
                   1048:         or      [edi],eax
                   1049:         add     edi,4                   ; Next scan on VGA
                   1050: 
                   1051:         dec     ebx
                   1052:         jnz     short xgi_fetch_two_bytes_or_loop8 ; finish column
                   1053: 
                   1054:         pop     ebp                     ; ** Parameter can be accessed ********
                   1055:         inc     pjGlyph                 ; always advance glyph ptr for 2 bytes
                   1056: 
                   1057: xbor2_exit:
                   1058:         retn
                   1059: 
                   1060: ;*************************************************************************
                   1061: ;
                   1062: ;   The following routines handle opaque glyph xparent background to screen
                   1063: ;
                   1064: ;*************************************************************************
                   1065: 
                   1066: ;---------------------------Private-Routine------------------------------;
                   1067: ; xgi1_scrn_g_xbos
                   1068: ;
                   1069: ;   Draw an opaque glyph byte with xparent background to screen.
                   1070: ;   If it's the 1st screen byte, adjust jump tables.
                   1071: ;
                   1072: ; History:
                   1073: ;   Thu 18-Jul-1991 13:10:27 -by- Viroon Touranachun [viroont]
                   1074: ;   Created.
                   1075: ;-----------------------------------------------------------------------;
                   1076: 
                   1077:         ALIGN 4
                   1078: xgi1_scrn_g_xbos_1scrn::
                   1079:         mov     pfnFirstByte,offset FLAT:xgi_1st_byte
                   1080: 
                   1081:         ALIGN 4
                   1082: xgi1_scrn_g_xbos::
                   1083:         push    ecx                     ; preserve phase info
                   1084:         mov     ebx,cScanBlock          ; Scans to draw
                   1085:         mov     ecx,ulNextScan          ; scan line width
                   1086:         mov     edi,pjScreen            ; we are displaying the glyph
                   1087:         mov     edx,cjBytes
                   1088:         mov     eax,cLeadScan
                   1089:         jmp     offset FLAT:xsg1_xbos_dispatch[eax*4]; start at the correct location
                   1090: 
                   1091:         ALIGN 4
                   1092: xsg1_xbos_loop8:
                   1093:         mov     al,[esi]                ; get the glyph byte
                   1094:         add     esi,edx                 ; Next line of glyph
                   1095:         or      al,al
                   1096:         jz      short @F
                   1097:         xchg    [edi],al
                   1098: @@:
                   1099:         add     edi,ecx                 ; Next line on screen
                   1100: 
                   1101: xsg1_xbos_loop7:
                   1102:         mov     al,[esi]                ; get the glyph byte
                   1103:         add     esi,edx                 ; Next line of glyph
                   1104:         or      al,al
                   1105:         jz      short @F
                   1106:         xchg    [edi],al
                   1107: @@:
                   1108:         add     edi,ecx                 ; Next line on screen
                   1109: 
                   1110: xsg1_xbos_loop6:
                   1111:         mov     al,[esi]                ; get the glyph byte
                   1112:         add     esi,edx                 ; Next line of glyph
                   1113:         or      al,al
                   1114:         jz      short @F
                   1115:         xchg    [edi],al
                   1116: @@:
                   1117:         add     edi,ecx                 ; Next line on screen
                   1118: 
                   1119: xsg1_xbos_loop5:
                   1120:         mov     al,[esi]                ; get the glyph byte
                   1121:         add     esi,edx                 ; Next line of glyph
                   1122:         or      al,al
                   1123:         jz      short @F
                   1124:         xchg    [edi],al
                   1125: @@:
                   1126:         add     edi,ecx                 ; Next line on screen
                   1127: 
                   1128: xsg1_xbos_loop4:
                   1129:         mov     al,[esi]                ; get the glyph byte
                   1130:         add     esi,edx                 ; Next line of glyph
                   1131:         or      al,al
                   1132:         jz      short @F
                   1133:         xchg    [edi],al
                   1134: @@:
                   1135:         add     edi,ecx                 ; Next line on screen
                   1136: 
                   1137: xsg1_xbos_loop3:
                   1138:         mov     al,[esi]                ; get the glyph byte
                   1139:         add     esi,edx                 ; Next line of glyph
                   1140:         or      al,al
                   1141:         jz      short @F
                   1142:         xchg    [edi],al
                   1143: @@:
                   1144:         add     edi,ecx                 ; Next line on screen
                   1145: 
                   1146: xsg1_xbos_loop2:
                   1147:         mov     al,[esi]                ; get the glyph byte
                   1148:         add     esi,edx                 ; Next line of glyph
                   1149:         or      al,al
                   1150:         jz      short @F
                   1151:         xchg    [edi],al
                   1152: @@:
                   1153:         add     edi,ecx                 ; Next line on screen
                   1154: 
                   1155: xsg1_xbos_loop1:
                   1156:         mov     al,[esi]                ; get the glyph byte
                   1157:         add     esi,edx                 ; Next line of glyph
                   1158:         or      al,al
                   1159:         jz      short @F
                   1160:         xchg    [edi],al
                   1161: @@:
                   1162:         add     edi,ecx                 ; Next line on screen
                   1163: 
                   1164:         dec     ebx
                   1165:         jnz     short xsg1_xbos_loop8   ; finish column
                   1166: 
                   1167: xsg1_xbos_update_ptr:
                   1168:         inc     pjGlyph                 ; advance glyph pointer
                   1169:         inc     pjScreen                ; advance display ptr
                   1170: 
                   1171:         pop     ecx                     ; restore phase info
                   1172: 
                   1173:         retn
                   1174: 
                   1175: ;---------------------------Private-Routine------------------------------;
                   1176: ; xgi1_scrn_gs_xbos
                   1177: ;
                   1178: ;   Draw opaque glyph bytes with xparent background to screen.
                   1179: ;
                   1180: ; History:
                   1181: ;   Thu 18-Jul-1991 13:10:27 -by- Viroon Touranachun [viroont]
                   1182: ;   Created.
                   1183: ;-----------------------------------------------------------------------;
                   1184: 
                   1185:         ALIGN 4
                   1186: xgi1_scrn_gs_xbos::
                   1187:         mov     edx,cjBytes
                   1188: 
                   1189:         ALIGN 4
                   1190: xsgs1_xbos_next_scan:
                   1191:         mov     ecx,cInnerBytes
                   1192: 
                   1193:         ALIGN 4
                   1194: xsgs1_xbos_loop:
                   1195:         lodsb                           ; get the glyph byte
                   1196:         or      al,al
                   1197:         jz      short @F
                   1198:         xchg    [edi],al
                   1199: @@:
                   1200:         inc     edi
                   1201:         loop    xsgs1_xbos_loop
                   1202: 
                   1203:         add     esi,edx                 ; Next line of glyph
                   1204:         add     edi,ebx                 ; advance screen pointer to next scan
                   1205:         dec     cScanCount
                   1206:         jnz     short xsgs1_xbos_next_scan; finish this scan
                   1207: 
                   1208: xsgs1_xbos_exit:
                   1209:         retn
                   1210: 
                   1211: ;---------------------------Private-Routine------------------------------;
                   1212: ; xgi1_scrn_gm_xbos
                   1213: ;
                   1214: ;   Draw a masked opaque glyph byte with xparent background to screen.
                   1215: ;   For the 1st screen byte, update the jump tables.
                   1216: ;
                   1217: ; History:
                   1218: ;   Thu 18-Jul-1991 13:10:27 -by- Viroon Touranachun [viroont]
                   1219: ;   Created.
                   1220: ;-----------------------------------------------------------------------;
                   1221: 
                   1222:         ALIGN 4
                   1223: xgi1_scrn_gm_xbos_1scrn::
                   1224:         mov     pfnFirstByte,offset FLAT:xgi_1st_byte
                   1225: 
                   1226:         ALIGN 4
                   1227: xgi1_scrn_gm_xbos::
                   1228:         mov     ebx,cScan               ; number of scans
                   1229:         mov     edi,pjScreen            ; we will output to screen
                   1230:         mov     edx,cjBytes
                   1231: 
                   1232:         ALIGN 4
                   1233: xsgm1_xbos_loop:
                   1234:         mov     al,[esi]                ; get the glyph byte
                   1235:         rol     al,cl                   ; Put usable glyph data in place
                   1236:         and     al,ch
                   1237:         jz      short @F
                   1238:         xchg    [edi],al
                   1239: @@:
                   1240:         add     esi,edx                 ; Next line of glyph
                   1241:         add     edi,ulNextScan          ; advance screen pointer to next scan
                   1242:         dec     ebx
                   1243:         jnz     short xsgm1_xbos_loop   ; finish column
                   1244: 
                   1245: xsgm1_xbos_update_ptr:
                   1246:         sub     bl,cl                   ; if phase aligned, CY = 0
                   1247:         cmc                             ; if phase aligned, CY = 1
                   1248:         adc     pjGlyph,0               ; if phase aligned, advance glyph ptr
                   1249:         inc     pjScreen
                   1250: 
                   1251: xsgm1_xbos_exit:
                   1252:         retn
                   1253: 
                   1254: ;---------------------------Private-Routine------------------------------;
                   1255: ; xgi1_scrn_gmb_xbos
                   1256: ;
                   1257: ;   Draw an masked opaque glyph byte and bits from the reserved memory area
                   1258: ;   with xparent background to screen. Update jump tables if 1st screen byte.
                   1259: ;
                   1260: ; History:
                   1261: ;   Thu 18-Jul-1991 13:10:27 -by- Viroon Touranachun [viroont]
                   1262: ;   Created.
                   1263: ;-----------------------------------------------------------------------;
                   1264: 
                   1265:         ALIGN 4
                   1266: xgi1_scrn_gmb_xbos_1scrn::
                   1267:         mov     pfnFirstByte,offset FLAT:xgi_1st_byte
                   1268: 
                   1269:         ALIGN 4
                   1270: xgi1_scrn_gmb_xbos::
                   1271:         push    ebp                     ; remember stack frame pointer
                   1272:         mov     eax,cLeadScan           ; First scan to draw
                   1273:         mov     edx,pjImage             ; access bits saved in buffer
                   1274:         mov     edi,pjScreen            ; we are displaying the glyph
                   1275:         mov     ebx,ulNextScan          ; offset to next screen scan
                   1276:         mov     eax,xsgmb1_xbos_dispatch[eax*4]
                   1277:         push    eax                     ; start at the correct location
                   1278:         mov     ah,byte ptr cScanBlock  ; Number of scan blocks to draw
                   1279:                                         ; ***2K scans max***
                   1280:         mov     ebp,cjBytes             ; offset to next glyph scan
                   1281:                                         ; ***can't access stack frame***
                   1282:         retn                            ;jump into unrolled loop
                   1283: 
                   1284:         ALIGN 4
                   1285: xsgmb1_xbos_loop8:
                   1286:         mov     al,[esi]                ; get the glyph byte
                   1287:         add     esi,ebp                 ; Next line of glyph
                   1288:         rol     al,cl                   ; Put usable glyph data in place
                   1289:         and     al,ch
                   1290:         or      al,[edx]
                   1291:         jz      short @F
                   1292:         xchg    [edi],al
                   1293: @@:
                   1294:         add     edi,ebx
                   1295: 
                   1296: xsgmb1_xbos_loop7:
                   1297:         mov     al,[esi]                ; get the glyph byte
                   1298:         add     esi,ebp                 ; Next line of glyph
                   1299:         rol     al,cl                   ; Put usable glyph data in place
                   1300:         and     al,ch
                   1301:         or      al,[edx][1]
                   1302:         jz      short @F
                   1303:         xchg    [edi],al
                   1304: @@:
                   1305:         add     edi,ebx
                   1306: 
                   1307: xsgmb1_xbos_loop6:
                   1308:         mov     al,[esi]                ; get the glyph byte
                   1309:         add     esi,ebp                 ; Next line of glyph
                   1310:         rol     al,cl                   ; Put usable glyph data in place
                   1311:         and     al,ch
                   1312:         or      al,[edx][2]
                   1313:         jz      short @F
                   1314:         xchg    [edi],al
                   1315: @@:
                   1316:         add     edi,ebx
                   1317: 
                   1318: xsgmb1_xbos_loop5:
                   1319:         mov     al,[esi]                ; get the glyph byte
                   1320:         add     esi,ebp                 ; Next line of glyph
                   1321:         rol     al,cl                   ; Put usable glyph data in place
                   1322:         and     al,ch
                   1323:         or      al,[edx][3]
                   1324:         jz      short @F
                   1325:         xchg    [edi],al
                   1326: @@:
                   1327:         add     edi,ebx
                   1328:         add     edx,4
                   1329: 
                   1330: xsgmb1_xbos_loop4:
                   1331:         mov     al,[esi]                ; get the glyph byte
                   1332:         add     esi,ebp                 ; Next line of glyph
                   1333:         rol     al,cl                   ; Put usable glyph data in place
                   1334:         and     al,ch
                   1335:         or      al,[edx]
                   1336:         jz      short @F
                   1337:         xchg    [edi],al
                   1338: @@:
                   1339:         add     edi,ebx
                   1340: 
                   1341: xsgmb1_xbos_loop3:
                   1342:         mov     al,[esi]                ; get the glyph byte
                   1343:         add     esi,ebp                 ; Next line of glyph
                   1344:         rol     al,cl                   ; Put usable glyph data in place
                   1345:         and     al,ch
                   1346:         or      al,[edx][1]
                   1347:         jz      short @F
                   1348:         xchg    [edi],al
                   1349: @@:
                   1350:         add     edi,ebx
                   1351: 
                   1352: xsgmb1_xbos_loop2:
                   1353:         mov     al,[esi]                ; get the glyph byte
                   1354:         add     esi,ebp                 ; Next line of glyph
                   1355:         rol     al,cl                   ; Put usable glyph data in place
                   1356:         and     al,ch
                   1357:         or      al,[edx][2]
                   1358:         jz      short @F
                   1359:         xchg    [edi],al
                   1360: @@:
                   1361:         add     edi,ebx
                   1362: 
                   1363: xsgmb1_xbos_loop1:
                   1364:         mov     al,[esi]                ; get the glyph byte
                   1365:         add     esi,ebp                 ; Next line of glyph
                   1366:         rol     al,cl                   ; Put usable glyph data in place
                   1367:         and     al,ch
                   1368:         or      al,[edx][3]
                   1369:         jz      short @F
                   1370:         xchg    [edi],al
                   1371: @@:
                   1372:         add     edi,ebx
                   1373:         add     edx,4
                   1374: 
                   1375:         dec     ah
                   1376:         jnz     xsgmb1_xbos_loop8       ; finish column
                   1377: 
                   1378:         pop     ebp                     ;***can access stack frame again***
                   1379: 
                   1380: xsgmb1_xbos_update_ptr:
                   1381:         inc     pjScreen
                   1382: 
                   1383: xsgmb1_xbos_exit:
                   1384:         retn
                   1385: 
                   1386: ;---------------------------Private-Routine------------------------------;
                   1387: ; xgi2_scrn_g_xbos
                   1388: ;
                   1389: ;   Draw a glyph to the reserved memory area.
                   1390: ;
                   1391: ; History:
                   1392: ;   Thu 18-Jul-1991 13:10:27 -by- Viroon Touranachun [viroont]
                   1393: ;   Created.
                   1394: ;-----------------------------------------------------------------------;
                   1395: 
                   1396:         ALIGN 4
                   1397: xgi2_scrn_g_xbos_1scrn::
                   1398:         mov     pfnFirstByte,offset FLAT:xgi_1st_byte
                   1399: 
                   1400:         ALIGN 4
                   1401: xgi2_scrn_g_xbos::
                   1402:         push    ecx                     ; preserve phase info
                   1403:         mov     eax,cLeadScan
                   1404:         mov     ch,byte ptr cScanBlock  ; Number of scan blocks to draw
                   1405:                                         ; ***2K scans max***
                   1406:         mov     edi,pjScreen            ; where we are displaying the glyph
                   1407:         mov     edx,cjBytes
                   1408:         mov     ebx,ulNextScan          ; offset to next screen scan
                   1409: 
                   1410:         jmp     offset FLAT:xsg2_xbos_dispatch[eax*4]; start at the correct location
                   1411: 
                   1412:         ALIGN 4
                   1413: xsg2_xbos_loop8:
                   1414:         mov     ax,[esi]                ; get the glyph byte
                   1415:         add     esi,edx                 ; Next line of glyph
                   1416:         rol     ax,cl
                   1417:         or      al,al
                   1418:         jz      short @F
                   1419:         xchg    [edi],al
                   1420: @@:
                   1421:         add     edi,ebx                 ; next screen scan line
                   1422: 
                   1423: xsg2_xbos_loop7:
                   1424:         mov     ax,[esi]                ; get the glyph byte
                   1425:         add     esi,edx                 ; Next line of glyph
                   1426:         rol     ax,cl
                   1427:         or      al,al
                   1428:         jz      short @F
                   1429:         xchg    [edi],al
                   1430: @@:
                   1431:         add     edi,ebx                 ; next screen scan line
                   1432: 
                   1433: xsg2_xbos_loop6:
                   1434:         mov     ax,[esi]                ; get the glyph byte
                   1435:         add     esi,edx                 ; Next line of glyph
                   1436:         rol     ax,cl
                   1437:         or      al,al
                   1438:         jz      short @F
                   1439:         xchg    [edi],al
                   1440: @@:
                   1441:         add     edi,ebx                 ; next screen scan line
                   1442: 
                   1443: xsg2_xbos_loop5:
                   1444:         mov     ax,[esi]                ; get the glyph byte
                   1445:         add     esi,edx                 ; Next line of glyph
                   1446:         rol     ax,cl
                   1447:         or      al,al
                   1448:         jz      short @F
                   1449:         xchg    [edi],al
                   1450: @@:
                   1451:         add     edi,ebx                 ; next screen scan line
                   1452: 
                   1453: xsg2_xbos_loop4:
                   1454:         mov     ax,[esi]                ; get the glyph byte
                   1455:         add     esi,edx                 ; Next line of glyph
                   1456:         rol     ax,cl
                   1457:         or      al,al
                   1458:         jz      short @F
                   1459:         xchg    [edi],al
                   1460: @@:
                   1461:         add     edi,ebx                 ; next screen scan line
                   1462: 
                   1463: xsg2_xbos_loop3:
                   1464:         mov     ax,[esi]                ; get the glyph byte
                   1465:         add     esi,edx                 ; Next line of glyph
                   1466:         rol     ax,cl
                   1467:         or      al,al
                   1468:         jz      short @F
                   1469:         xchg    [edi],al
                   1470: @@:
                   1471:         add     edi,ebx                 ; next screen scan line
                   1472: 
                   1473: xsg2_xbos_loop2:
                   1474:         mov     ax,[esi]                ; get the glyph byte
                   1475:         add     esi,edx                 ; Next line of glyph
                   1476:         rol     ax,cl
                   1477:         or      al,al
                   1478:         jz      short @F
                   1479:         xchg    [edi],al
                   1480: @@:
                   1481:         add     edi,ebx                 ; next screen scan line
                   1482: 
                   1483: xsg2_xbos_loop1:
                   1484:         mov     ax,[esi]                ; get the glyph byte
                   1485:         add     esi,edx                 ; Next line of glyph
                   1486:         rol     ax,cl
                   1487:         or      al,al
                   1488:         jz      short @F
                   1489:         xchg    [edi],al
                   1490: @@:
                   1491:         add     edi,ebx                 ; next screen scan line
                   1492: 
                   1493:         dec     ch
                   1494:         jnz     xsg2_xbos_loop8         ; finish column
                   1495: 
                   1496: xsg2_xbos_update_ptr:
                   1497:         inc     pjScreen                ; advance screen ptr
                   1498:         inc     pjGlyph                 ; always advance glyph ptr for 2 bytes
                   1499: 
                   1500:         pop     ecx                     ; restore phase info
                   1501: 
                   1502:         retn
                   1503: 
                   1504: ;---------------------------Private-Routine------------------------------;
                   1505: ; xgi2_scrn_gs_xbos
                   1506: ;
                   1507: ;   Draw a glyph to the reserved memory area.
                   1508: ;
                   1509: ; History:
                   1510: ;   Thu 18-Jul-1991 13:10:27 -by- Viroon Touranachun [viroont]
                   1511: ;   Created.
                   1512: ;-----------------------------------------------------------------------;
                   1513: 
                   1514:         ALIGN 4
                   1515: xgi2_scrn_gs_xbos::
                   1516: xsgs2_xbos_next_scan:
                   1517:         mov     edx,cInnerBytes
                   1518: 
                   1519:         ALIGN 4
                   1520: xsgs2_xbos_loop:
                   1521:         mov     ax,[esi]                ; get the glyph byte
                   1522:         rol     ax,cl
                   1523:         or      al,al
                   1524:         jz      short @F
                   1525:         xchg    [edi],al
                   1526: @@:
                   1527:         inc     esi
                   1528:         inc     edi
                   1529:         dec     edx
                   1530:         jnz     short xsgs2_xbos_loop
                   1531: 
                   1532:         add     esi,cjBytes             ; Next line of glyph
                   1533:         add     edi,ebx                 ; advance screen pointer to next scan
                   1534:         dec     cScanCount
                   1535:         jnz     short xsgs2_xbos_next_scan; finish this scan
                   1536: 
                   1537: xsgs2_xbos_exit:
                   1538:         retn
                   1539: 
                   1540: ;---------------------------Private-Routine------------------------------;
                   1541: ; xgi2_scrn_gm_xbos
                   1542: ;
                   1543: ;   Draw a glyph to the reserved memory area.
                   1544: ;
                   1545: ; History:
                   1546: ;   Thu 18-Jul-1991 13:10:27 -by- Viroon Touranachun [viroont]
                   1547: ;   Created.
                   1548: ;-----------------------------------------------------------------------;
                   1549: 
                   1550:         ALIGN 4
                   1551: xgi2_scrn_gm_xbos_1scrn::
                   1552:         mov     pfnFirstByte,offset FLAT:xgi_1st_byte
                   1553: 
                   1554:         ALIGN 4
                   1555: xgi2_scrn_gm_xbos::
                   1556:         mov     ebx,cScan               ; number of scans
                   1557:         mov     edi,pjScreen            ; we will output to screen
                   1558:         mov     edx,cjBytes
                   1559: 
                   1560:         ALIGN 4
                   1561: xsgm2_xbos_loop:
                   1562:         mov     ax,[esi]                ; get the glyph byte
                   1563:         rol     ax,cl                   ; Put usable glyph data in place
                   1564:         and     al,ch
                   1565:         jz      short @F
                   1566:         xchg    [edi],al
                   1567: @@:
                   1568:         add     esi,edx                 ; Next line of glyph
                   1569:         add     edi,ulNextScan          ; advance screen pointer to next scan
                   1570:         dec     ebx
                   1571:         jnz     short xsgm2_xbos_loop   ; finish column
                   1572: 
                   1573: xsgm2_xbos_update_ptr:
                   1574:         inc     pjScreen                ; advance screen ptr
                   1575:         inc     pjGlyph                 ; always advance glyph ptr for 2 bytes
                   1576: 
                   1577: xsgm2_xbos_exit:
                   1578:         retn
                   1579: 
                   1580: ;*************************************************************************
                   1581: ;
                   1582: ;   The following routines handle mixed glyph xparent background to screen
                   1583: ;
                   1584: ;*************************************************************************
                   1585: 
                   1586: ;---------------------------Private-Routine------------------------------;
                   1587: ; xgi1_scrn_g_xbms
                   1588: ;
                   1589: ;   Draw a mixed glyph byte with xparent background to screen.
                   1590: ;   If it's the 1st screen byte, adjust jump tables.
                   1591: ;
                   1592: ; History:
                   1593: ;   Thu 18-Jul-1991 13:10:27 -by- Viroon Touranachun [viroont]
                   1594: ;   Created.
                   1595: ;-----------------------------------------------------------------------;
                   1596: 
                   1597:         ALIGN 4
                   1598: xgi1_scrn_g_xbms_1scrn::
                   1599:         mov     pfnFirstByte,offset FLAT:xgi_1st_byte
                   1600: 
                   1601:         ALIGN 4
                   1602: xgi1_scrn_g_xbms::
                   1603:         push    ecx                     ; preserve phase info
                   1604:         mov     ebx,cScan               ; number of scans
                   1605:         mov     edi,pjScreen            ; we will output to screen
                   1606:         mov     ecx,ulNextScan          ; distance from one screen scan to next
                   1607: 
                   1608:         push    ebp                     ; *************************************
                   1609:         mov     ebp,cjBytes             ; ** No parameter access beyond this **
                   1610: 
                   1611:         mov     edx,VGA_BASE + GRAF_ADDR ; Leave this in a register
                   1612:         mov     al,GRAF_BIT_MASK
                   1613:         out     dx,al                   ; leave GC Index pointing to Bit Mask
                   1614:         inc     edx                     ; leave DX pointing to GC Data
                   1615: 
                   1616:         ALIGN 4
                   1617: xsg1_xbms_loop:
                   1618:         mov     al,[esi]                ; AH = glyph data
                   1619:         or      al,al
                   1620:         jz      short @F                ; Don't waste time
                   1621: 
                   1622:         out     dx,al
                   1623:         xchg    al,[edi]                ; Set the bits
                   1624: 
                   1625: @@:
                   1626:         add     esi,ebp                 ; Next line of glyph
                   1627:         add     edi,ecx                 ; advance screen pointer to next scan
                   1628:         dec     ebx
                   1629:         jnz     short xsg1_xbms_loop    ; finish column
                   1630: 
                   1631:         pop     ebp                     ; ** Parameter can be accessed ********
                   1632: 
                   1633: xsg1_xbms_update_ptr:
                   1634:         inc     pjGlyph                 ; advance glyph pointer
                   1635:         inc     pjScreen                ; advance screen ptr
                   1636: 
                   1637:         pop     ecx                     ; restore phase info
                   1638: 
                   1639:         retn
                   1640: 
                   1641: ;---------------------------Private-Routine------------------------------;
                   1642: ; xgi1_scrn_gs_xbms
                   1643: ;
                   1644: ;   Draw mixed glyph bytes with xparent background to screen.
                   1645: ;
                   1646: ; History:
                   1647: ;   Thu 18-Jul-1991 13:10:27 -by- Viroon Touranachun [viroont]
                   1648: ;   Created.
                   1649: ;-----------------------------------------------------------------------;
                   1650: 
                   1651:         ALIGN 4
                   1652: xgi1_scrn_gs_xbms::
                   1653:         mov     dx,VGA_BASE + GRAF_ADDR ; Leave this in a register
                   1654:         mov     al,GRAF_BIT_MASK        ; leave it in AL
                   1655: 
                   1656:         ALIGN 4
                   1657: xsgs1_xbms_next_scan:
                   1658:         mov     ecx,cInnerBytes
                   1659: 
                   1660:         ALIGN 4
                   1661: xsgs1_xbms_loop:
                   1662:         mov     ah,[esi]                ; AH = glyph data
                   1663:         or      ah,ah
                   1664:         jz      short @F                ; Don't waste time
                   1665: 
                   1666:         out     dx,ax
                   1667:         xchg    ah,[edi]                ; Set the bits
                   1668: @@:
                   1669:         inc     esi                     ; next glyph byte
                   1670:         inc     edi                     ; next screen byte
                   1671:         loop    xsgs1_xbms_loop
                   1672: 
                   1673:         add     esi,cjBytes             ; Next line of glyph
                   1674:         add     edi,ebx                 ; advance screen pointer to next scan
                   1675:         dec     cScanCount
                   1676:         jnz     short xsgs1_xbms_next_scan; finish this scan
                   1677: 
                   1678: xsgs1_xbms_exit:
                   1679:         retn
                   1680: 
                   1681: ;---------------------------Private-Routine------------------------------;
                   1682: ; xgi1_scrn_gm_xbms
                   1683: ;
                   1684: ;   Draw a masked mixed glyph byte with xparent background to screen.
                   1685: ;   For the 1st screen byte, update the jump tables.
                   1686: ;
                   1687: ; History:
                   1688: ;   Thu 18-Jul-1991 13:10:27 -by- Viroon Touranachun [viroont]
                   1689: ;   Created.
                   1690: ;-----------------------------------------------------------------------;
                   1691: 
                   1692:         ALIGN 4
                   1693: xgi1_scrn_gm_xbms_1scrn::
                   1694:         mov     pfnFirstByte,offset FLAT:xgi_1st_byte
                   1695: 
                   1696:         ALIGN 4
                   1697: xgi1_scrn_gm_xbms::
                   1698:         mov     ebx,cScan               ; number of scans
                   1699:         mov     edi,pjScreen            ; we will output to screen
                   1700: 
                   1701:         mov     dx,VGA_BASE + GRAF_ADDR ; Leave this in a register
                   1702:         mov     al,GRAF_BIT_MASK
                   1703:         out     dx,al                   ; leave GC Index pointing to Bit Mask
                   1704:         inc     edx                     ; leave DX pointing to GC Data
                   1705: 
                   1706:         ALIGN 4
                   1707: xsgm1_xbms_loop:
                   1708:         mov     al,[esi]                ; AH = glyph data
                   1709:         rol     al,cl                   ; Put usable glyph data in place
                   1710:         and     al,ch
                   1711:         jz      short @F                ; Don't waste time
                   1712: 
                   1713:         out     dx,al
                   1714:         xchg    al,[edi]                ; Set the bits
                   1715: 
                   1716: @@:
                   1717:         add     esi,cjBytes             ; Next line of glyph
                   1718:         add     edi,ulNextScan          ; advance screen pointer to next scan
                   1719:         dec     ebx
                   1720:         jnz     short xsgm1_xbms_loop   ; finish column
                   1721: 
                   1722: xsgm1_xbms_update_ptr:
                   1723:         sub     bl,cl                   ; if phase aligned, CY = 0
                   1724:         cmc                             ; if phase aligned, CY = 1
                   1725:         adc     pjGlyph,0               ; if phase aligned, advance glyph ptr
                   1726:         inc     pjScreen
                   1727: 
                   1728: xsgm1_xbms_exit:
                   1729:         retn
                   1730: 
                   1731: ;---------------------------Private-Routine------------------------------;
                   1732: ; xgi1_scrn_gmb_xbms
                   1733: ;
                   1734: ;   Draw an masked mixed glyph byte and bits from the reserved memory area
                   1735: ;   with xparent background to screen. Update jump tables if 1st screen byte.
                   1736: ;
                   1737: ; History:
                   1738: ;   Thu 18-Jul-1991 13:10:27 -by- Viroon Touranachun [viroont]
                   1739: ;   Created.
                   1740: ;-----------------------------------------------------------------------;
                   1741: 
                   1742:         ALIGN 4
                   1743: xgi1_scrn_gmb_xbms_1scrn::
                   1744:         mov     pfnFirstByte,offset FLAT:xgi_1st_byte
                   1745: 
                   1746:         ALIGN 4
                   1747: xgi1_scrn_gmb_xbms::
                   1748:         mov     eax,cScan               ; number of scans
                   1749:         mov     cScanCount,eax          ; scans count
                   1750:         mov     ebx,pjImage             ; don't forget bits we saved
                   1751:         add     ebx,cBufferOffset
                   1752:         mov     edi,pjScreen            ; we will output to screen
                   1753: 
                   1754:         mov     dx,VGA_BASE + GRAF_ADDR ; Leave this in a register
                   1755:         mov     al,GRAF_BIT_MASK
                   1756:         out     dx,al                   ; leave GC Index pointing to Bit Mask
                   1757:         inc     edx                     ; leave DX pointing to GC Data
                   1758: 
                   1759:         ALIGN 4
                   1760: xsgmb1_xbms_loop:
                   1761:         mov     al,[esi]                ; AH = glyph data
                   1762:         rol     al,cl                   ; Put usable glyph data in place
                   1763:         and     al,ch
                   1764:         or      al,[ebx]
                   1765:         jz      short @F                ; Don't waste time
                   1766: 
                   1767:         out     dx,al
                   1768:         xchg    al,[edi]                ; Set the bits
                   1769: 
                   1770: @@:
                   1771:         add     esi,cjBytes             ; Next line of glyph
                   1772:         add     edi,ulNextScan          ; advance screen pointer to next scan
                   1773:         inc     ebx
                   1774:         dec     cScanCount
                   1775:         jnz     short xsgmb1_xbms_loop  ; finish column
                   1776: 
                   1777: xsgmb1_xbms_update_ptr:
                   1778:         inc     pjScreen
                   1779: 
                   1780: xsgmb1_xbms_exit:
                   1781:         retn
                   1782: 
                   1783: ;---------------------------Private-Routine------------------------------;
                   1784: ; xgi2_scrn_g_xbms
                   1785: ;
                   1786: ;   Draw a glyph to the reserved memory area.
                   1787: ;
                   1788: ; History:
                   1789: ;   Thu 18-Jul-1991 13:10:27 -by- Viroon Touranachun [viroont]
                   1790: ;   Created.
                   1791: ;-----------------------------------------------------------------------;
                   1792: 
                   1793:         ALIGN 4
                   1794: xgi2_scrn_g_xbms_1scrn::
                   1795:         mov     pfnFirstByte,offset FLAT:xgi_1st_byte
                   1796: 
                   1797:         ALIGN 4
                   1798: xgi2_scrn_g_xbms::
                   1799:         mov     ebx,cScan               ; number of scans
                   1800:         mov     edi,pjScreen            ; we will output to screen
                   1801: 
                   1802:         mov     edx,VGA_BASE + GRAF_ADDR ; Leave this in a register
                   1803:         mov     al,GRAF_BIT_MASK
                   1804:         out     dx,al                   ; leave GC Index pointing to Bit Mask
                   1805:         inc     edx                     ; leave DX pointing to GC Data
                   1806: 
                   1807:         ALIGN 4
                   1808: xsg2_xbms_loop:
                   1809:         mov     ax,[esi]                ; AH = glyph data
                   1810:         rol     ax,cl
                   1811:         or      al,al
                   1812:         jz      short @F                ; Don't waste time
                   1813: 
                   1814:         out     dx,al
                   1815:         xchg    al,[edi]                ; Set the bits
                   1816: 
                   1817: @@:
                   1818:         add     esi,cjBytes             ; Next line of glyph
                   1819:         add     edi,ulNextScan          ; advance screen pointer to next scan
                   1820:         dec     ebx
                   1821:         jnz     short xsg2_xbms_loop    ; finish column
                   1822: 
                   1823: xsg2_xbms_update_ptr:
                   1824:         inc     pjScreen                ; advance screen ptr
                   1825:         inc     pjGlyph                 ; always advance glyph ptr for 2 bytes
                   1826: 
                   1827: xsg2_xbms_exit:
                   1828:         retn
                   1829: 
                   1830: ;---------------------------Private-Routine------------------------------;
                   1831: ; xgi2_scrn_gs_xbms
                   1832: ;
                   1833: ;   Draw a glyph to the reserved memory area.
                   1834: ;
                   1835: ; History:
                   1836: ;   Thu 18-Jul-1991 13:10:27 -by- Viroon Touranachun [viroont]
                   1837: ;   Created.
                   1838: ;-----------------------------------------------------------------------;
                   1839: 
                   1840:         ALIGN 4
                   1841: xgi2_scrn_gs_xbms::
                   1842:         mov     dx,VGA_BASE + GRAF_ADDR ; Leave this in a register
                   1843:         add     cl,8                    ; we want the glyph byte in AH
                   1844:         mov     cScreenInc,ebx
                   1845: 
                   1846:         ALIGN 4
                   1847: xsgs2_xbms_next_scan:
                   1848:         mov     ebx,cInnerBytes
                   1849: 
                   1850:         ALIGN 4
                   1851: xsgs2_xbms_loop:
                   1852:         mov     ax,[esi]                ; AH = glyph data
                   1853:         rol     ax,cl
                   1854:         or      ah,ah
                   1855:         jz      short @F                ; Don't waste time
                   1856: 
                   1857:         mov     al,GRAF_BIT_MASK        ; leave it in AL
                   1858:         out     dx,ax
                   1859:         xchg    ah,[edi]                ; Set the bits
                   1860: @@:
                   1861:         inc     esi                     ; next glyph byte
                   1862:         inc     edi                     ; next screen byte
                   1863:         dec     ebx
                   1864:         jnz     short xsgs2_xbms_loop
                   1865: 
                   1866:         add     esi,cjBytes             ; Next line of glyph
                   1867:         add     edi,cScreenInc          ; advance screen pointer to next scan
                   1868:         dec     cScanCount
                   1869:         jnz     short xsgs2_xbms_next_scan; finish this scan
                   1870:         sub     cl,8                    ; restore phase shift
                   1871: 
                   1872: xsgs2_xbms_exit:
                   1873:         mov     ebx,cScreenInc
                   1874:         retn
                   1875: 
                   1876: ;---------------------------Private-Routine------------------------------;
                   1877: ; xgi2_scrn_gm_xbms
                   1878: ;
                   1879: ;   Draw a glyph to the reserved memory area.
                   1880: ;
                   1881: ; History:
                   1882: ;   Thu 18-Jul-1991 13:10:27 -by- Viroon Touranachun [viroont]
                   1883: ;   Created.
                   1884: ;-----------------------------------------------------------------------;
                   1885: 
                   1886:         ALIGN 4
                   1887: xgi2_scrn_gm_xbms_1scrn::
                   1888:         mov     pfnFirstByte,offset FLAT:xgi_1st_byte
                   1889: 
                   1890:         ALIGN 4
                   1891: xgi2_scrn_gm_xbms::
                   1892:         mov     ebx,cScan               ; number of scans
                   1893:         mov     edi,pjScreen            ; we will output to screen
                   1894: 
                   1895:         mov     edx,VGA_BASE + GRAF_ADDR ; Leave this in a register
                   1896:         mov     al,GRAF_BIT_MASK
                   1897:         out     dx,al                   ; leave GC Index pointing to Bit Mask
                   1898:         inc     edx                     ; leave DX pointing to GC Data
                   1899: 
                   1900:         ALIGN 4
                   1901: xsgm2_xbms_loop:
                   1902:         mov     ax,[esi]                ; AH = glyph data
                   1903:         rol     ax,cl                   ; Put usable glyph data in place
                   1904:         and     al,ch
                   1905:         jz      short @F                ; Don't waste time
                   1906: 
                   1907:         out     dx,al
                   1908:         xchg    al,[edi]                ; Set the bits
                   1909: 
                   1910: @@:
                   1911:         add     esi,cjBytes             ; Next line of glyph
                   1912:         add     edi,ulNextScan          ; advance screen pointer to next scan
                   1913:         dec     ebx
                   1914:         jnz     short xsgm2_xbms_loop   ; finish column
                   1915: 
                   1916: xsgm2_xbms_update_ptr:
                   1917:         inc     pjScreen                ; advance screen ptr
                   1918:         inc     pjGlyph                 ; always advance glyph ptr for 2 bytes
                   1919: 
                   1920:         retn
                   1921: 
                   1922: ;*************************************************************************
                   1923: ;
                   1924: ;   The following routines handle opaque glyph opaque background to screen
                   1925: ;
                   1926: ;*************************************************************************
                   1927: 
                   1928: ;---------------------------Private-Routine------------------------------;
                   1929: ; xgi1_scrn_g_obos
                   1930: ;
                   1931: ;   Draw an opaque glyph byte with opaque background to screen.
                   1932: ;   If it's the 1st screen byte, adjust jump tables.
                   1933: ;
                   1934: ; History:
                   1935: ;   Thu 18-Jul-1991 13:10:27 -by- Viroon Touranachun [viroont]
                   1936: ;   Created.
                   1937: ;-----------------------------------------------------------------------;
                   1938: 
                   1939:         ALIGN 4
                   1940: xgi1_scrn_g_obos_1scrn::
                   1941:         mov     pfnFirstByte,offset FLAT:xgi_1st_byte
                   1942:         call    xgi_set_opaque_bkgnd    ; registers were never set
                   1943: 
                   1944:         ALIGN 4
                   1945: xgi1_scrn_g_obos::
                   1946:         push    ecx                     ; preserve phase info
                   1947:         mov     eax,cLeadScan
                   1948:         mov     ebx,cScanBlock          ; Scans to draw
                   1949:         mov     ecx,ulNextScan          ; offset from one screen scan to next
                   1950:         mov     edi,pjScreen            ; we are displaying the glyph
                   1951:         mov     edx,cjBytes
                   1952:         jmp     offset FLAT:xsg1_obos_dispatch[eax*4]; start at the correct location
                   1953: 
                   1954:         ALIGN 4
                   1955: xsg1_obos_loop8:
                   1956:         mov     al,[esi]
                   1957:         add     esi,edx                 ; Next line of glyph
                   1958:         mov     [edi],al
                   1959:         add     edi,ecx                 ; next screen scan
                   1960: 
                   1961: xsg1_obos_loop7:
                   1962:         mov     al,[esi]
                   1963:         add     esi,edx                 ; Next line of glyph
                   1964:         mov     [edi],al
                   1965:         add     edi,ecx                 ; next screen scan
                   1966: 
                   1967: xsg1_obos_loop6:
                   1968:         mov     al,[esi]
                   1969:         add     esi,edx                 ; Next line of glyph
                   1970:         mov     [edi],al
                   1971:         add     edi,ecx                 ; next screen scan
                   1972: 
                   1973: xsg1_obos_loop5:
                   1974:         mov     al,[esi]
                   1975:         add     esi,edx                 ; Next line of glyph
                   1976:         mov     [edi],al
                   1977:         add     edi,ecx                 ; next screen scan
                   1978: 
                   1979: xsg1_obos_loop4:
                   1980:         mov     al,[esi]
                   1981:         add     esi,edx                 ; Next line of glyph
                   1982:         mov     [edi],al
                   1983:         add     edi,ecx                 ; next screen scan
                   1984: 
                   1985: xsg1_obos_loop3:
                   1986:         mov     al,[esi]
                   1987:         add     esi,edx                 ; Next line of glyph
                   1988:         mov     [edi],al
                   1989:         add     edi,ecx                 ; next screen scan
                   1990: 
                   1991: xsg1_obos_loop2:
                   1992:         mov     al,[esi]
                   1993:         add     esi,edx                 ; Next line of glyph
                   1994:         mov     [edi],al
                   1995:         add     edi,ecx                 ; next screen scan
                   1996: 
                   1997: xsg1_obos_loop1:
                   1998:         mov     al,[esi]
                   1999:         add     esi,edx                 ; Next line of glyph
                   2000:         mov     [edi],al
                   2001:         add     edi,ecx                 ; next screen scan
                   2002: 
                   2003:         dec     ebx
                   2004:         jnz     short xsg1_obos_loop8   ; finish column
                   2005: 
                   2006: xsg1_obos_update_ptr:
                   2007:         inc     pjGlyph                 ; advance glyph pointer
                   2008:         inc     pjScreen                ; advance the display ptr
                   2009: 
                   2010:         pop     ecx                     ; restore phase info
                   2011: 
                   2012:         retn
                   2013: 
                   2014: ;---------------------------Private-Routine------------------------------;
                   2015: ; xgi1_scrn_gs_obos
                   2016: ;
                   2017: ;   Draw opaque glyph bytes with opaque background to screen.
                   2018: ;
                   2019: ; History:
                   2020: ;   Thu 18-Jul-1991 13:10:27 -by- Viroon Touranachun [viroont]
                   2021: ;   Created.
                   2022: ;-----------------------------------------------------------------------;
                   2023: 
                   2024:         ALIGN 4
                   2025: xgi1_scrn_gs_obos::
                   2026:         mov     edx,cjBytes
                   2027: 
                   2028:         ALIGN 4
                   2029: xsgs1_obos_next_scan:
                   2030:         mov     ecx,cInnerBytes         ; inner glyph byte
                   2031:         rep     movsb
                   2032:         add     esi,edx                 ; Next line of glyph
                   2033:         add     edi,ebx                 ; Next scan on VGA
                   2034:         dec     cScanCount
                   2035:         jnz     short xsgs1_obos_next_scan ; finish column
                   2036: 
                   2037: xsgs1_obos_exit:
                   2038:         retn
                   2039: 
                   2040: ;---------------------------Private-Routine------------------------------;
                   2041: ; xgi1_scrn_gmb_obos
                   2042: ;
                   2043: ;   Draw an masked opaque glyph byte and bits from the reserved memory area
                   2044: ;   with opaque background to screen.
                   2045: ;
                   2046: ; History:
                   2047: ;   Thu 18-Jul-1991 13:10:27 -by- Viroon Touranachun [viroont]
                   2048: ;   Created.
                   2049: ;-----------------------------------------------------------------------;
                   2050: 
                   2051:         ALIGN 4
                   2052: xgi1_scrn_gmb_obos::
                   2053:         push    ebp                     ; remember stack frame pointer
                   2054:         mov     eax,cLeadScan
                   2055:         mov     edx,pjImage             ; along with bits saved in buffer
                   2056:         mov     edi,pjScreen            ; we are displaying the glyph
                   2057:         mov     ebx,ulNextScan          ; offset to next screen scan
                   2058:         mov     eax,xsgmb1_obos_dispatch[eax*4]
                   2059:         push    eax                     ; start at the correct location
                   2060:         mov     ah,byte ptr cScanBlock  ; Number of scan blocks to draw
                   2061:                                         ; ***2K scans max***
                   2062:         mov     ebp,cjBytes             ; ** No parameter access beyond this **
                   2063: 
                   2064:         retn                            ;jump into unrolled loop
                   2065: 
                   2066:         ALIGN 4
                   2067: xsgmb1_obos_loop8:
                   2068:         mov     al,[esi]
                   2069:         add     esi,ebp                 ; Next line of glyph
                   2070:         rol     al,cl                   ; Put usable glyph data in place
                   2071:         and     al,ch
                   2072:         or      al,[edx]
                   2073:         mov     [edi],al
                   2074:         add     edi,ebx
                   2075: 
                   2076: xsgmb1_obos_loop7:
                   2077:         mov     al,[esi]
                   2078:         add     esi,ebp                 ; Next line of glyph
                   2079:         rol     al,cl                   ; Put usable glyph data in place
                   2080:         and     al,ch
                   2081:         or      al,[edx][1]
                   2082:         mov     [edi],al
                   2083:         add     edi,ebx
                   2084: 
                   2085: xsgmb1_obos_loop6:
                   2086:         mov     al,[esi]
                   2087:         add     esi,ebp                 ; Next line of glyph
                   2088:         rol     al,cl                   ; Put usable glyph data in place
                   2089:         and     al,ch
                   2090:         or      al,[edx][2]
                   2091:         mov     [edi],al
                   2092:         add     edi,ebx
                   2093: 
                   2094: xsgmb1_obos_loop5:
                   2095:         mov     al,[esi]
                   2096:         add     esi,ebp                 ; Next line of glyph
                   2097:         rol     al,cl                   ; Put usable glyph data in place
                   2098:         and     al,ch
                   2099:         or      al,[edx][3]
                   2100:         mov     [edi],al
                   2101:         add     edi,ebx
                   2102:         add     edx,4
                   2103: 
                   2104: xsgmb1_obos_loop4:
                   2105:         mov     al,[esi]
                   2106:         add     esi,ebp                 ; Next line of glyph
                   2107:         rol     al,cl                   ; Put usable glyph data in place
                   2108:         and     al,ch
                   2109:         or      al,[edx]
                   2110:         mov     [edi],al
                   2111:         add     edi,ebx
                   2112: 
                   2113: xsgmb1_obos_loop3:
                   2114:         mov     al,[esi]
                   2115:         add     esi,ebp                 ; Next line of glyph
                   2116:         rol     al,cl                   ; Put usable glyph data in place
                   2117:         and     al,ch
                   2118:         or      al,[edx][1]
                   2119:         mov     [edi],al
                   2120:         add     edi,ebx
                   2121: 
                   2122: xsgmb1_obos_loop2:
                   2123:         mov     al,[esi]
                   2124:         add     esi,ebp                 ; Next line of glyph
                   2125:         rol     al,cl                   ; Put usable glyph data in place
                   2126:         and     al,ch
                   2127:         or      al,[edx][2]
                   2128:         mov     [edi],al
                   2129:         add     edi,ebx
                   2130: 
                   2131: xsgmb1_obos_loop1:
                   2132:         mov     al,[esi]
                   2133:         add     esi,ebp                 ; Next line of glyph
                   2134:         rol     al,cl                   ; Put usable glyph data in place
                   2135:         and     al,ch
                   2136:         or      al,[edx][3]
                   2137:         mov     [edi],al
                   2138:         add     edi,ebx
                   2139:         add     edx,4
                   2140: 
                   2141:         dec     ah
                   2142:         jnz     xsgmb1_obos_loop8       ; finish column
                   2143: 
                   2144:         pop     ebp                     ; ** Parameter can be accessed ********
                   2145: 
                   2146: xsgmb1_obos_update_ptr:
                   2147:         inc     pjScreen
                   2148: 
                   2149: xsgmb1_obos_exit:
                   2150:         retn
                   2151: 
                   2152: ;---------------------------Private-Routine------------------------------;
                   2153: ; xgi2_scrn_g_obos
                   2154: ;
                   2155: ;   Draw an opaque glyph byte (2-fetch) with opaque background to screen.
                   2156: ;   If it's the 1st screen byte, adjust jump tables.
                   2157: ;
                   2158: ; History:
                   2159: ;   Thu 18-Jul-1991 13:10:27 -by- Viroon Touranachun [viroont]
                   2160: ;   Created.
                   2161: ;-----------------------------------------------------------------------;
                   2162: 
                   2163:         ALIGN 4
                   2164: xgi2_scrn_g_obos_1scrn::
                   2165:         mov     pfnFirstByte,offset FLAT:xgi_1st_byte
                   2166:         call    xgi_set_opaque_bkgnd
                   2167: 
                   2168:         ALIGN 4
                   2169: xgi2_scrn_g_obos::
                   2170:         push    ebp                     ; remember stack frame pointer
                   2171:         mov     eax,cLeadScan
                   2172:         mov     ebx,cScanBlock          ; Scans to draw
                   2173:         mov     edi,pjScreen            ; we are displaying the glyph
                   2174:         mov     edx,cjBytes             ; glyph distance to next scan
                   2175:         mov     ebp,ulNextScan          ; distance from one scan to next
                   2176:                                         ; ***stack frame unavailable***
                   2177:         jmp     offset FLAT:xsg2_obos_dispatch[eax*4]; start at the correct location
                   2178: 
                   2179:         ALIGN 4
                   2180: xsg2_obos_loop8:
                   2181:         mov     ax,[esi]
                   2182:         add     esi,edx                 ; Next line of glyph
                   2183:         rol     ax,cl
                   2184:         mov     [edi],al
                   2185:         add     edi,ebp
                   2186: 
                   2187: xsg2_obos_loop7:
                   2188:         mov     ax,[esi]
                   2189:         add     esi,edx                 ; Next line of glyph
                   2190:         rol     ax,cl
                   2191:         mov     [edi],al
                   2192:         add     edi,ebp
                   2193: 
                   2194: xsg2_obos_loop6:
                   2195:         mov     ax,[esi]
                   2196:         add     esi,edx                 ; Next line of glyph
                   2197:         rol     ax,cl
                   2198:         mov     [edi],al
                   2199:         add     edi,ebp
                   2200: 
                   2201: xsg2_obos_loop5:
                   2202:         mov     ax,[esi]
                   2203:         add     esi,edx                 ; Next line of glyph
                   2204:         rol     ax,cl
                   2205:         mov     [edi],al
                   2206:         add     edi,ebp
                   2207: 
                   2208: xsg2_obos_loop4:
                   2209:         mov     ax,[esi]
                   2210:         add     esi,edx                 ; Next line of glyph
                   2211:         rol     ax,cl
                   2212:         mov     [edi],al
                   2213:         add     edi,ebp
                   2214: 
                   2215: xsg2_obos_loop3:
                   2216:         mov     ax,[esi]
                   2217:         add     esi,edx                 ; Next line of glyph
                   2218:         rol     ax,cl
                   2219:         mov     [edi],al
                   2220:         add     edi,ebp
                   2221: 
                   2222: xsg2_obos_loop2:
                   2223:         mov     ax,[esi]
                   2224:         add     esi,edx                 ; Next line of glyph
                   2225:         rol     ax,cl
                   2226:         mov     [edi],al
                   2227:         add     edi,ebp
                   2228: 
                   2229: xsg2_obos_loop1:
                   2230:         mov     ax,[esi]
                   2231:         add     esi,edx                 ; Next line of glyph
                   2232:         rol     ax,cl
                   2233:         mov     [edi],al
                   2234:         add     edi,ebp
                   2235: 
                   2236:         dec     ebx
                   2237:         jnz     short xsg2_obos_loop8   ; finish column
                   2238: 
                   2239:         pop     ebp                     ; restore stack frame pointer
                   2240:                                         ; ***stack frame available***
                   2241: xsg2_obos_update_ptr:
                   2242:         inc     pjScreen                ; advance screen ptr
                   2243:         inc     pjGlyph                 ; always advance glyph ptr for 2 bytes
                   2244: 
                   2245:         retn
                   2246: 
                   2247: ;---------------------------Private-Routine------------------------------;
                   2248: ; xgi2_scrn_gs_obos
                   2249: ;
                   2250: ;   Draw multiple opaque glyph bytes (2-fetch) with opaque background to
                   2251: ;   screen. If it's the 1st screen byte, adjust jump tables.
                   2252: ;
                   2253: ; History:
                   2254: ;   Thu 18-Jul-1991 13:10:27 -by- Viroon Touranachun [viroont]
                   2255: ;   Created.
                   2256: ;-----------------------------------------------------------------------;
                   2257: 
                   2258:         ALIGN 4
                   2259: xgi2_scrn_gs_obos::
                   2260: xsgs2_obos_next_scan:
                   2261:         mov     edx,cInnerBytes         ; inner glyph byte
                   2262: 
                   2263:         ALIGN 4
                   2264: xsgs2_obos_loop:
                   2265:         mov     ax,[esi]
                   2266:         rol     ax,cl
                   2267:         stosb
                   2268:         inc     esi
                   2269:         dec     edx
                   2270:         jnz     short xsgs2_obos_loop
                   2271: 
                   2272:         add     esi,cjBytes             ; Next line of glyph
                   2273:         add     edi,ebx                 ; Next scan on VGA
                   2274:         dec     cScanCount
                   2275:         jnz     short xsgs2_obos_next_scan ; finish column
                   2276: 
                   2277: xsgs2_obos_exit:
                   2278:         retn
                   2279: 
                   2280: ;---------------------------Private-Routine------------------------------;
                   2281: ; xgi1_scrn_gm_obos
                   2282: ;
                   2283: ;   Draw a masked opaque glyph byte with opaque background to
                   2284: ;   screen. If it's the 1st screen byte, adjust jump tables.
                   2285: ;
                   2286: ; History:
                   2287: ;   Thu 18-Jul-1991 13:10:27 -by- Viroon Touranachun [viroont]
                   2288: ;   Created.
                   2289: ;-----------------------------------------------------------------------;
                   2290: 
                   2291:         ALIGN 4
                   2292: xgi1_scrn_gm_obos_1scrn::
                   2293:         mov     pfnFirstByte,offset FLAT:xgi_1st_byte
                   2294:         call    xgi1_scrn_gm_obos
                   2295:         jmp     xgi_set_opaque_bkgnd_test_full_byte
                   2296: 
                   2297:         ALIGN 4
                   2298: xgi1_scrn_gm_obos_lg::
                   2299:         test    ch,1                    ; if there is a right bitmask
                   2300:         jz      short xgi1_scrn_gm_obos ; set up VGA regs
                   2301:         inc     cInnerBytes             ; otherwise, include it in the middle
                   2302:         retn
                   2303: 
                   2304:         ALIGN 4
                   2305: xgi1_scrn_gm_obos::
                   2306: 
                   2307: ; Setup bit mask and stuff.
                   2308: 
                   2309:         call    xgi_setup_opaque_bkgnd_edge
                   2310: 
                   2311: ; The following AND leaves 1 bits in AH for the planes which
                   2312: ; CANNOT be done on the second pass.  So if this is zero we can
                   2313: ; skip the first pass.
                   2314: 
                   2315:         and     ah,bl                   ; BL = BkColor = color where data is 1
                   2316:         or      ah,bl                   ; planes to enable
                   2317:         jz      short xsgm1_obos_skip_first_pass
                   2318:         or      al,ah                   ; Include "Set/Reset" planes.
                   2319:         out     dx,al                   ; Enable planes for first pass.
                   2320: 
                   2321:         push    eax
                   2322:         mov     ebx,cScan
                   2323: 
                   2324:         ALIGN 4
                   2325: xsgm1_obos_first_pass:
                   2326:         mov     al,[esi]
                   2327:         rol     al,cl                   ; Put usable glyph data in place
                   2328:         xchg    al,[edi]
                   2329:         add     esi,cjBytes
                   2330:         add     edi,ulNextScan
                   2331:         dec     ebx
                   2332:         jnz     short xsgm1_obos_first_pass
                   2333: 
                   2334:         pop     eax
                   2335:         mov     esi,pjGlyph             ; restore the glyph pointer
                   2336:         mov     edi,pjScreen            ; restore the screen pointer
                   2337: 
                   2338:         ALIGN 4
                   2339: xsgm1_obos_skip_first_pass:
                   2340: 
                   2341: ; Enable the other planes.
                   2342: 
                   2343:         not     ah
                   2344:         and     ah,MM_ALL
                   2345:         jz      short xsgm1_obos_no_planes_left
                   2346:         mov     al,ah
                   2347:         out     dx,al
                   2348:         mov     ebx,cScan
                   2349: 
                   2350:         ALIGN 4
                   2351: xsgm1_obos_second_pass:
                   2352:         mov     al,[esi]
                   2353:         rol     al,cl                   ; Put usable glyph data in place
                   2354:         not     al
                   2355:         xchg    al,[edi]
                   2356:         add     esi,cjBytes
                   2357:         add     edi,ulNextScan
                   2358:         dec     ebx
                   2359:         jnz     short xsgm1_obos_second_pass
                   2360: 
                   2361:         ALIGN 4
                   2362: xsgm1_obos_no_planes_left:
                   2363:         mov     al,MM_ALL
                   2364:         out     dx,al
                   2365: 
                   2366: xsgm1_obos_exit:
                   2367:         sub     bl,cl                   ; if phase aligned, CY = 0
                   2368:         cmc                             ; if phase aligned, CY = 1
                   2369:         adc     pjGlyph,0               ; if phase aligned, advance glyph ptr
                   2370:         inc     pjScreen                ; advance the display ptr
                   2371:         retn                            ; no need to restore anything
                   2372: 
                   2373: ;---------------------------Private-Routine------------------------------;
                   2374: ; xgi2_scrn_gm_obos
                   2375: ;
                   2376: ;   Draw a masked opaque glyph bytes (2-fetch) with opaque background to
                   2377: ;   screen. If it's the 1st screen byte, adjust jump tables.
                   2378: ;
                   2379: ; History:
                   2380: ;   Thu 18-Jul-1991 13:10:27 -by- Viroon Touranachun [viroont]
                   2381: ;   Created.
                   2382: ;-----------------------------------------------------------------------;
                   2383: 
                   2384:         ALIGN 4
                   2385: xgi2_scrn_gm_obos_1scrn::
                   2386:         mov     pfnFirstByte,offset FLAT:xgi_1st_byte
                   2387:         call    xgi2_scrn_gm_obos
                   2388:         jmp     xgi_set_opaque_bkgnd_test_full_byte
                   2389: 
                   2390:         ALIGN 4
                   2391: xgi2_scrn_gm_obos_lg::
                   2392:         test    ch,1                    ; if there is a right bitmask
                   2393:         jz      short xgi2_scrn_gm_obos ; set up VGA regs
                   2394:         inc     cInnerBytes             ; otherwise, include it in the middle
                   2395:         retn
                   2396: 
                   2397:         ALIGN 4
                   2398: xgi2_scrn_gm_obos::
                   2399: 
                   2400: ; Setup bit mask and stuff.
                   2401: 
                   2402:         call    xgi_setup_opaque_bkgnd_edge
                   2403: 
                   2404: ; The following AND leaves 1 bits in AH for the planes which
                   2405: ; CANNOT be done on the second pass.  So if this is zero we can
                   2406: ; skip the first pass.
                   2407: 
                   2408:         and     ah,bl                   ; BL = BkColor = color where data is 1
                   2409:         or      ah,bl                   ; planes to enable
                   2410:         jz      short xsgm2_obos_skip_first_pass
                   2411:         or      al,ah                   ; Include "Set/Reset" planes.
                   2412:         out     dx,al                   ; Enable planes for first pass.
                   2413: 
                   2414:         push    eax
                   2415:         mov     ebx,cScan
                   2416: 
                   2417:         ALIGN 4
                   2418: xsgm2_obos_first_pass:
                   2419:         mov     ax,[esi]
                   2420:         rol     ax,cl                   ; Put usable glyph data in place
                   2421:         xchg    al,[edi]
                   2422:         add     esi,cjBytes
                   2423:         add     edi,ulNextScan
                   2424:         dec     ebx
                   2425:         jnz     short xsgm2_obos_first_pass
                   2426: 
                   2427:         pop     eax
                   2428:         mov     esi,pjGlyph             ; restore the glyph pointer
                   2429:         mov     edi,pjScreen            ; restore the screen pointer
                   2430: 
                   2431:         ALIGN 4
                   2432: xsgm2_obos_skip_first_pass:
                   2433: 
                   2434: ; Enable the other planes.
                   2435: 
                   2436:         not     ah
                   2437:         and     ah,MM_ALL
                   2438:         jz      short xsgm2_obos_no_planes_left
                   2439:         mov     al,ah
                   2440:         out     dx,al
                   2441:         mov     ebx,cScan
                   2442: 
                   2443:         ALIGN 4
                   2444: xsgm2_obos_second_pass:
                   2445:         mov     ax,[esi]
                   2446:         rol     ax,cl                   ; Put usable glyph data in place
                   2447:         not     al
                   2448:         xchg    al,[edi]
                   2449:         add     esi,cjBytes
                   2450:         add     edi,ulNextScan
                   2451:         dec     ebx
                   2452:         jnz     short xsgm2_obos_second_pass
                   2453: 
                   2454:         ALIGN 4
                   2455: xsgm2_obos_no_planes_left:
                   2456:         mov     al,MM_ALL
                   2457:         out     dx,al
                   2458: 
                   2459: xsgm2_obos_exit:
                   2460:         inc     pjScreen                ; advance the display ptr
                   2461:         inc     pjGlyph                 ; always advance glyph ptr for 2 bytes
                   2462:         retn                            ; no need to restore anything
                   2463: 
                   2464: 
                   2465: ;---------------------------Private-Routine------------------------------;
                   2466: ; xgi1_scrn_gmb_obos_1st_scrn
                   2467: ;
                   2468: ;   Draw a masked opaque glyph byte and bits in reserved buffer with
                   2469: ;   opaque background to the 1st screen byte.
                   2470: ;
                   2471: ; History:
                   2472: ;   Thu 18-Jul-1991 13:10:27 -by- Viroon Touranachun [viroont]
                   2473: ;   Created.
                   2474: ;-----------------------------------------------------------------------;
                   2475: 
                   2476:         ALIGN 4
                   2477: xgi1_scrn_gmb_obos_1scrn::
                   2478:         mov     pfnFirstByte,offset FLAT:xgi_1st_byte
                   2479: 
                   2480: ; Here we need to setup the bitmask including those in buffer. It can be
                   2481: ; calculated here from the x starting point.
                   2482: 
                   2483:         ALIGN 4
                   2484: xgmb1_obos_1scrn_bitmask:
                   2485:         xor     bh,bh                   ; we use and clear
                   2486:         xchg    bh,fjOBOSMask           ; the acculmulated mask
                   2487:         or      bh,ch                   ; also include the current mask
                   2488:         jns     short xsgmb1_call_obos_edge  ; there is really a mask
                   2489:         call    xgi_set_opaque_bkgnd    ; no mask, treat it as a full byte
                   2490:         jmp     xgi1_scrn_gmb_obos
                   2491: 
                   2492:         ALIGN 4
                   2493: xsgmb1_call_obos_edge:
                   2494:         call    xsgmb1_obos_edge
                   2495:         jmp     xgi_set_opaque_bkgnd_test_full_byte
                   2496: 
                   2497: ;---------------------------Private-Routine------------------------------;
                   2498: ; xgi1_scrn_gmb_obos_last_glyph
                   2499: ;
                   2500: ;   Draw a masked opaque byte from the last glyph and bits in reserved
                   2501: ;   buffer with opaque background to the screen.
                   2502: ;
                   2503: ; History:
                   2504: ;   Thu 18-Jul-1991 13:10:27 -by- Viroon Touranachun [viroont]
                   2505: ;   Created.
                   2506: ;-----------------------------------------------------------------------;
                   2507: 
                   2508:         ALIGN 4
                   2509: xgi1_scrn_gmb_obos_lg::
                   2510:         xor     bh,bh
                   2511:         xchg    bh,fjOBOSMask           ; use and clear the accumulated mask
                   2512:         or      bh,ch                   ; plus the current mask
                   2513:         inc     bh                      ; if mask is all 1s
                   2514:         jnz     short @F
                   2515:         call    xgi_set_opaque_bkgnd    ; treat it as a full byte
                   2516:         jmp     xgi1_scrn_gmb_obos
                   2517: @@:
                   2518:         dec     bh
                   2519:         call    xsgmb1_obos_edge        ; draw this first byte
                   2520:         cmp     cInnerBytes,0           ; last glyph has full middle bytes?
                   2521:         jz      short @F                ; no, then get out
                   2522:         call    xgi_set_opaque_bkgnd    ; set the full byte
                   2523: @@:
                   2524:         retn
                   2525: 
                   2526: ;---------------------------Private-Routine------------------------------;
                   2527: ; xgi1_scrn_gmb_obos_edge
                   2528: ;
                   2529: ;   Draw a masked opaque glyph byte and bits in reserved
                   2530: ;   buffer with opaque background to the screen.
                   2531: ;
                   2532: ; History:
                   2533: ;   Thu 18-Jul-1991 13:10:27 -by- Viroon Touranachun [viroont]
                   2534: ;   Created.
                   2535: ;-----------------------------------------------------------------------;
                   2536: 
                   2537:         ALIGN 4
                   2538: xsgmb1_obos_edge:
                   2539:         xchg    ch,bh                   ; set with the accumulated mask
                   2540:         call    xgi_setup_opaque_bkgnd_edge
                   2541:         xchg    ch,bh                   ; restore the current byte mask
                   2542: 
                   2543: ; The following AND leaves 1 bits in AH for the planes which
                   2544: ; CANNOT be done on the second pass.  So if this is zero we can
                   2545: ; skip the first pass.
                   2546: 
                   2547:         and     ah,bl                   ; BL = BkColor = color where data is 1
                   2548:         or      ah,bl                   ; planes to enable
                   2549:         jz      short xsgmbe1_obos_skip_first_pass
                   2550:         or      al,ah                   ; Include "Set/Reset" planes.
                   2551:         out     dx,al                   ; Enable planes for first pass.
                   2552: 
                   2553:         push    eax
                   2554:         mov     ebx,cScan
                   2555:         mov     edx,pjImage
                   2556:         add     edx,cBufferOffset
                   2557: 
                   2558:         ALIGN 4
                   2559: xsgmbe1_obos_first_pass:
                   2560:         mov     al,[esi]
                   2561:         rol     al,cl                   ; Put usable glyph data in place
                   2562:         and     al,ch
                   2563:         or      al,[edx]
                   2564:         xchg    al,[edi]
                   2565:         add     esi,cjBytes
                   2566:         add     edi,ulNextScan
                   2567:         inc     edx
                   2568:         dec     ebx
                   2569:         jnz     short xsgmbe1_obos_first_pass
                   2570: 
                   2571:         pop     eax
                   2572:         mov     esi,pjGlyph             ; restore the glyph pointer
                   2573:         mov     edi,pjScreen            ; restore the screen pointer
                   2574:         mov     dx,VGA_BASE + SEQ_DATA  ; The rest of the OUTs are here.
                   2575: 
                   2576:         ALIGN 4
                   2577: xsgmbe1_obos_skip_first_pass:
                   2578: 
                   2579: ; Enable the other planes.
                   2580: 
                   2581:         not     ah
                   2582:         and     ah,MM_ALL
                   2583:         jz      short xsgmbe1_obos_no_planes_left
                   2584:         mov     al,ah
                   2585:         out     dx,al
                   2586:         mov     ebx,cScan
                   2587:         mov     edx,pjImage
                   2588:         add     edx,cBufferOffset
                   2589: 
                   2590:         ALIGN 4
                   2591: xsgmbe1_obos_second_pass:
                   2592:         mov     al,[esi]
                   2593:         rol     al,cl                   ; Put usable glyph data in place
                   2594:         and     al,ch
                   2595:         or      al,[edx]
                   2596:         not     al
                   2597:         xchg    al,[edi]
                   2598:         add     esi,cjBytes
                   2599:         add     edi,ulNextScan
                   2600:         inc     edx
                   2601:         dec     ebx
                   2602:         jnz     short xsgmbe1_obos_second_pass
                   2603:         mov     dx,VGA_BASE + SEQ_DATA  ; The rest of the OUTs are here.
                   2604: 
                   2605:         ALIGN 4
                   2606: xsgmbe1_obos_no_planes_left:
                   2607:         mov     al,MM_ALL
                   2608:         out     dx,al
                   2609: 
                   2610: xsgmbe1_obos_exit:
                   2611:         sub     bl,cl                   ; if phase aligned, CY = 0
                   2612:         cmc                             ; if phase aligned, CY = 1
                   2613:         adc     pjGlyph,0               ; if phase aligned, advance glyph ptr
                   2614:         inc     pjScreen                ; advance the display ptr
                   2615:         retn
                   2616: 
                   2617: ;---------------------------Private-Routine------------------------------;
                   2618: ; xgi_set_opaque_bkgnd_edge
                   2619: ;
                   2620: ;   Set the VGA registers for drawing a masked screen byte with opaque
                   2621: ;   glyph and opaque background.
                   2622: ;
                   2623: ; History:
                   2624: ;   Thu 18-Jul-1991 13:10:27 -by- Viroon Touranachun [viroont]
                   2625: ;   Created.
                   2626: ;-----------------------------------------------------------------------;
                   2627: 
                   2628:         ALIGN 4
                   2629: xgi_setup_opaque_bkgnd_edge::
                   2630: 
                   2631:         mov     edi,pjScreen            ; screen pointer
                   2632:         mov     dx,VGA_BASE + GRAF_ADDR
                   2633:         mov     ax,GRAF_DATA_ROT + 256 * DR_SET
                   2634:         out     dx,ax
                   2635:         mov     ah,ch                   ; put mask in AH
                   2636:         mov     al,GRAF_BIT_MASK
                   2637:         out     dx,ax
                   2638: 
                   2639: ; Put foreground color in Set/Reset and enable planes where colors
                   2640: ; match.
                   2641: 
                   2642:         mov     ah,byte ptr (iBackClr)
                   2643:         mov     bl,byte ptr (iForeClr)
                   2644:         mov     al,GRAF_SET_RESET
                   2645:         out     dx,ax
                   2646:         xor     ah,bl
                   2647:         not     ah                      ; gives 1 where colors match
                   2648:         mov     al,GRAF_ENAB_SR
                   2649:         out     dx,ax
                   2650:         mov     dx,VGA_BASE + SEQ_DATA  ; The rest of the OUTs are here.
                   2651:         mov     al,ah
                   2652:         not     ah                      ; Gives 1 where colors mismatch.
                   2653:         retn
                   2654: 
                   2655: ;---------------------------Private-Routine------------------------------;
                   2656: ; xgi_set_opaque_bkgnd
                   2657: ;
                   2658: ;   Set the VGA registers for drawing a full screen byte with opaque
                   2659: ;   glyph and opaque background.
                   2660: ;
                   2661: ; History:
                   2662: ;   Thu 18-Jul-1991 13:10:27 -by- Viroon Touranachun [viroont]
                   2663: ;   Created.
                   2664: ;-----------------------------------------------------------------------;
                   2665: 
                   2666:         ALIGN 4
                   2667: xgi_set_opaque_bkgnd_test_full_byte::
                   2668:         mov     edi,prcl
                   2669:         mov     edx,[edi].xLeft
                   2670:         mov     eax,[edi].xRight
                   2671:         sub     eax,edx                 ; EAX = display area width
                   2672:         neg     edx
                   2673:         and     edx,7                   ; EDX = bits in left partial byte
                   2674:         sub     eax,edx
                   2675:         shr     eax,3                   ; EAX = inner full bytes
                   2676:         jnz     short xgi_set_opaque_bkgnd
                   2677:         retn                            ; there'll be no full byte
                   2678: 
                   2679:         ALIGN 4
                   2680: xgi_set_opaque_bkgnd::
                   2681: 
                   2682:         mov     dx,VGA_BASE + GRAF_ADDR
                   2683:         mov     ax,(DR_SET shl 8) + GRAF_DATA_ROT
                   2684:         out     dx,ax
                   2685: 
                   2686: ; First we put the foreground color into the latches.  We do this
                   2687: ; by putting this color into SET_RESET, writing it, then reading it.
                   2688: ; The memory location we will use is the first byte where we will blt.
                   2689: 
                   2690:         mov     ah,byte ptr iBackClr    ; for appropriate color
                   2691:         mov     al,GRAF_SET_RESET
                   2692:         out     dx,ax
                   2693:         mov     ax,0F00h + GRAF_ENAB_SR
                   2694:         out     dx,ax
                   2695: 
                   2696: ; Set bit mask = FF.
                   2697:         mov     ax,0FF00h + GRAF_BIT_MASK
                   2698:         out     dx,ax
                   2699: 
                   2700: ; Fill the latches.
                   2701:         mov     edi,pjScreen            ; we will overwrite this byte anyway
                   2702:         mov     [edi],al                ; color in SetReset is written, not AL
                   2703:         mov     al,[edi]                ; read to fill latches
                   2704: 
                   2705: ; Go to XOR mode.
                   2706:         mov     ax,GRAF_DATA_ROT + 256 * DR_XOR
                   2707:         out     dx,ax
                   2708: 
                   2709: ; Now setup SET_RESET.
                   2710: 
                   2711:         mov     ah,byte ptr iBackClr    ; for appropriate color
                   2712:         xor     ah,byte ptr iForeClr    ; gives 0 where colors match
                   2713:         mov     al,GRAF_SET_RESET
                   2714:         out     dx,ax
                   2715:         not     ah
                   2716:         mov     al,GRAF_ENAB_SR
                   2717:         out     dx,ax                   ; enable Set/Reset where colors match
                   2718: 
                   2719: sob_exit:
                   2720:         retn
                   2721: 
                   2722: IFNDEF  GMB_2_FETCH_POSSIBLE
                   2723: 
                   2724: ;*****************************************************************************
                   2725: ;
                   2726: ;   We claim that when we are displaying a glyph image plus bits saved in the
                   2727: ;   memory buffer, we will never need to fetch 2 bytes from the current glyph
                   2728: ;   because we will never need more than 8 bits from the current glyph.
                   2729: ;
                   2730: ;*****************************************************************************
                   2731: 
                   2732: xgi2_scrn_gmb::
                   2733: 
                   2734: if      DBG
                   2735:         int     3
                   2736: endif;  DBG
                   2737: 
                   2738:         retn
                   2739: 
                   2740: ELSE    ;GMB_2_FETCH_POSSIBLE
                   2741: 
                   2742: ;---------------------------Private-Routine------------------------------;
                   2743: ; xgi2_scrn_gmb_xbos
                   2744: ;
                   2745: ;   Draw a glyph to the reserved memory area.
                   2746: ;
                   2747: ; History:
                   2748: ;   Thu 18-Jul-1991 13:10:27 -by- Viroon Touranachun [viroont]
                   2749: ;   Created.
                   2750: ;-----------------------------------------------------------------------;
                   2751: 
                   2752:         ALIGN 4
                   2753: xgi2_scrn_gmb_xbos_1scrn::
                   2754:         mov     pfnFirstByte,offset FLAT:xgi_1st_byte
                   2755: 
                   2756:         ALIGN 4
                   2757: xgi2_scrn_gmb_xbos::
                   2758:         mov     eax,cLeadScan
                   2759:         mov     edx,pjImage             ; access bits saved in buffer
                   2760:         mov     edi,pjScreen            ; we will output to screen
                   2761:         mov     eax,xsgmb2_xbos_dispatch[eax*4] ; start at the correct location
                   2762:         push    eax
                   2763:         mov     eax,cScanBlock          ; Number of scan blocks to draw
                   2764:         shl     eax,16                  ; put count in high word of EAX
                   2765:                                         ; ***64K scan lines max***
                   2766:         mov     ebx,ulNextScan          ; distance from one screen scan to next
                   2767:         push    ebp                     ; remember stack frame pointer
                   2768:         mov     ebp,cjBytes             ; distance to next glyph scan
                   2769:                                         ; ***stack frame not available***
                   2770:         retn                            ; branch into unrolled loop
                   2771: 
                   2772:         ALIGN 4
                   2773: xsgmb2_xbos_loop8:
                   2774:         mov     ax,[esi]                ; get the glyph byte
                   2775:         add     esi,ebp                 ; Next line of glyph
                   2776:         rol     ax,cl                   ; Put usable glyph data in place
                   2777:         and     al,ch
                   2778:         or      al,[edx]
                   2779:         jz      short @F
                   2780:         xchg    [edi],al
                   2781: @@:
                   2782:         add     edi,ebx                 ; point to next screen scan
                   2783: 
                   2784: xsgmb2_xbos_loop7:
                   2785:         mov     ax,[esi]                ; get the glyph byte
                   2786:         add     esi,ebp                 ; Next line of glyph
                   2787:         rol     ax,cl                   ; Put usable glyph data in place
                   2788:         and     al,ch
                   2789:         or      al,[edx][1]
                   2790:         jz      short @F
                   2791:         xchg    [edi],al
                   2792: @@:
                   2793:         add     edi,ebx                 ; point to next screen scan
                   2794: 
                   2795: xsgmb2_xbos_loop6:
                   2796:         mov     ax,[esi]                ; get the glyph byte
                   2797:         add     esi,ebp                 ; Next line of glyph
                   2798:         rol     ax,cl                   ; Put usable glyph data in place
                   2799:         and     al,ch
                   2800:         or      al,[edx][2]
                   2801:         jz      short @F
                   2802:         xchg    [edi],al
                   2803: @@:
                   2804:         add     edi,ebx                 ; point to next screen scan
                   2805: 
                   2806: xsgmb2_xbos_loop5:
                   2807:         mov     ax,[esi]                ; get the glyph byte
                   2808:         add     esi,ebp                 ; Next line of glyph
                   2809:         rol     ax,cl                   ; Put usable glyph data in place
                   2810:         and     al,ch
                   2811:         or      al,[edx][3]
                   2812:         jz      short @F
                   2813:         xchg    [edi],al
                   2814: @@:
                   2815:         add     edi,ebx                 ; point to next screen scan
                   2816:         add     edx,4
                   2817: 
                   2818: xsgmb2_xbos_loop4:
                   2819:         mov     ax,[esi]                ; get the glyph byte
                   2820:         add     esi,ebp                 ; Next line of glyph
                   2821:         rol     ax,cl                   ; Put usable glyph data in place
                   2822:         and     al,ch
                   2823:         or      al,[edx]
                   2824:         jz      short @F
                   2825:         xchg    [edi],al
                   2826: @@:
                   2827:         add     edi,ebx                 ; point to next screen scan
                   2828: 
                   2829: xsgmb2_xbos_loop3:
                   2830:         mov     ax,[esi]                ; get the glyph byte
                   2831:         add     esi,ebp                 ; Next line of glyph
                   2832:         rol     ax,cl                   ; Put usable glyph data in place
                   2833:         and     al,ch
                   2834:         or      al,[edx][1]
                   2835:         jz      short @F
                   2836:         xchg    [edi],al
                   2837: @@:
                   2838:         add     edi,ebx                 ; point to next screen scan
                   2839: 
                   2840: xsgmb2_xbos_loop2:
                   2841:         mov     ax,[esi]                ; get the glyph byte
                   2842:         add     esi,ebp                 ; Next line of glyph
                   2843:         rol     ax,cl                   ; Put usable glyph data in place
                   2844:         and     al,ch
                   2845:         or      al,[edx][2]
                   2846:         jz      short @F
                   2847:         xchg    [edi],al
                   2848: @@:
                   2849:         add     edi,ebx                 ; point to next screen scan
                   2850: 
                   2851: xsgmb2_xbos_loop1:
                   2852:         mov     ax,[esi]                ; get the glyph byte
                   2853:         add     esi,ebp                 ; Next line of glyph
                   2854:         rol     ax,cl                   ; Put usable glyph data in place
                   2855:         and     al,ch
                   2856:         or      al,[edx][3]
                   2857:         jz      short @F
                   2858:         xchg    [edi],al
                   2859: @@:
                   2860:         add     edi,ebx                 ; point to next screen scan
                   2861:         add     edx,4
                   2862: 
                   2863:         and     eax,0ffff0000h
                   2864:         sub     eax,000010000h
                   2865:         jnz     short xsgmb2_xbos_loop8 ; finish column
                   2866: 
                   2867:         pop     ebp                     ; ***stack frame available***
                   2868: 
                   2869: xsgmb2_xbos_update_ptr:
                   2870:         inc     pjScreen                ; advance screen ptr
                   2871:         inc     pjGlyph                 ; always advance glyph ptr for 2 bytes
                   2872: 
                   2873:         retn
                   2874: 
                   2875: 
                   2876: ;---------------------------Private-Routine------------------------------;
                   2877: ; xgi2_scrn_gmb_obos
                   2878: ;
                   2879: ;   Draw a masked opaque glyph bytes (2-fetch) and bits from reserved
                   2880: ;   memory area with opaque background to screen.
                   2881: ;
                   2882: ; History:
                   2883: ;   Thu 18-Jul-1991 13:10:27 -by- Viroon Touranachun [viroont]
                   2884: ;   Created.
                   2885: ;-----------------------------------------------------------------------;
                   2886: 
                   2887:         ALIGN 4
                   2888: xgi2_scrn_gmb_obos::
                   2889:         mov     eax,cLeadScan
                   2890:         mov     edx,pjImage             ; along with bits saved in buffer
                   2891:         mov     edi,pjScreen            ; we are displaying the glyph
                   2892:         mov     eax,xsgmb2_obos_dispatch[eax*4]; start at the correct location
                   2893:         push    eax
                   2894:         mov     eax,cScanBlock          ; Number of scan blocks to draw
                   2895:         shl     eax,16                  ; put count in high word of EAX
                   2896:                                         ; ***64K scan lines max***
                   2897:         mov     ebx,ulNextScan          ; distance from one screen scan to next
                   2898:         push    ebp                     ; remember stack frame pointer
                   2899:         mov     ebp,cjBytes             ; distance to next glyph scan
                   2900:                                         ; ***stack frame not available***
                   2901:         retn                            ; branch into unrolled loop
                   2902: 
                   2903:         ALIGN 4
                   2904: xsgmb2_obos_loop8:
                   2905:         mov     ax,[esi]
                   2906:         add     esi,ebp                 ; Next line of glyph
                   2907:         rol     ax,cl                   ; Put usable glyph data in place
                   2908:         and     al,ch
                   2909:         or      al,[edx]
                   2910:         mov     [edi],al
                   2911:         add     edi,ebx                 ; point to next screen scan
                   2912: 
                   2913: xsgmb2_obos_loop7:
                   2914:         mov     ax,[esi]
                   2915:         add     esi,ebp                 ; Next line of glyph
                   2916:         rol     ax,cl                   ; Put usable glyph data in place
                   2917:         and     al,ch
                   2918:         or      al,[edx][1]
                   2919:         mov     [edi],al
                   2920:         add     edi,ebx                 ; point to next screen scan
                   2921: 
                   2922: xsgmb2_obos_loop6:
                   2923:         mov     ax,[esi]
                   2924:         add     esi,ebp                 ; Next line of glyph
                   2925:         rol     ax,cl                   ; Put usable glyph data in place
                   2926:         and     al,ch
                   2927:         or      al,[edx][2]
                   2928:         mov     [edi],al
                   2929:         add     edi,ebx                 ; point to next screen scan
                   2930: 
                   2931: xsgmb2_obos_loop5:
                   2932:         mov     ax,[esi]
                   2933:         add     esi,ebp                 ; Next line of glyph
                   2934:         rol     ax,cl                   ; Put usable glyph data in place
                   2935:         and     al,ch
                   2936:         or      al,[edx][3]
                   2937:         mov     [edi],al
                   2938:         add     edi,ebx                 ; point to next screen scan
                   2939:         add     edx,4
                   2940: 
                   2941: xsgmb2_obos_loop4:
                   2942:         mov     ax,[esi]
                   2943:         add     esi,ebp                 ; Next line of glyph
                   2944:         rol     ax,cl                   ; Put usable glyph data in place
                   2945:         and     al,ch
                   2946:         or      al,[edx]
                   2947:         mov     [edi],al
                   2948:         add     edi,ebx                 ; point to next screen scan
                   2949: 
                   2950: xsgmb2_obos_loop3:
                   2951:         mov     ax,[esi]
                   2952:         add     esi,ebp                 ; Next line of glyph
                   2953:         rol     ax,cl                   ; Put usable glyph data in place
                   2954:         and     al,ch
                   2955:         or      al,[edx][1]
                   2956:         mov     [edi],al
                   2957:         add     edi,ebx                 ; point to next screen scan
                   2958: 
                   2959: xsgmb2_obos_loop2:
                   2960:         mov     ax,[esi]
                   2961:         add     esi,ebp                 ; Next line of glyph
                   2962:         rol     ax,cl                   ; Put usable glyph data in place
                   2963:         and     al,ch
                   2964:         or      al,[edx][2]
                   2965:         mov     [edi],al
                   2966:         add     edi,ebx                 ; point to next screen scan
                   2967: 
                   2968: xsgmb2_obos_loop1:
                   2969:         mov     ax,[esi]
                   2970:         add     esi,ebp                 ; Next line of glyph
                   2971:         rol     ax,cl                   ; Put usable glyph data in place
                   2972:         and     al,ch
                   2973:         or      al,[edx][3]
                   2974:         mov     [edi],al
                   2975:         add     edi,ebx                 ; point to next screen scan
                   2976:         add     edx,4
                   2977: 
                   2978:         and     eax,0ffff0000h
                   2979:         sub     eax,000010000h
                   2980:         jnz     short xsgmb2_obos_loop8 ; finish column
                   2981: 
                   2982:         pop     ebp                     ; ***stack frame available***
                   2983: 
                   2984: xsgmb2_obos_update_ptr:
                   2985:         inc     pjScreen                ; advance screen ptr
                   2986:         inc     pjGlyph                 ; always advance glyph ptr for 2 bytes
                   2987: 
                   2988: xsgmb2_obos_exit:
                   2989:         retn
                   2990: 
                   2991: ;---------------------------Private-Routine------------------------------;
                   2992: ; xgi2_scrn_gmb_obos_1st_scrn
                   2993: ;
                   2994: ;   Draw a masked opaque glyph byte (2-fetch) and bits in reserved buffer
                   2995: ;   with opaque background to the 1st screen byte.
                   2996: ;
                   2997: ; History:
                   2998: ;   Thu 18-Jul-1991 13:10:27 -by- Viroon Touranachun [viroont]
                   2999: ;   Created.
                   3000: ;-----------------------------------------------------------------------;
                   3001: 
                   3002:         ALIGN 4
                   3003: xgi2_scrn_gmb_obos_1scrn::
                   3004:         mov     pfnFirstByte,offset FLAT:xgi_1st_byte
                   3005: 
                   3006: ; Here we need to setup the bitmask including those in buffer. It can be
                   3007: ; calculated here from the x starting point.
                   3008: 
                   3009:         ALIGN 4
                   3010: xgmb2_obos_1scrn_bitmask:
                   3011:         xor     bh,bh                   ; we use and clear
                   3012:         xchg    bh,fjOBOSMask           ; the acculmulated mask
                   3013:         or      bh,ch                   ; also include the current mask
                   3014:         jns     short xsgmb2_call_obos_edge  ; there is really a mask
                   3015:         call    xgi_set_opaque_bkgnd    ; no mask, treat it as a full byte
                   3016:         jmp     xgi2_scrn_gmb_obos
                   3017: 
                   3018: xsgmb2_call_obos_edge:
                   3019:         call    xsgmb2_obos_edge
                   3020:         jmp     xgi_set_opaque_bkgnd_test_full_byte
                   3021: 
                   3022: ;---------------------------Private-Routine------------------------------;
                   3023: ; xgi2_scrn_gmb_obos_last_glyph
                   3024: ;
                   3025: ;   Draw a masked opaque byte from the last glyph (2-fetch) and bits in
                   3026: ;   reserved buffer with opaque background to the screen.
                   3027: ;
                   3028: ; History:
                   3029: ;   Thu 18-Jul-1991 13:10:27 -by- Viroon Touranachun [viroont]
                   3030: ;   Created.
                   3031: ;-----------------------------------------------------------------------;
                   3032: 
                   3033:         ALIGN 4
                   3034: xgi2_scrn_gmb_obos_lg::
                   3035:         xor     bh,bh
                   3036:         xchg    bh,fjOBOSMask           ; use and clear the accumulated mask
                   3037:         or      bh,ch                   ; plus the current mask
                   3038:         inc     bh                      ; if mask is all 1s
                   3039:         jnz     short @F
                   3040:         call    xgi_set_opaque_bkgnd    ; treat it as a full byte
                   3041:         jmp     xgi2_scrn_gmb_obos
                   3042: @@:
                   3043:         dec     bh
                   3044:         call    xsgmb2_obos_edge        ; draw this first byte
                   3045:         cmp     cInnerBytes,0           ; last glyph has full middle bytes?
                   3046:         jz      short @F                ; no, then get out
                   3047:         call    xgi_set_opaque_bkgnd    ; set the full byte
                   3048: @@:
                   3049:         retn
                   3050: 
                   3051: ;---------------------------Private-Routine------------------------------;
                   3052: ; xgi2_scrn_gmb_obos_edge
                   3053: ;
                   3054: ;   Draw a masked opaque byte from the glyph (2-fetch) and bits in
                   3055: ;   reserved buffer with opaque background to the screen.
                   3056: ;
                   3057: ; History:
                   3058: ;   Thu 18-Jul-1991 13:10:27 -by- Viroon Touranachun [viroont]
                   3059: ;   Created.
                   3060: ;-----------------------------------------------------------------------;
                   3061: 
                   3062:         ALIGN 4
                   3063: xsgmb2_obos_edge:
                   3064:         xchg    bh,ch                   ; set with the accumulated mask
                   3065:         call    xgi_setup_opaque_bkgnd_edge
                   3066:         xchg    bh,ch                   ; restore the current byte mask
                   3067: 
                   3068: ; The following AND leaves 1 bits in AH for the planes which
                   3069: ; CANNOT be done on the second pass.  So if this is zero we can
                   3070: ; skip the first pass.
                   3071: 
                   3072:         and     ah,bl                   ; BL = BkColor = color where data is 1
                   3073:         or      ah,bl                   ; planes to enable
                   3074:         jz      xsgmbe2_obos_skip_first_pass
                   3075:         or      al,ah                   ; Include "Set/Reset" planes.
                   3076:         out     dx,al                   ; Enable planes for first pass.
                   3077: 
                   3078:         push    eax
                   3079:         mov     ebx,cScan
                   3080:         mov     edx,pjImage
                   3081:         add     edx,cBufferOffset
                   3082: 
                   3083:         ALIGN 4
                   3084: xsgmbe2_obos_first_pass:
                   3085:         mov     ax,[esi]
                   3086:         rol     ax,cl                   ; Put usable glyph data in place
                   3087:         and     al,ch
                   3088:         or      al,[edx]
                   3089:         xchg    al,[edi]
                   3090:         add     esi,cjBytes
                   3091:         add     edi,ulNextScan
                   3092:         inc     edx
                   3093:         dec     ebx
                   3094:         jnz     short xsgmbe2_obos_first_pass
                   3095: 
                   3096:         pop     eax
                   3097:         mov     esi,pjGlyph             ; restore the glyph pointer
                   3098:         mov     edi,pjScreen            ; restore the screen pointer
                   3099:         mov     dx,VGA_BASE + SEQ_DATA  ; The rest of the OUTs are here.
                   3100: 
                   3101:         ALIGN 4
                   3102: xsgmbe2_obos_skip_first_pass:
                   3103: 
                   3104: ; Enable the other planes.
                   3105: 
                   3106:         not     ah
                   3107:         and     ah,MM_ALL
                   3108:         jz      short xsgmbe2_obos_no_planes_left
                   3109:         mov     al,ah
                   3110:         out     dx,al
                   3111:         mov     ebx,cScan
                   3112:         mov     edx,pjImage
                   3113:         add     edx,cBufferOffset
                   3114: 
                   3115:         ALIGN 4
                   3116: xsgmbe2_obos_second_pass:
                   3117:         mov     ax,[esi]
                   3118:         rol     ax,cl                   ; Put usable glyph data in place
                   3119:         and     al,ch
                   3120:         or      al,[edx]
                   3121:         not     al
                   3122:         xchg    al,[edi]
                   3123:         add     esi,cjBytes
                   3124:         add     edi,ulNextScan
                   3125:         inc     edx
                   3126:         dec     ebx
                   3127:         jnz     short xsgmbe2_obos_second_pass
                   3128:         mov     dx,VGA_BASE + SEQ_DATA  ; The rest of the OUTs are here.
                   3129: 
                   3130: xsgmbe2_obos_no_planes_left:
                   3131:         mov     al,MM_ALL
                   3132:         out     dx,al
                   3133: 
                   3134: xsgmbe2_obos_exit:
                   3135:         inc     pjScreen                ; advance the display ptr
                   3136:         inc     pjGlyph                 ; always advance glyph ptr for 2 bytes
                   3137:         retn
                   3138: 
                   3139: ENDIF   ;GMB_2_FETCH_POSSIBLE
                   3140: 
                   3141:         ALIGN   4
                   3142: 
                   3143: xgi_1st_byte_1st_scrn   equ this dword              ;FG  SB LMB OB  MS  2F
                   3144:         dd  offset FLAT:xgi1_scrn_g_xbos_1scrn      ; 0   0  0   0   0  0
                   3145:         dd  offset FLAT:xgi2_scrn_g_xbos_1scrn      ; 0   0  0   0   0  1
                   3146:         dd  offset FLAT:xgi1_scrn_g_xbms_1scrn      ; 0   0  0   0   1  0
                   3147:         dd  offset FLAT:xgi2_scrn_g_xbms_1scrn      ; 0   0  0   0   1  1
                   3148:         dd  offset FLAT:xgi1_scrn_g_obos_1scrn      ; 0   0  0   1   0  0
                   3149:         dd  offset FLAT:xgi2_scrn_g_obos_1scrn      ; 0   0  0   1   0  1
                   3150:         dd  offset FLAT:xgi1_scrn_g_obos_1scrn      ; 0   0  0   1   1  0
                   3151:         dd  offset FLAT:xgi2_scrn_g_obos_1scrn      ; 0   0  0   1   1  1
                   3152:         dd  offset FLAT:xgi1_scrn_gmb_xbos_1scrn    ; 0   0  1   0   0  0
                   3153:         dd  offset FLAT:xgi2_scrn_gmb               ; 0   0  1   0   0  1
                   3154:         dd  offset FLAT:xgi1_scrn_gmb_xbms_1scrn    ; 0   0  1   0   1  0
                   3155:         dd  offset FLAT:xgi2_scrn_gmb               ; 0   0  1   0   1  1
                   3156:         dd  offset FLAT:xgi1_scrn_gmb_obos_1scrn    ; 0   0  1   1   0  0
                   3157:         dd  offset FLAT:xgi2_scrn_gmb               ; 0   0  1   1   0  1
                   3158:         dd  offset FLAT:xgi1_scrn_gmb_obos_1scrn    ; 0   0  1   1   1  0
                   3159:         dd  offset FLAT:xgi2_scrn_gmb               ; 0   0  1   1   1  1
                   3160:         dd  offset FLAT:xgi1_buffer_or              ; 0   1  0   0   0  0
                   3161:         dd  offset FLAT:xgi2_buffer_or              ; 0   1  0   0   0  1
                   3162:         dd  offset FLAT:xgi1_buffer_or              ; 0   1  0   0   1  0
                   3163:         dd  offset FLAT:xgi2_buffer_or              ; 0   1  0   0   1  1
                   3164:         dd  offset FLAT:xgi1_buffer_or_obos         ; 0   1  0   1   0  0
                   3165:         dd  offset FLAT:xgi2_buffer_or_obos         ; 0   1  0   1   0  1
                   3166:         dd  offset FLAT:xgi1_buffer_or_obos         ; 0   1  0   1   1  0
                   3167:         dd  offset FLAT:xgi2_buffer_or_obos         ; 0   1  0   1   1  1
                   3168:         dd  offset FLAT:xgi1_buffer_or              ; 0   1  1   0   0  0
                   3169:         dd  offset FLAT:xgi2_buffer_or              ; 0   1  1   0   0  1
                   3170:         dd  offset FLAT:xgi1_buffer_or              ; 0   1  1   0   1  0
                   3171:         dd  offset FLAT:xgi2_buffer_or              ; 0   1  1   0   1  1
                   3172:         dd  offset FLAT:xgi1_buffer_or_obos         ; 0   1  1   1   0  0
                   3173:         dd  offset FLAT:xgi2_buffer_or_obos         ; 0   1  1   1   0  1
                   3174:         dd  offset FLAT:xgi1_buffer_or_obos         ; 0   1  1   1   1  0
                   3175:         dd  offset FLAT:xgi2_buffer_or_obos         ; 0   1  1   1   1  1
                   3176:         dd  offset FLAT:xgi1_scrn_g_xbos_1scrn      ; 1   0  0   0   0  0
                   3177:         dd  offset FLAT:xgi2_scrn_g_xbos_1scrn      ; 1   0  0   0   0  1
                   3178:         dd  offset FLAT:xgi1_scrn_g_xbms_1scrn      ; 1   0  0   0   1  0
                   3179:         dd  offset FLAT:xgi2_scrn_g_xbms_1scrn      ; 1   0  0   0   1  1
                   3180:         dd  offset FLAT:xgi1_scrn_g_obos_1scrn      ; 1   0  0   1   0  0
                   3181:         dd  offset FLAT:xgi2_scrn_g_obos_1scrn      ; 1   0  0   1   0  1
                   3182:         dd  offset FLAT:xgi1_scrn_g_obos_1scrn      ; 1   0  0   1   1  0
                   3183:         dd  offset FLAT:xgi2_scrn_g_obos_1scrn      ; 1   0  0   1   1  1
                   3184:         dd  offset FLAT:xgi1_scrn_gm_xbos_1scrn     ; 1   0  1   0   0  0
                   3185:         dd  offset FLAT:xgi2_scrn_gm_xbos_1scrn     ; 1   0  1   0   0  1
                   3186:         dd  offset FLAT:xgi1_scrn_gm_xbms_1scrn     ; 1   0  1   0   1  0
                   3187:         dd  offset FLAT:xgi2_scrn_gm_xbms_1scrn     ; 1   0  1   0   1  1
                   3188:         dd  offset FLAT:xgi1_scrn_gm_obos_1scrn     ; 1   0  1   1   0  0
                   3189:         dd  offset FLAT:xgi2_scrn_gm_obos_1scrn     ; 1   0  1   1   0  1
                   3190:         dd  offset FLAT:xgi1_scrn_gm_obos_1scrn     ; 1   0  1   1   1  0
                   3191:         dd  offset FLAT:xgi2_scrn_gm_obos_1scrn     ; 1   0  1   1   1  1
                   3192:         dd  offset FLAT:xgi1_buffer_over            ; 1   1  0   0   0  0
                   3193:         dd  offset FLAT:xgi2_buffer_over            ; 1   1  0   0   0  1
                   3194:         dd  offset FLAT:xgi1_buffer_over            ; 1   1  0   0   1  0
                   3195:         dd  offset FLAT:xgi2_buffer_over            ; 1   1  0   0   1  1
                   3196:         dd  offset FLAT:xgi1_buffer_over_obos       ; 1   1  0   1   0  0
                   3197:         dd  offset FLAT:xgi2_buffer_over_obos       ; 1   1  0   1   0  1
                   3198:         dd  offset FLAT:xgi1_buffer_over_obos       ; 1   1  0   1   1  0
                   3199:         dd  offset FLAT:xgi2_buffer_over_obos       ; 1   1  0   1   1  1
                   3200:         dd  offset FLAT:xgi1_buffer_over            ; 1   1  1   0   0  0
                   3201:         dd  offset FLAT:xgi2_buffer_over            ; 1   1  1   0   0  1
                   3202:         dd  offset FLAT:xgi1_buffer_over            ; 1   1  1   0   1  0
                   3203:         dd  offset FLAT:xgi2_buffer_over            ; 1   1  1   0   1  1
                   3204:         dd  offset FLAT:xgi1_buffer_over_obos       ; 1   1  1   1   0  0
                   3205:         dd  offset FLAT:xgi2_buffer_over_obos       ; 1   1  1   1   0  1
                   3206: ;       dd  offset FLAT:xgi1_buffer_over_obos       ; 1   1  1   1   1  0
                   3207: ;       dd  offset FLAT:xgi2_buffer_over_obos       ; 1   1  1   1   1  1
                   3208: 
                   3209: xgi_1st_byte    equ this dword                      ;SB LMB OB  MS  2F
                   3210:         dd  offset FLAT:xgi1_scrn_g_xbos            ; 0  0   0   0  0
                   3211:         dd  offset FLAT:xgi2_scrn_g_xbos            ; 0  0   0   0  1
                   3212:         dd  offset FLAT:xgi1_scrn_g_xbms            ; 0  0   0   1  0
                   3213:         dd  offset FLAT:xgi2_scrn_g_xbms            ; 0  0   0   1  1
                   3214:         dd  offset FLAT:xgi1_scrn_g_obos            ; 0  0   1   0  0
                   3215:         dd  offset FLAT:xgi2_scrn_g_obos            ; 0  0   1   0  1
                   3216:         dd  offset FLAT:xgi1_scrn_g_obos            ; 0  0   1   1  0
                   3217:         dd  offset FLAT:xgi2_scrn_g_obos            ; 0  0   1   1  1
                   3218:         dd  offset FLAT:xgi1_scrn_gmb_xbos          ; 0  1   0   0  0
                   3219:         dd  offset FLAT:xgi2_scrn_gmb               ; 0  1   0   0  1
                   3220:         dd  offset FLAT:xgi1_scrn_gmb_xbms          ; 0  1   0   1  0
                   3221:         dd  offset FLAT:xgi2_scrn_gmb               ; 0  1   0   1  1
                   3222:         dd  offset FLAT:xgi1_scrn_gmb_obos          ; 0  1   1   0  0
                   3223:         dd  offset FLAT:xgi2_scrn_gmb               ; 0  1   1   0  1
                   3224:         dd  offset FLAT:xgi1_scrn_gmb_obos          ; 0  1   1   1  0
                   3225:         dd  offset FLAT:xgi2_scrn_gmb               ; 0  1   1   1  1
                   3226:         dd  offset FLAT:xgi1_buffer_over            ; 1  0   0   0  0
                   3227:         dd  offset FLAT:xgi2_buffer_over            ; 1  0   0   0  1
                   3228:         dd  offset FLAT:xgi1_buffer_over            ; 1  0   0   1  0
                   3229:         dd  offset FLAT:xgi2_buffer_over            ; 1  0   0   1  1
                   3230:         dd  offset FLAT:xgi1_buffer_over_obos       ; 1  0   1   0  0
                   3231:         dd  offset FLAT:xgi2_buffer_over_obos       ; 1  0   1   0  1
                   3232:         dd  offset FLAT:xgi1_buffer_over_obos       ; 1  0   1   1  0
                   3233:         dd  offset FLAT:xgi2_buffer_over_obos       ; 1  0   1   1  1
                   3234:         dd  offset FLAT:xgi1_buffer_or              ; 1  1   0   0  0
                   3235:         dd  offset FLAT:xgi2_buffer_or              ; 1  1   0   0  1
                   3236:         dd  offset FLAT:xgi1_buffer_or              ; 1  1   0   1  0
                   3237:         dd  offset FLAT:xgi2_buffer_or              ; 1  1   0   1  1
                   3238:         dd  offset FLAT:xgi1_buffer_or_obos         ; 1  1   1   0  0
                   3239:         dd  offset FLAT:xgi2_buffer_or_obos         ; 1  1   1   0  1
                   3240: ;       dd  offset FLAT:xgi1_buffer_or_obos         ; 1  1   1   1  0
                   3241: ;       dd  offset FLAT:xgi2_buffer_or_obos         ; 1  1   1   1  1
                   3242: 
                   3243: xgi_1st_byte_last_glyph equ this dword              ;LMB OB MS  2F
                   3244:         dd  offset FLAT:xgi1_scrn_gm_xbos           ; 0   0  0  0
                   3245:         dd  offset FLAT:xgi2_scrn_gm_xbos           ; 0   0  0  1
                   3246:         dd  offset FLAT:xgi1_scrn_gm_xbms           ; 0   0  1  0
                   3247:         dd  offset FLAT:xgi2_scrn_gm_xbms           ; 0   0  1  1
                   3248:         dd  offset FLAT:xgi1_scrn_gm_obos_lg        ; 0   1  0  0
                   3249:         dd  offset FLAT:xgi2_scrn_gm_obos_lg        ; 0   1  0  1
                   3250:         dd  offset FLAT:xgi1_scrn_gm_obos_lg        ; 0   1  1  0
                   3251:         dd  offset FLAT:xgi2_scrn_gm_obos_lg        ; 0   1  1  1
                   3252:         dd  offset FLAT:xgi1_scrn_gmb_xbos          ; 1   0  0  0
                   3253:         dd  offset FLAT:xgi2_scrn_gmb               ; 1   0  0  1
                   3254:         dd  offset FLAT:xgi1_scrn_gmb_xbms          ; 1   0  1  0
                   3255:         dd  offset FLAT:xgi2_scrn_gmb               ; 1   0  1  1
                   3256:         dd  offset FLAT:xgi1_scrn_gmb_obos_lg       ; 1   1  0  0
                   3257:         dd  offset FLAT:xgi2_scrn_gmb               ; 1   1  0  1
                   3258:         dd  offset FLAT:xgi1_scrn_gmb_obos_lg       ; 1   1  1  0
                   3259: ;       dd  offset FLAT:xgi2_scrn_gmb               ; 1   1  1  1
                   3260: 
                   3261: xgi_middle_byte_table   equ this dword              ;OB  MS  2F
                   3262:         dd  offset FLAT:xgi1_scrn_g_xbos            ; 0   0   0
                   3263:         dd  offset FLAT:xgi2_scrn_g_xbos            ; 0   0   1
                   3264:         dd  offset FLAT:xgi1_scrn_g_xbms            ; 0   1   0
                   3265:         dd  offset FLAT:xgi2_scrn_g_xbms            ; 0   1   1
                   3266:         dd  offset FLAT:xgi1_scrn_g_obos            ; 1   0   0
                   3267:         dd  offset FLAT:xgi2_scrn_g_obos            ; 1   0   1
                   3268: ;       dd  offset FLAT:xgi1_scrn_g_obos            ; 1   1   0
                   3269: ;       dd  offset FLAT:xgi2_scrn_g_obos            ; 1   1   1
                   3270: 
                   3271: xgi_middle_bytes_table   equ this dword             ;OB  MS  2F
                   3272:         dd  offset FLAT:xgi1_scrn_gs_xbos           ; 0   0   0
                   3273:         dd  offset FLAT:xgi2_scrn_gs_xbos           ; 0   0   1
                   3274:         dd  offset FLAT:xgi1_scrn_gs_xbms           ; 0   1   0
                   3275:         dd  offset FLAT:xgi2_scrn_gs_xbms           ; 0   1   1
                   3276:         dd  offset FLAT:xgi1_scrn_gs_obos           ; 1   0   0
                   3277:         dd  offset FLAT:xgi2_scrn_gs_obos           ; 1   0   1
                   3278: ;       dd  offset FLAT:xgi1_scrn_gs_obos           ; 1   1   0
                   3279: ;       dd  offset FLAT:xgi2_scrn_gs_obos           ; 1   1   1
                   3280: 
                   3281: xgi_last_byte_table     equ this dword              ;OB  MS  2F
                   3282:         dd  offset FLAT:xgi1_buffer_over            ; 0   0  0
                   3283:         dd  offset FLAT:xgi2_buffer_over            ; 0   0  1
                   3284:         dd  offset FLAT:xgi1_buffer_over            ; 0   1  0
                   3285:         dd  offset FLAT:xgi2_buffer_over            ; 0   1  1
                   3286:         dd  offset FLAT:xgi1_buffer_over_obos       ; 1   0  0
                   3287:         dd  offset FLAT:xgi2_buffer_over_obos       ; 1   0  1
                   3288: ;       dd  offset FLAT:xgi1_buffer_over_obos       ; 1   1  0
                   3289: ;       dd  offset FLAT:xgi2_buffer_over_obos       ; 1   1  1
                   3290: 
                   3291: xgi_last_byte_last_glyph    equ this dword          ;LMB OB  MS  2F
                   3292:         dd  offset FLAT:xgi1_scrn_gm_xbos           ; 0   0   0  0
                   3293:         dd  offset FLAT:xgi2_scrn_gm_xbos           ; 0   0   0  1
                   3294:         dd  offset FLAT:xgi1_scrn_gm_xbms           ; 0   0   1  0
                   3295:         dd  offset FLAT:xgi2_scrn_gm_xbms           ; 0   0   1  1
                   3296:         dd  offset FLAT:xgi1_scrn_gm_obos           ; 0   1   0  0
                   3297:         dd  offset FLAT:xgi2_scrn_gm_obos           ; 0   1   0  1
                   3298:         dd  offset FLAT:xgi1_scrn_gm_obos           ; 0   1   1  0
                   3299:         dd  offset FLAT:xgi2_scrn_gm_obos           ; 0   1   1  1
                   3300:         dd  offset FLAT:xgi1_scrn_gm_xbos           ; 1   0   0  0
                   3301:         dd  offset FLAT:xgi2_scrn_gm_xbos           ; 1   0   0  1
                   3302:         dd  offset FLAT:xgi1_scrn_gm_xbms           ; 1   0   1  0
                   3303:         dd  offset FLAT:xgi2_scrn_gm_xbms           ; 1   0   1  1
                   3304:         dd  offset FLAT:xgi1_scrn_gm_obos           ; 1   1   0  0
                   3305:         dd  offset FLAT:xgi2_scrn_gm_obos           ; 1   1   0  1
                   3306: ;       dd  offset FLAT:xgi1_scrn_gm_obos           ; 1   1   1  0
                   3307: ;       dd  offset FLAT:xgi2_scrn_gm_obos           ; 1   1   1  1
                   3308: 
                   3309: xgi_buffer_offset   equ     this dword
                   3310:         db      0
                   3311:         db      3
                   3312:         db      2
                   3313:         db      1
                   3314:         db      0
                   3315:         db      3
                   3316:         db      2
                   3317:         db      1
                   3318: 
                   3319: loop_table      macro   name
                   3320: 
                   3321:         dd      offset FLAT:&name&_loop8
                   3322:         dd      offset FLAT:&name&_loop1
                   3323:         dd      offset FLAT:&name&_loop2
                   3324:         dd      offset FLAT:&name&_loop3
                   3325:         dd      offset FLAT:&name&_loop4
                   3326:         dd      offset FLAT:&name&_loop5
                   3327:         dd      offset FLAT:&name&_loop6
                   3328:         dd      offset FLAT:&name&_loop7
                   3329: 
                   3330:         endm
                   3331: 
                   3332: xgi1_fob_over   equ this dword
                   3333:         loop_table  xgi_fetch_one_byte_over
                   3334: 
                   3335: xgi2_ftb_over   equ this dword
                   3336:         loop_table  xgi_fetch_two_bytes_over
                   3337: 
                   3338: xgi1_fob_or     equ this dword
                   3339:         loop_table  xgi_fetch_one_byte_or
                   3340: 
                   3341: xgi2_ftb_or     equ this dword
                   3342:         loop_table  xgi_fetch_two_bytes_or
                   3343: 
                   3344: xsg1_xbos_dispatch equ this dword
                   3345:         loop_table  xsg1_xbos
                   3346: 
                   3347: xsgmb1_xbos_dispatch equ this dword
                   3348:         loop_table  xsgmb1_xbos
                   3349: 
                   3350: xsg2_xbos_dispatch equ this dword
                   3351:         loop_table  xsg2_xbos
                   3352: 
                   3353: xsg1_obos_dispatch equ this dword
                   3354:         loop_table  xsg1_obos
                   3355: 
                   3356: xsgmb1_obos_dispatch equ this dword
                   3357:         loop_table  xsgmb1_obos
                   3358: 
                   3359: xsg2_obos_dispatch equ this dword
                   3360:         loop_table  xsg2_obos
                   3361: 
                   3362: IFDEF   GMB_2_FETCH_POSSIBLE
                   3363: 
                   3364: xsgmb2_xbos_dispatch equ this dword
                   3365:         loop_table  xsgmb2_xbos
                   3366: 
                   3367: xsgmb2_obos_dispatch equ this dword
                   3368:         loop_table  xsgmb2_obos_loop8
                   3369: 
                   3370: ENDIF   ;GMB_2_FETCH_POSSIBLE
                   3371: 
                   3372: xxxvStringBlt endp
                   3373: 
                   3374: public sblt_glyph_search
                   3375: public sblt_glyph_search_last
                   3376: public sblt_glyph_search_1st
                   3377: public sblt_found_both
                   3378: public sblt_calc_glyph_height
                   3379: public sblt_accel_flag
                   3380: public sblt_special_case
                   3381: public sblt_init_jmp_table
                   3382: ;public sblt_call_vglyphblt
                   3383: public sblt_1st_glyph_cell
                   3384: public sblt_last_glyph_cell
                   3385: public sblt_middle_fpa_glyph
                   3386: public sblt_next_glyph_cell
                   3387: public sblt_left_mask
                   3388: public sblt_one_byte_mask
                   3389: public sblt_inner_count
                   3390: public sblt_last_mask
                   3391: public sblt_glyph_info
                   3392: public sblt_xfer_glyph_image
                   3393: public sblt_exit
                   3394: public xgi_inner_bytes
                   3395: public xgi_last_byte
                   3396: public fixed_pitch_aligned_sblt
                   3397: public fixed_pitch_aligned_sblt_inner
                   3398: public fpa_single_byte_glyph
                   3399: public fpa_multi_byte_glyph
                   3400: public fpa_exit
                   3401: public xgi1_buffer_over
                   3402: public xgi1_buffer_or
                   3403: public xgi2_buffer_over
                   3404: public xgi2_buffer_or
                   3405: public xgi1_scrn_g_obos_1scrn
                   3406: public xgi1_scrn_g_obos
                   3407: public xgi1_scrn_g_xbos_1scrn
                   3408: public xgi1_scrn_g_xbos
                   3409: public xgi1_scrn_g_xbms_1scrn
                   3410: public xgi1_scrn_g_xbms
                   3411: public xgi1_scrn_gs_obos
                   3412: public xgi1_scrn_gs_xbos
                   3413: public xgi1_scrn_gs_xbms
                   3414: public xgi1_scrn_gm_xbos_1scrn
                   3415: public xgi1_scrn_gm_xbos
                   3416: public xgi1_scrn_gm_xbms_1scrn
                   3417: public xgi1_scrn_gm_xbms
                   3418: public xgi1_scrn_gmb_obos_1scrn
                   3419: public xgi1_scrn_gmb_obos
                   3420: public xgi1_scrn_gmb_xbos_1scrn
                   3421: public xgi1_scrn_gmb_xbos
                   3422: public xgi1_scrn_gmb_xbms_1scrn
                   3423: public xgi1_scrn_gmb_xbms
                   3424: public xgi2_scrn_g_obos_1scrn
                   3425: public xgi2_scrn_g_obos
                   3426: public xgi2_scrn_g_xbos_1scrn
                   3427: public xgi2_scrn_g_xbos
                   3428: public xgi2_scrn_g_xbms_1scrn
                   3429: public xgi2_scrn_g_xbms
                   3430: public xgi2_scrn_gs_obos
                   3431: public xgi2_scrn_gs_xbos
                   3432: public xgi2_scrn_gs_xbms
                   3433: public xgi2_scrn_gm_xbos_1scrn
                   3434: public xgi2_scrn_gm_xbos
                   3435: public xgi2_scrn_gm_xbms_1scrn
                   3436: public xgi2_scrn_gm_xbms
                   3437: public xgi1_scrn_gm_obos_1scrn
                   3438: public xgi1_scrn_gm_obos_lg
                   3439: public xgi1_scrn_gm_obos
                   3440: public xgi2_scrn_gm_obos_1scrn
                   3441: public xgi2_scrn_gm_obos_lg
                   3442: public xgi2_scrn_gm_obos
                   3443: public xgi1_scrn_gmb_obos_lg
                   3444: public xgi_setup_opaque_bkgnd_edge
                   3445: public xgi_set_opaque_bkgnd
                   3446: 
                   3447: IFDEF  GMB_2_FETCH_POSSIBLE
                   3448: public xgi2_scrn_gmb_obos_1scrn
                   3449: public xgi2_scrn_gmb_obos
                   3450: public xgi2_scrn_gmb_xbos_1scrn
                   3451: public xgi2_scrn_gmb_xbos
                   3452: public xgi2_scrn_gmb_xbms_1scrn
                   3453: public xgi2_scrn_gmb_xbms
                   3454: public xgi2_scrn_gmb_obos_lg
                   3455: ENDIF  ;GMB_2_FETCH_POSSIBLE
                   3456: 
                   3457:         end
                   3458: 

unix.superglobalmegacorp.com

This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.