        .386p
        .model flat, c
        locals
        .code

        extrn   texture   :dword
        extrn   vmem      :dword
        extrn   angrad2    :dword

public  tunnel2

tunnel2:pushad
        mov     dx,oldx
        mov     edi,vmem
        mov     esi,texture
        xor     ebp,ebp
        xor     ebx,ebx
        xor     eax,eax
        add     dl,1
        add     dh,1
        mov     cx,32000
loopd:  mov     ax,word ptr [angrad2+2*ebp]
        add     ah,dh
        mov     bl,al
        add     bl,dl
        add     ah,stb0[ebx]
        mov     ax,[esi+eax]
        shl     al,1
        shl     ah,1
        mov     [edi+ebp],ax
        ;add     [edi+ebp],al
        ;add     [edi+ebp+1],ah
        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
