*******************************************************
***   Line Vector example for TSB's Vectordesigner  ***
***   --------------------------------------------  ***
***                                                 ***
***               written by ALLOC                  ***
***                                                 ***
*******************************************************
;---------------------------------------
; a  (return)
;(return)
; y  (return)
; jm (return)

>extern	"df0:readyobjects/lineship.l",lineobject
org	$30000
load	$30000

clear: 	MACRO
	lea	$dff000,a5
	move.l	?1,$54(a5)
	move.w	?2,d0       ;x
	move.w	?3,d1       ;y
	move.w	#$0,$66(a5)
	move.w	#%0000000100000000,$40(a5)
	move.w	#0,$42(a5)
	lsl.w	#6,d1
	or.w	d1,d0
	move.w	d0,$58(a5)
	ENDM


m:
	
 		lea	$dff000,a5
		movem.l	d0-d7/a0-a6,-(a7)
		moveq	#61,d0
		lea	zero,a0
		lea	8,a1
copyzero:	move.l	(a1)+,(a0)+
		dbf	d0,copyzero
		move.l	#raus,$020
raus:		move.w	#$2700,sr
		adda	#6,a7
		move.l	a7,sstack
		move.l	#stackend,a7
		move.w	$1c(a5),intbuff
		move.w	#$7fff,$9a(a5)
		move.w	#$7fff,$9c(a5)
		bra.L	main		
oson:		move.w	#$2700,sr
		move.w     `            `  ,dnf`fn`       `       `   !5o`fogclam`fff`cf`fo ff`f`J	laf`l`fgf` c`f`falaf`fl`gcccc`ff`fd7lc`c````cl                               ,0        `   ,k       ff ff`     `   `  :	g	fgf``n*fffafc goffffgj*ffffc 	f`````mmffffmamogc f``llffff la0 falcl`q1                              t        `                #%a`   `      `                /oaacc                #0၀fc fffff`                **afcg`                :	aac `f fa               0
``fac               #0                                 !0 cc a `   `     a afffc`a    `     nd agfag	a`  j* aǇ` aa`ffffff * ` `	a`gfg  I# ff`afff `  ha cc灀cc  e,                                  	m                           (a `     `                       	d g                      )+ fcff c                       $c fcfc                        

 gf``f                     ** g                     		                                  2.        `                 	m        `   `                 
	 gc                 
c fff`cff`                 00 fff`g`                 03 fff`cfa                ,$ c`c                00                                   0
                                   0,                                   7	                                   $0                                   $0                                   #,                                   $f                                   	d                                   4a     sewqwp  Áwwp  ww wp0wwp   wwpww wIm   wp0pw   pwwpw wngwqwp  Ápsww wd7sp   ww wand.w	d7                                   7t                                   #m                                   	(                                   !6                                   9(                                   /t                                   $1                                   
	                                   0
                                   %.                                   	m                                   #)                                   %l                                   ,d                                   	l                                   $5                                   	(                                   -o                                   .e                                   7	                                   :
                                   	b                                   0,                                   )e                                   $2                                   4a                                   #o                                   #m                                   -o                                   (a                                   
	                                   1,                                   ),                                   	d                                   !0                                   ,d                                   ,d                                   $4                                   3	                                   .l                                   /v                                   /t                                   ,s                                   ".                                   -o                                   1.                                   5
                                   6,                                   !6                                   ,2                                   ,2                                   ,2                                   ,2                                   ,1                                   ,1                                   ,7<3,?>>8<~?88	~?>>8x88	8?>>88x<?831?>>8x?8-?>>8<~??89?>8<<<?8,-219,-     (                            23                            7	`   f`                           25nfg                            3,`ffc                           -2macf`                           30laff`                           ,-l`c                           #.                                  ,-                                    11,-67,-61                                   .w                                   4,                                   7,                                   5,                                   6,                                   9,                                   2,                                   

                                   $c                                   $c.w	-97     08,-114,-120,-125,-131,-136
	dc.w	-141,-5,d2
vy:
	muls	#0,d5
vz:
	muls	#0,d1
	sub.w	d1,d5
			;x
vz2:
	muls	#0,d3
vx:
	muls	#0,d2
	sub.w	d2,d3
			;y
vx2:
	muls	#0,d4
vy2:
	muls	#0,d0
	sub.w	d0,d4
			;z
	move.w	a3,d0
	move.w	a4,d1
	move.w	a5,d2

	muls	d0,d5
	muls	d1,d3
	muls	d2,d4
	add.l	d3,d4
	add.l	d4,d5
	tst.l	d5
	bge.s	unsich
sich:
	move.w	#0,(a0)
	bra.s	sichtend
unsich:
	move.w	#1,(a0)
sichtend:
	movem.l	(a7)+,d0-d7/a0-a6
	rts


*************************
**** Flaechenfuellen ****
*************************
;a0 Tabelle mit Coordszeiger
;a1 Coords


fill:
	movem.l	d0-d7/a2-a6,-(a7)
	clrscr	#$72d10,with,high,modu
	move.w	2(a0),d7
	move.w	d7,coordsanzahl
	clr.w	fcolor
	move.b	5(a0),fcolor+1
	subq.w	#1,d7
	addq.l	#6,a0
	move.w	#$7fff,xminwert
	move.w	#$7fff,yminwert
	clr.w	xmaxwert
	clr.w	ymaxwert

	lea	fillcoordstable(pc),a5
makefillcoordstable:
	move.w	(a0)+,d0
	lsl.w	#3,d0
	move.l	a0,a3
	sub.l	a6,a3
	move.w	(a1,d0.w),d1
	move.w	2(a1,d0.w),d2
	cmp.w	xminwert(pc),d1
	bge.s	xminset
	move.w	d1,xminwert
xminset:
	cmp.w	yminwert(pc),d2
	bge.s	yminset
	move.w	d2,yminwert
yminset:
	cmp.w	xmaxwert(pc),d1
	ble.s	xmaxset
	move.w	d1,xmaxwert
xmaxset:
	cmp.w	ymaxwert(pc),d2
	ble.s	ymaxset
	move.w	d2,ymaxwert
ymaxset:
	move.w	d1,(a5)+
	move.w	d2,(a5)+
	dbf	d7,makefillcoordstable


	lea	fillcoordstable(pc),a2
	move.w	coordsanzahl(pc),d7
	subq.w	#2,d7
	move.w	xminwert(pc),d4
	move.w	yminwert(pc),a5
	lea	$72d10,a0
	lea	40,a1
filldraw:
	move.w	(a2)+,d0
	move.w	(a2)+,d1
	move.w	(a2),d2
	move.w	2(a2),d3	
	sub.w	d4,d0
	sub.w	d4,d2
	sub.w	a5,d1
	sub.w	a5,d3
	cmp.w	d1,d3
	beq	fillend
	cmp.w	d1,d3
	bge.s	nochange
	exg	d1,d3
	exg	d0,d2
nochange:
	move.w	d2,d5
	move.w	d3,d6
	sub.w	d0,d5
	bpl.s	nomin
	neg.w	d5
nomin:
	sub.w	d1,d6
	asl.w	#1,d6
	cmp.w	d5,d6
	bgt.s	nomore
	subq.w	#1,d3
nomore:
	bsr	linedraw
fillend:
	dbf	d7,filldraw

	move.w	xmaxwert(pc),d2
	move.w	ymaxwert(pc),d3
	sub.w	d4,d2
	sub.w	a5,d3
	addq.w	#1,d3
	cmp.w	#2,d3
	blt	allfend
	moveq	#0,d1
	lsr.w	#4,d2
	addq.w	#1,d2
	move.w	d2,d1
	lsl.w	#1,d1
	moveq	#40,d7
	sub.w	d1,d7
	move.w	d2,with
	move.w	d3,high
	move.w	d7,modu
	lea	$dff000,a5
blittfillwait:
	btst	#14,2(a5)
	bne.s	blittfillwait
	move.l	#$ffffffff,$44(a5)
	move.w	d7,$64(a5)
	move.w	d7,$66(a5)
	move.w	d3,d4
	mulu	#40,d4
	add.l	d1,d4
	sub.l	#82,d4
	add.l	#$72d10,d4
	move.l	d4,$50(a5)
	move.l	d4,$54(a5)
	move.w	#%0000100111110000,$40(a5)
	move.w	#%1010,$42(a5)
	subq.w	#1,d3
	lsl.w	#6,d3
	or.w	d3,d2
	move.w	d2,$58(a5)
fillwait:
	btst	#14,2(a5)
	bne.s	fill     `            `  	ynf`fn`       `       `   $0o`fogcdam`fff`cf`fo ff`f`nwlaf`l`fgf` c`f`f,laf`fl`gcccc`ff`fJ	lc`c````c,                               	c        `   %.       ff ff`     `   `  	mg	fgf``nafffafc goffffgp,ffffc 	f`````mmffffmaI
gc f``llffff lao falcl`p,                              
        `                )
a`   `      `                14aacc                0,၀fc fffff`                %mafcg`                :
aac `f fa               :
``fac               	0                                 7f cc a `   `     $ afffc`a    `     J
 agfag	a`  n  aǇ` aa`ffffff x ` `	a`gfg  z
 ff`afff `  ab cc灀cc  nw                                  ,d                           3r `     `                       3u g                      4
 fcff c                       ,s fcfc                        ,d gf``f                     4, g                     :
                                  3,        `                 8,        `   `                 #7 gc                 .w fff`cff`                 ,d fff`g`                 3r fff`cfa                !d c`c                2
                                   -u                                   !s                                   	a                                   6
                                 