        .386p
        .model flat, c
        locals
        .code

        extrn   texture   :dword
        extrn   vmem      :dword
        extrn   angrad    :dword

        tunincer        db      1

public  tunincer
public  tunnel1

tunnel1:pushad
        mov     dx,oldx
        mov     edi,vmem
        mov     esi,texture
        xor     ebp,ebp
        xor     ebx,ebx
        xor     eax,eax
        add     dl,tunincer
        add     dh,tunincer
        mov     cx,32000
loopd:  mov     ax,word ptr [angrad+2*ebp]
        add     ah,dh
        mov     bl,al
        add     bl,dl
        add     ah,stb0[ebx]
        mov     ax,[esi+eax]
        shr     al,1
        shr     ah,1
        mov     [edi+ebp],ax
        inc     ebp
        inc     ebp
        dec     ecx
        jnz     loopd
        mov     oldx,dx
        popad
        ret

include asm\tunnel0.inc
include asm\tunnel1.inc
include asm\tunnel3.inc

        xsi     dd      0
        xdi     dd      0
        xdx     dd      0
        xbp     dd      0
        oldx    dw      0
end
