Annotation of quake1/worlda.s, revision 1.1.1.2

1.1       root        1: //
                      2: // worlda.s
                      3: // x86 assembly-language server testing stuff
                      4: //
                      5: 
1.1.1.2 ! root        6: #define GLQUAKE        1       // don't include unneeded defs
1.1       root        7: #include "asm_i386.h"
                      8: #include "quakeasm.h"
                      9: #include "d_ifacea.h"
                     10: 
                     11: #if id386
                     12: 
                     13:        .data
                     14: 
                     15: Ltemp: .long   0
                     16: 
                     17:        .text
                     18: 
                     19: //----------------------------------------------------------------------
                     20: // hull-point test
                     21: //----------------------------------------------------------------------
                     22: 
                     23: #define hull   4+8                             // because only partially pushed
                     24: #define        num             8+4                             // because only partially pushed
                     25: #define p              12+12                   // because only partially pushed
                     26: 
                     27:        .align 4
                     28: .globl C(SV_HullPointContents)
                     29: C(SV_HullPointContents):
                     30:        pushl   %edi                            // preserve register variables
                     31:        movl    num(%esp),%eax
                     32:        testl   %eax,%eax
                     33:        js              Lhquickout
                     34: 
                     35: //     float           d;
                     36: //     dclipnode_t     *node;
                     37: //     mplane_t        *plane;
                     38: 
                     39:        pushl   %ebx
                     40:        movl    hull(%esp),%ebx
                     41: 
                     42:        pushl   %ebp
                     43:        movl    p(%esp),%edx
                     44: 
                     45:        movl    hu_clipnodes(%ebx),%edi
                     46:        movl    hu_planes(%ebx),%ebp
                     47: 
                     48:        subl    %ebx,%ebx
                     49:        pushl   %esi
                     50: 
                     51: // %ebx: 0
                     52: // %eax: num
                     53: // %edx: p
                     54: // %edi: hull->clipnodes
                     55: // %ebp: hull->planes
                     56: 
                     57: //     while (num >= 0)
                     58: //     {
                     59: 
                     60: Lhloop:
                     61: 
                     62: //             node = hull->clipnodes + num;
                     63: //             plane = hull->planes + node->planenum;
                     64: // !!! if the size of dclipnode_t changes, the scaling of %eax needs to be
                     65: //     changed !!!
                     66:        movl    nd_planenum(%edi,%eax,8),%ecx
                     67:        movl    nd_children(%edi,%eax,8),%eax
                     68:        movl    %eax,%esi
                     69:        rorl    $16,%eax
                     70:        leal    (%ecx,%ecx,4),%ecx
                     71: 
                     72: //             if (plane->type < 3)
                     73: //                     d = p[plane->type] - plane->dist;
                     74:        movb    pl_type(%ebp,%ecx,4),%bl
                     75:        cmpb    $3,%bl
                     76:        jb              Lnodot
                     77: 
                     78: //             else
                     79: //                     d = DotProduct (plane->normal, p) - plane->dist;
                     80:        flds    pl_normal(%ebp,%ecx,4)
                     81:        fmuls   0(%edx)
                     82:        flds    pl_normal+4(%ebp,%ecx,4)
                     83:        fmuls   4(%edx)
                     84:        flds    pl_normal+8(%ebp,%ecx,4)
                     85:        fmuls   8(%edx)
                     86:        fxch    %st(1)
                     87:        faddp   %st(0),%st(2)
                     88:        faddp   %st(0),%st(1)
                     89:        fsubs   pl_dist(%ebp,%ecx,4)
                     90:        jmp             Lsub
                     91: 
                     92: Lnodot:
                     93:        flds    pl_dist(%ebp,%ecx,4)
                     94:        fsubrs  (%edx,%ebx,4)
                     95: 
                     96: Lsub:
                     97:        sarl    $16,%eax
                     98:        sarl    $16,%esi
                     99: 
                    100: //             if (d < 0)
                    101: //                     num = node->children[1];
                    102: //             else
                    103: //                     num = node->children[0];
                    104:        fstps   Ltemp
                    105:        movl    Ltemp,%ecx
                    106:        sarl    $31,%ecx
                    107:        andl    %ecx,%esi
                    108:        xorl    $0xFFFFFFFF,%ecx
                    109:        andl    %ecx,%eax
                    110:        orl             %esi,%eax
                    111:        jns             Lhloop
                    112: 
                    113: //     return num;
                    114: Lhdone:
                    115:        popl    %esi
                    116:        popl    %ebp
                    117:        popl    %ebx                            // restore register variables
                    118: 
                    119: Lhquickout:
                    120:        popl    %edi
                    121: 
                    122:        ret
                    123: 
                    124: #endif // id386
                    125: 

unix.superglobalmegacorp.com

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