Annotation of quake1/surf16.s, revision 1.1.1.1

1.1       root        1: //
                      2: // surf8.s
                      3: // x86 assembly-language 8 bpp surface block drawing code.
                      4: //
                      5: 
                      6: #include "asm_i386.h"
                      7: #include "quakeasm.h"
                      8: #include "asm_draw.h"
                      9: 
                     10: #if id386
                     11: 
                     12: //----------------------------------------------------------------------
                     13: // Surface block drawer
                     14: //----------------------------------------------------------------------
                     15: 
                     16:        .data
                     17: 
                     18: k:                     .long   0
                     19: loopentry:     .long   0
                     20: 
                     21:        .align  4
                     22: blockjumptable16:
                     23:        .long   LEnter2_16
                     24:        .long   LEnter4_16
                     25:        .long   0, LEnter8_16
                     26:        .long   0, 0, 0, LEnter16_16
                     27: 
                     28: 
                     29:        .text
                     30: 
                     31:        .align 4
                     32: .globl C(R_Surf16Start)
                     33: C(R_Surf16Start):
                     34: 
                     35:        .align 4
                     36: .globl C(R_DrawSurfaceBlock16)
                     37: C(R_DrawSurfaceBlock16):
                     38:        pushl   %ebp                            // preserve caller's stack frame
                     39:        pushl   %edi
                     40:        pushl   %esi                            // preserve register variables
                     41:        pushl   %ebx
                     42: 
                     43:        movl    C(blocksize),%eax
                     44:        movl    C(prowdestbase),%edi
                     45:        movl    C(pbasesource),%esi
                     46:        movl    C(sourcesstep),%ebx
                     47:        movl    blockjumptable16-4(,%eax,2),%ecx
                     48:        movl    %eax,k
                     49:        movl    %ecx,loopentry
                     50:        movl    C(lightleft),%edx
                     51:        movl    C(lightright),%ebp
                     52: 
                     53: Lblockloop16:
                     54: 
                     55:        subl    %edx,%ebp
                     56:        movb    C(blockdivshift),%cl
                     57:        sarl    %cl,%ebp
                     58:        jns             Lp1_16
                     59:        testl   C(blockdivmask),%ebp
                     60:        jz              Lp1_16
                     61:        incl    %ebp
                     62: Lp1_16:
                     63: 
                     64:        subl    %eax,%eax
                     65:        subl    %ecx,%ecx       // high words must be 0 in loop for addressing
                     66: 
                     67:        jmp             *loopentry
                     68: 
                     69:        .align  4
                     70: 
                     71: #include "block16.h"
                     72: 
                     73:        movl    C(pbasesource),%esi
                     74:        movl    C(lightleft),%edx
                     75:        movl    C(lightright),%ebp
                     76:        movl    C(sourcetstep),%eax
                     77:        movl    C(lightrightstep),%ecx
                     78:        movl    C(prowdestbase),%edi
                     79: 
                     80:        addl    %eax,%esi
                     81:        addl    %ecx,%ebp
                     82: 
                     83:        movl    C(lightleftstep),%eax
                     84:        movl    C(surfrowbytes),%ecx
                     85: 
                     86:        addl    %eax,%edx
                     87:        addl    %ecx,%edi
                     88: 
                     89:        movl    %esi,C(pbasesource)
                     90:        movl    %ebp,C(lightright)
                     91:        movl    k,%eax
                     92:        movl    %edx,C(lightleft)
                     93:        decl    %eax
                     94:        movl    %edi,C(prowdestbase)
                     95:        movl    %eax,k
                     96:        jnz             Lblockloop16
                     97: 
                     98:        popl    %ebx                            // restore register variables
                     99:        popl    %esi
                    100:        popl    %edi
                    101:        popl    %ebp                            // restore the caller's stack frame
                    102:        ret
                    103: 
                    104: .globl C(R_Surf16End)
                    105: C(R_Surf16End):
                    106: 
                    107: //----------------------------------------------------------------------
                    108: // Code patching routines
                    109: //----------------------------------------------------------------------
                    110:        .data
                    111: 
                    112:        .align 4
                    113: LPatchTable16:
                    114:        .long   LBPatch0 - 4
                    115:        .long   LBPatch1 - 4
                    116:        .long   LBPatch2 - 4
                    117:        .long   LBPatch3 - 4
                    118:        .long   LBPatch4 - 4
                    119:        .long   LBPatch5 - 4
                    120:        .long   LBPatch6 - 4
                    121:        .long   LBPatch7 - 4
                    122:        .long   LBPatch8 - 4
                    123:        .long   LBPatch9 - 4
                    124:        .long   LBPatch10 - 4
                    125:        .long   LBPatch11 - 4
                    126:        .long   LBPatch12 - 4
                    127:        .long   LBPatch13 - 4
                    128:        .long   LBPatch14 - 4
                    129:        .long   LBPatch15 - 4
                    130: 
                    131:        .align 4
                    132: .globl C(R_Surf16Patch)
                    133: C(R_Surf16Patch):
                    134:        pushl   %ebx
                    135: 
                    136:        movl    C(colormap),%eax
                    137:        movl    $LPatchTable16,%ebx
                    138:        movl    $16,%ecx
                    139: LPatchLoop16:
                    140:        movl    (%ebx),%edx
                    141:        addl    $4,%ebx
                    142:        movl    %eax,(%edx)
                    143:        decl    %ecx
                    144:        jnz             LPatchLoop16
                    145: 
                    146:        popl    %ebx
                    147: 
                    148:        ret
                    149: 
                    150: 
                    151: #endif // id386

unix.superglobalmegacorp.com

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