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

1.1       root        1: ;---------------------------Module-Header------------------------------;
                      2: ; Module Name: rect.asm
                      3: ;
                      4: ; Rectangle Utilities
                      5: ;
                      6: ; Copyright (c) 1992 Microsoft Corporation
                      7: ;-----------------------------------------------------------------------;
                      8:         .386
                      9: 
                     10: ifndef  DOS_PLATFORM
                     11:         .model  small,c
                     12: else
                     13: ifdef   STD_CALL
                     14:         .model  small,c
                     15: else
                     16:         .model  small,pascal
                     17: endif;  STD_CALL
                     18: endif;  DOS_PLATFORM
                     19: 
                     20:         assume cs:FLAT,ds:FLAT,es:FLAT,ss:FLAT
                     21:         assume fs:nothing,gs:nothing
                     22: 
                     23:         .xlist
                     24:         include stdcall.inc             ;calling convention cmacros
                     25:         include i386\strucs.inc
                     26:         .list
                     27: 
                     28:         .code
                     29: 
                     30: _TEXT$01   SEGMENT DWORD USE32 PUBLIC 'CODE'
                     31:            ASSUME  CS:FLAT, DS:FLAT, ES:FLAT, SS:NOTHING, FS:NOTHING, GS:NOTHING
                     32: 
                     33: ;---------------------------Public-Routine------------------------------;
                     34: ; bIdenticalRect ( pRect1, pRect2 )
                     35: ;
                     36: ;   Compare two rectangles whether they are identical
                     37: ;
                     38: ;-----------------------------------------------------------------------;
                     39: 
                     40: cProc   bIdenticalRect,8,<    \
                     41:         uses      esi edi,    \
                     42:         pRect1:   ptr RECTL,  \
                     43:         pRect2:   ptr RECTL   >
                     44: 
                     45:         cld
                     46:         xor     eax,eax
                     47:         mov     ecx,(size RECTL/4)
                     48:         mov     esi,pRect1
                     49:         mov     edi,pRect2
                     50:         repe    cmpsd
                     51:         setz    al
                     52: 
                     53: bir_exit:
                     54:         cRet    bIdenticalRect
                     55: 
                     56: endProc bIdenticalRect
                     57: 
                     58: ;---------------------------Public-Routine------------------------------;
                     59: ; flClipRect ( pDst, pRect1, pRect2 )
                     60: ;
                     61: ;   Clip the first rectangle with the second one, and put the result
                     62: ;   rectangle in the destination one.
                     63: ;
                     64: ; Return:
                     65: ;       0 if Rect1 is not clipped by Rect2
                     66: ;       1 if Rect1 is horizontally clipped only
                     67: ;       2 if Rect1 is vertically clipped only
                     68: ;       3 if Rect1 is both horizontally and vertically clipped.
                     69: ;
                     70: ;-----------------------------------------------------------------------;
                     71:  
                     72: cProc   flClipRect,12,<            \
                     73:         uses      ebx esi edi,     \
                     74:         pDstRect: ptr RECTL,       \
                     75:         pRect1:   ptr RECTL,       \
                     76:         pRect2:   ptr RECTL        >
                     77: 
                     78: 
                     79:         cld
                     80:         mov     edi,pDstRect
                     81:         mov     esi,pRect1
                     82:         mov     ebx,pRect2
                     83:         push    ebp
                     84:         xor     ebp,ebp             ; assume no clipping required
                     85: 
                     86: bisr_left:
                     87:         lodsd                       ; left of rect1
                     88:         mov     edx,[ebx].xLeft     ; left of rect2
                     89:         cmp     eax,edx             ; clipped if left of rect1 < left of rect2
                     90:         jge     short @F
                     91:         mov     eax,edx             ; clipped left
                     92:         or      ebp,1               ; indicate horizontally clipped
                     93: @@:
                     94:         stosd
                     95: 
                     96: bisr_Top:
                     97:         lodsd                       ; top of rect1
                     98:         mov     edx,[ebx].yTop      ; top of rect2
                     99:         cmp     eax,edx             ; clipped if top of rect1 < top of rect2
                    100:         jge     short @F
                    101:         mov     eax,edx             ; clipped top
                    102:         or      ebp,2               ; indicate vertically clipped
                    103: @@:
                    104:         stosd
                    105: 
                    106: bisr_Right:
                    107:         lodsd                       ; right of rect1
                    108:         mov     edx,[ebx].xRight    ; right of rect2
                    109:         cmp     edx,eax             ; clipped if right of rect1 > right of rect2
                    110:         jge     short @F
                    111:         mov     eax,edx             ; clipped top
                    112:         or      ebp,1               ; indicate horizontally clipped
                    113: @@:
                    114:         stosd
                    115: 
                    116: bisr_Bottom:
                    117:         lodsd                       ; bottom of rect1
                    118:         mov     edx,[ebx].yBottom   ; bottom of rect2
                    119:         cmp     edx,eax             ; clipped if bottom of rect1 > bottom of rect2
                    120:         jge     short @F
                    121:         mov     eax,edx             ; clipped bottom
                    122:         or      ebp,2               ; indicate vertically clipped
                    123: @@:
                    124:         stosd
                    125: 
                    126: bisr_exit:
                    127:         mov     eax,ebp             ; return value
                    128:         pop     ebp
                    129:         cRet    flClipRect
                    130: 
                    131: endProc flClipRect
                    132: 
                    133: _TEXT$01   ends
                    134: 
                    135:         end
                    136: 

unix.superglobalmegacorp.com

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