DRAWLINE:
	MOVE.B HITAMOUNT,D0
	AND.W #$00FF,D0
	LSL.W #1,D0
	LEA HITPEAKTAB,A0
	MOVE.B 1(A0,D0.W),D1	;Y1
	MOVE.B 0(A0,D0.W),D0	;X1

	AND.W #$00FF,D1
	AND.W #$00FF,D0
	ADD.W #240,D0

	MOVE.W #16,D3		;Y2
	MOVE.W #16+240,D2	;X2

	LEA HITPEAKBPL,A0

;D0=X1
;D1=Y1
;D2=X2
;D3=Y2
;A0=BPLSTRT

	MOVE.L	#40,D4
	MULU	D1,D4		;GET POS IN Y 
	MOVEQ	#-16,D5
	AND.W	D0,D5
	LSR.W	#3,D5
	ADD.W	D5,D4
	ADD.L	A0,D4	;D4 STARTADDR
;-----------------------------------------------
OCTCALC:
	MOVEQ	#0,D5
	SUB.W	D1,D3
	ROXL.B	#1,D5
	TST.W	D3
	BGE.S	Y2GY1
	NEG.W	D3
Y2GY1:
	SUB.W	D0,D2
	ROXL.B	#1,D5
	TST.W	D2
	BGE.S	X2GX1
	NEG.W	D2
X2GX1:
	MOVE.W	D3,D1
	SUB.W	D2,D1
	BGE.S	DYGDX
	EXG	D2,D3
DYGDX:
	ROXL.B	#1,D5
	MOVE.B	OCTANT(PC,D5),D5	;GET OCTANT VALUE
	ADD.W	D2,D2			;D2 * 2
;-----------------------------------------------
	BSR WBLIT

	MOVE.W	D2,$062(A6)	;BLTBMOD  2(2Y)
	SUB.W	D3,D2
	BGE.S	ZIG
	OR.B	#$40,D5
ZIG:
	MOVE.W	D2,$052(A6)	;BLTAPTL  (2Y-X)
	SUB.W	D3,D2			
	MOVE.W	D2,$064(A6)	;BLTAMOD  2(2Y-2X)
	MOVE.W	#$8000,$074(A6)	;BLTADAT  (CONST.)
	MOVE.W	#$FFFF,$072(A6)	;BLTBDAT  (LINE PATTERN)
	MOVE.W	#$FFFF,$044(A6)	;BLTAFWM  (FIRST MASK)
	AND.W	#$000F,D0
	ROR.W	#4,D0
	OR.W	#$0BCA,D0
	MOVE.W	D0,$040(A6)	;BLTCON0  (START POS)
	MOVE.W	D5,$042(A6)	;BLTCON1  
	MOVE.L	D4,$048(A6)	;BLTCPTH  (START ADDR OF LINE)
	MOVE.L	D4,$054(A6)	;BLTDPTH  (START ADDR OF LINE)
	MOVE.W	#40,$060(A6)	;BLTCMOD  (WIDTH OF IMAGE)
	MOVE.W	#40,$066(A6)	;BLTDMOD  (WIDTH OF IMAGE)
	LSL.W	#6,D3
	ADDQ.W	#2,D3
	MOVE.W	D3,$058(A6)	;BLTSIZE  (LENGHT)

	RTS

;;
OCTANT:
	DC.B	1,17,9,21,5,25,13,29

