d1 > 320 , d0 > 320   outside the scren
	bge.s	NO_LINEA

** RIGHT CLIPPING
	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	d5		; d5 << 16
	divs.l	d4,d5		; d5 = d5 / d4
	sub.w	#320,d1		; 320 pixel without clipping
	mulu.l	d1,d5		; d1 = d1 * d5
	swap	d5		; d5 >> 16
	sub.w	d5,d3		; New Y  ->  X = 105
	move.w	#319,d1

NoClippingDestro:

* VOGLIO Y0 < Y1
	cmp.l	d2,d3
	bgt.s	Y0MinoreY1
	exg.l	d0,d1
	exg.l	d2,d3
Y0MinoreY1:

* CHECK OF THE HIGH SIZE
	tst.l	d2		; if d2 > 0 NoclippingAlto
	bpl.s	NoClippingAlto
	tst.l	d3		; d3 < 0 , d2 < 0     outside the screen
	bmi.s	NO_LINEA


* HIGH CLIPPING
	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
	neg.l	d2		; d2 = d2 neg
	mulu.l	d2,d4		; d1 = d1 * d5
	swap	d4		; d5 >> 16
	add.w	d4,d0		; New Y  ->  X = 105
	moveq	#0,d2

NoClippingAlto:
* CHECK OF THE LOW SIZE
	cmp.l	#256,d3		; if d3 < 256  NOCLIPPINGBASSO
	blt.s	NoClippingBasso
	cmp.l	#256,d2		; d3 > 256, d2 >= 256     outside the screen
	bge.w	NO_LINEA

* LOW CLIPPING
	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
	sub.w	#256,d3		; 256 pixel without 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:

* THESE ARE THE CALCULATED CO-ORDINATES

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

	rts
</PRE><P>

<HR>
<A HREF=index_E.html>Main Page</A>
<HR>
<H4><PRE><B>
    Written By: Alfredo Ornaghi      e-mail: <A HREF=mailto:ted@intercom.it>ted@intercom.it</A>
                ITALY                   tel:
</H4></PRE></B>
<HR>
</BODY>
,N1tL>
<HEAD>
<TITLE>
Breed 96 Review
</TITLE>

<IMG SRC = "../MagGfx/AmigaBlast.GIF"></A>
<body background="../MagGfx/Pattern.GIF" bgcolor="#959595" text="#0000                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   