;---------------------------------------------------------------
;BLIT - Copy a rectangle to (x,y)
;	( w h x y -- )
code 'blit', blit
	push edx
	push edi
	call clip	;current position in ESI (temporarily in EDX)
	mov edx,edi
	call $at	;new position in EDI
	call clip
	upop ecx	;width in EAX, height in ECX
	xchg esi,edx
.1	  push ecx
	  mov ecx,eax
	  rep movsb
	  mov ecx,hp
	  sub ecx,eax
	  add esi,ecx
	  add edi,ecx
	  pop ecx
	  loop .1
	xchg esi,edx
	pop edi
	pop edx
	drop
next
