|
|
1.1 root 1: // 1.1.1.2 ! root 2: // surf16.s ! 3: // x86 assembly-language 16 bpp surface block drawing code. 1.1 root 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: 1.1.1.2 ! root 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: .text 1.1 root 132: 133: .align 4 134: .globl C(R_Surf16Patch) 135: C(R_Surf16Patch): 136: pushl %ebx 137: 138: movl C(colormap),%eax 139: movl $LPatchTable16,%ebx 140: movl $16,%ecx 141: LPatchLoop16: 142: movl (%ebx),%edx 143: addl $4,%ebx 144: movl %eax,(%edx) 145: decl %ecx 146: jnz LPatchLoop16 147: 148: popl %ebx 149: 150: ret 151: 152: 153: #endif // id386
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.