Annotation of quakeworld/client/surf16.s, revision 1.1

1.1     ! root        1: /*
        !             2: Copyright (C) 1996-1997 Id Software, Inc.
        !             3: 
        !             4: This program is free software; you can redistribute it and/or
        !             5: modify it under the terms of the GNU General Public License
        !             6: as published by the Free Software Foundation; either version 2
        !             7: of the License, or (at your option) any later version.
        !             8: 
        !             9: This program is distributed in the hope that it will be useful,
        !            10: but WITHOUT ANY WARRANTY; without even the implied warranty of
        !            11: MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  
        !            12: 
        !            13: See the GNU General Public License for more details.
        !            14: 
        !            15: You should have received a copy of the GNU General Public License
        !            16: along with this program; if not, write to the Free Software
        !            17: Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
        !            18: 
        !            19: */
        !            20: //
        !            21: // surf16.s
        !            22: // x86 assembly-language 16 bpp surface block drawing code.
        !            23: //
        !            24: 
        !            25: #include "asm_i386.h"
        !            26: #include "quakeasm.h"
        !            27: #include "asm_draw.h"
        !            28: 
        !            29: #if id386
        !            30: 
        !            31: //----------------------------------------------------------------------
        !            32: // Surface block drawer
        !            33: //----------------------------------------------------------------------
        !            34: 
        !            35:        .data
        !            36: 
        !            37: k:                     .long   0
        !            38: loopentry:     .long   0
        !            39: 
        !            40:        .align  4
        !            41: blockjumptable16:
        !            42:        .long   LEnter2_16
        !            43:        .long   LEnter4_16
        !            44:        .long   0, LEnter8_16
        !            45:        .long   0, 0, 0, LEnter16_16
        !            46: 
        !            47: 
        !            48:        .text
        !            49: 
        !            50:        .align 4
        !            51: .globl C(R_Surf16Start)
        !            52: C(R_Surf16Start):
        !            53: 
        !            54:        .align 4
        !            55: .globl C(R_DrawSurfaceBlock16)
        !            56: C(R_DrawSurfaceBlock16):
        !            57:        pushl   %ebp                            // preserve caller's stack frame
        !            58:        pushl   %edi
        !            59:        pushl   %esi                            // preserve register variables
        !            60:        pushl   %ebx
        !            61: 
        !            62:        movl    C(blocksize),%eax
        !            63:        movl    C(prowdestbase),%edi
        !            64:        movl    C(pbasesource),%esi
        !            65:        movl    C(sourcesstep),%ebx
        !            66:        movl    blockjumptable16-4(,%eax,2),%ecx
        !            67:        movl    %eax,k
        !            68:        movl    %ecx,loopentry
        !            69:        movl    C(lightleft),%edx
        !            70:        movl    C(lightright),%ebp
        !            71: 
        !            72: Lblockloop16:
        !            73: 
        !            74:        subl    %edx,%ebp
        !            75:        movb    C(blockdivshift),%cl
        !            76:        sarl    %cl,%ebp
        !            77:        jns             Lp1_16
        !            78:        testl   C(blockdivmask),%ebp
        !            79:        jz              Lp1_16
        !            80:        incl    %ebp
        !            81: Lp1_16:
        !            82: 
        !            83:        subl    %eax,%eax
        !            84:        subl    %ecx,%ecx       // high words must be 0 in loop for addressing
        !            85: 
        !            86:        jmp             *loopentry
        !            87: 
        !            88:        .align  4
        !            89: 
        !            90: #include "block16.h"
        !            91: 
        !            92:        movl    C(pbasesource),%esi
        !            93:        movl    C(lightleft),%edx
        !            94:        movl    C(lightright),%ebp
        !            95:        movl    C(sourcetstep),%eax
        !            96:        movl    C(lightrightstep),%ecx
        !            97:        movl    C(prowdestbase),%edi
        !            98: 
        !            99:        addl    %eax,%esi
        !           100:        addl    %ecx,%ebp
        !           101: 
        !           102:        movl    C(lightleftstep),%eax
        !           103:        movl    C(surfrowbytes),%ecx
        !           104: 
        !           105:        addl    %eax,%edx
        !           106:        addl    %ecx,%edi
        !           107: 
        !           108:        movl    %esi,C(pbasesource)
        !           109:        movl    %ebp,C(lightright)
        !           110:        movl    k,%eax
        !           111:        movl    %edx,C(lightleft)
        !           112:        decl    %eax
        !           113:        movl    %edi,C(prowdestbase)
        !           114:        movl    %eax,k
        !           115:        jnz             Lblockloop16
        !           116: 
        !           117:        popl    %ebx                            // restore register variables
        !           118:        popl    %esi
        !           119:        popl    %edi
        !           120:        popl    %ebp                            // restore the caller's stack frame
        !           121:        ret
        !           122: 
        !           123: .globl C(R_Surf16End)
        !           124: C(R_Surf16End):
        !           125: 
        !           126: //----------------------------------------------------------------------
        !           127: // Code patching routines
        !           128: //----------------------------------------------------------------------
        !           129:        .data
        !           130: 
        !           131:        .align 4
        !           132: LPatchTable16:
        !           133:        .long   LBPatch0-4
        !           134:        .long   LBPatch1-4
        !           135:        .long   LBPatch2-4
        !           136:        .long   LBPatch3-4
        !           137:        .long   LBPatch4-4
        !           138:        .long   LBPatch5-4
        !           139:        .long   LBPatch6-4
        !           140:        .long   LBPatch7-4
        !           141:        .long   LBPatch8-4
        !           142:        .long   LBPatch9-4
        !           143:        .long   LBPatch10-4
        !           144:        .long   LBPatch11-4
        !           145:        .long   LBPatch12-4
        !           146:        .long   LBPatch13-4
        !           147:        .long   LBPatch14-4
        !           148:        .long   LBPatch15-4
        !           149: 
        !           150:        .text
        !           151: 
        !           152:        .align 4
        !           153: .globl C(R_Surf16Patch)
        !           154: C(R_Surf16Patch):
        !           155:        pushl   %ebx
        !           156: 
        !           157:        movl    C(colormap),%eax
        !           158:        movl    $LPatchTable16,%ebx
        !           159:        movl    $16,%ecx
        !           160: LPatchLoop16:
        !           161:        movl    (%ebx),%edx
        !           162:        addl    $4,%ebx
        !           163:        movl    %eax,(%edx)
        !           164:        decl    %ecx
        !           165:        jnz             LPatchLoop16
        !           166: 
        !           167:        popl    %ebx
        !           168: 
        !           169:        ret
        !           170: 
        !           171: 
        !           172: #endif // id386

unix.superglobalmegacorp.com

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