__asm
{
	mov eax,srctex
	mov edx,dest


			pushad
			mov	esi,offset pin
			mov edi,edx
			mov pintexptr,eax

			mov ch,HEIGHT
pinyloop:
			mov cl,WIDTH
pinxloop:
			//assume esi:ptr pin
			push esi
			push ecx
			mov eax,[esi+12/*sizeof pin*/+0/*u*/]
			sub eax,[esi+0/*u*/]
			mov edx,[esi+(12/*sizeof pin*/)*(WIDTH+2)+0/*u*/]
			sub edx,[esi+(12/*sizeof pin*/)*(WIDTH+1)+0/*u*/]
			sub edx,eax
			sar eax,3
			sar edx,6+adjust
			mov ebp,eax
			sar eax,31
			mov cl,al
			mov ival1,edx
			sar edx,31
			mov ival2,dl
			mov eax,[esi+(12/*sizeof pin*/)*(WIDTH+1)+0/*u*/]
			sub eax,[esi+0/*u*/]
			sar eax,3+adjust
			mov yval1,eax
			sar eax,31
			mov yval2,al

			mov eax,[esi+12/*sizeof pin*/+4/*u*/]
			sub eax,[esi+4/*u*/]
			mov edx,[esi+(12/*sizeof pin*/)*(WIDTH+2)+4/*u*/]
			sub edx,[esi+(12/*sizeof pin*/)*(WIDTH+1)+4/*u*/]
			sub edx,eax
			sar eax,3
			sar edx,6+adjust
			add cl,ah
			shl eax,24
			add ebp,eax
			adc cl,0
			add ival2,dh
			shl edx,24
			add ival1,edx
			adc ival2,0
			mov eax,[esi+(12/*sizeof pin*/)*(WIDTH+1)+4/*u*/]
			sub eax,[esi+4/*u*/]
			sar eax,3+adjust
			add yval2,ah
			shl eax,24
			add yval1,eax
			adc yval2,0

			mov ebx,pintexptr
			mov dl,byte ptr ([esi+4/*u*/])
			shl edx,24
			add edx,800000h
			mov eax,[esi+0/*u*/]
			and eax,65535
			add edx,eax
			mov bl,byte ptr ([esi+4/*u*/])+1

;bl:edx :edx contains u and lo v, bl contains hi v
;ebp:cl contains u/v incs
;ch counter
;ival1,ival2 are delta deltas



			mov	ch,8 shl adjust
again:
			push	edx
			push	ebx

	;comment !
			mov bh,dh         ; u
			add edx,ebp      ; v
			mov al,[ebx]      ; u
			mov bh,dh		; v
			adc bl,cl		;  u

			add edx,ebp      ; v
			mov ah,[ebx]      ; u
			mov bh,dh         ;  v
			adc bl,cl		;  u
			rol eax,16		; v

			add edx,ebp      ; u
			mov al,[ebx]      ; v
			adc bl,cl		;  u
			mov bh,dh         ; v

			add edx,ebp      ; u
			mov ah,[ebx]      ; v
			adc bl,cl		;  u
			rol eax,16		; v
			mov [edi],eax	; u

			;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

			mov bh,dh         ; u
			add edx,ebp      ; v
			mov al,[ebx]      ; u
			mov bh,dh		; v
			adc bl,cl		;  u

			add edx,ebp      ; v
			mov ah,[ebx]      ; u
			mov bh,dh         ;  v
			adc bl,cl		;  u
			rol eax,16		; v

			add edx,ebp      ; u
			mov al,[ebx]      ; v
			adc bl,cl		;  u
			mov bh,dh         ; v

			add edx,ebp      ; u
			mov ah,[ebx]      ; v
			adc bl,cl		;  u
			rol eax,16		; v
			mov [edi+4],eax	; u
;!
			pop ebx
			pop edx

			mov eax,yval1
			mov bh,yval2
			add edx,eax
			adc bl,bh


			mov eax,ival1	; v
			mov bh,ival2
			add ebp,eax	; v
			adc cl,bh       ; u
			add edi,WIDTH*8		  ; v
			dec ch			; u
			jnz again         ; v

			pop ecx
			pop esi
			add esi,12/*sizeof pin*/
			sub	edi,WIDTH*8*(8 shl adjust)-8
			dec cl
			jnz pinxloop
			add esi,12/*sizeof pin*/
			add edi,WIDTH*8*(8 shl adjust)-WIDTH*8
			dec ch
			jnz pinyloop
//			assume esi:nothing

			popad
			
			}


#undef WIDTH
#undef HEIGHT
#undef adjust