egato
	mulu.l	d2,d4		; d1 = d1 * d5
	swap	d4		; d5 >> 16
	add.w	d4,d0		; New Y  ->  X = 105
	moveq	#0,d2

NoClippingAlto:
* CONTROLLO BASSO
	cmp.l	#256,d3		; se d3 < 256  NO CLIPPING BASSO
	blt.s	NoClippingBasso
	cmp.l	#256,d2		; d3 > 256, d2 >= 256     FUORI SCREEN
	bge.w	NO_LINEA

* CLIPPING BASSO
	moveq	#0,d4
	moveq	#0,d5
	move.w	d1,d4		; d4 = x1
	sub.w	d0,d4		; d4 = x1 - x0
	move.w	d3,d5		; d5 = y1
	sub.w	d2,d5		; d5 = y1 - y0
	swap	d4		; d4 << 16
	divs.l	d5,d4		; d4 = d5 / d4 = pre ogni Y, quante X si sposta ?
	sub.w	#256,d3		; 256 pixel senza clipping
	mulu.l	d3,d4		; d1 = d1 * d5
	swap	d4		; d5 >> 16
	sub.w	d4,d1		; New Y  ->  X = 105
	move.w	#255,d3

NoClippingBasso:

* QUESTE SONO LE COORDINATE CALCOLATE !!!

* D0 = X0
* D1 = X1
* D2 = Y0
* D3 = Y1

	rts
</PRE><P>
<HR>
<A HREF=index_I.html>Pagina Principale</A>
<HR>
<H4><PRE><B>
    Scritto da: Alfredo Ornaghi      e-mail: <A HREF=mailto:ted@intercom.it>ted@intercom.it</A>
                ITALY                   tel:
</H4></PRE></B>
<HR>
</BODY>
,N1tL>
<HEAD>
<TITLE>
ASM Course
</TITLE>

<IMG SRC = "../MagGfx/AmigaBlast.GIF"></A>
<body background="../MagGfx/Pattern.GIF" bgcolor="#959595" text="#000000"
link="ffffff" vlink="#ffffff" alink="#ffffff">

<BODY><H2>
FILLED VECTORS (Part 3)
</H2>
<HR>
<H2><B>CLIPPING</B></H2><P>
It is used when a face comes out from the screen's visible area. By using this
routine it is possible to draw only the faces's parts which are inside the
screen and eliminate the ones outside.<P>
Example:

Faces to be drawed :
<PRE>

             /\
            /  \
           /    \
          /      \
         /        \
         \        /
          \      /
           \    /
            \  /
             \/
</PRE><P>
Screen :
<PRE>
         +---------+
         |         |
         |         |
         |         |
         |         |
         |         |
         |         |
         |         |
         |         |
         +---------+
</PRE><P>
Sum :
<PRE>
            /\
           /  \
         +/----\---+
         /      \  |
        /|       \ |
        \|       / |
         \      /  |
         |\    /   |
         | \  /    |
         |  \/     |
         |         |
         +---------+
</PRE><P>
Sum with clipping :

<PRE>
         +/----\---+
         /      \  |
         |       \ |
         |       / |
         \      /  |
         |\    /   |
         | \  /    |
         |  \/     |
         |         |
         +--