;	StormC Compiler V 2.00.15.NewAssem
	MC68020


	SECTION	":0",Code

;	void DrawMandelbrot(struct Rect *view, struct DrawMsg *gfxport, int 
	XDEF	_DrawMandelbrot
_DrawMandelbrot:
L118	EQU	-$d4
	link.w	a5,#L118+0
	movem.l	d2-d7/a2/a3/a6,-(a7)
	move.l	$10(a5),d5
	move.l	$c(a5),a1
	move.l	8(a5),a3
L51:
;		width = gfxport->xsize;
	move.l	$c(a1),-$c(a5)
;		height = gfxport->ysize;
	move.l	$10(a1),-$10(a5)
;		dx = (view->x1 - view->x0) / (double) width;
	move.l	a3,a0
	move.l	$10(a0),d0
	move.l	$14(a0),d1
	move.l	a3,a0
	move.l	(a0),d2
	move.l	4(a0),d3
	XREF	_MathIeeeDoubBasBase
	move.l	_MathIeeeDoubBasBase(a4),a6
	jsr	-$48(a6)
	move.l	d0,d6
	move.l	d1,d7
	move.l	-$c(a5),d0
	move.l	_MathIeeeDoubBasBase(a4),a6
	jsr	-$24(a6)
	move.l	d0,d2
	move.l	d1,d3
	move.l	d6,d0
	move.l	d7,d1
	move.l	_MathIeeeDoubBasBase(a4),a6
	jsr	-$54(a6)
	move.l	d0,-$28(a5)
	move.l	d1,-$24(a5)
;		dy = (view->y1 - view->y0) / (double) height;
	move.l	a3,a0
	move.l	$18(a0),d0
	move.l	$1c(a0),d1
	move.l	a3,a0
	move.l	8(a0),d2
	move.l	$c(a0),d3
	move.l	_MathIeeeDoubBasBase(a4),a6
	jsr	-$48(a6)
	move.l	d0,d6
	move.l	d1,d7
	move.l	-$10(a5),d0
	move.l	_MathIeeeDoubBasBase(a4),a6
	jsr	-$24(a6)
	move.l	d0,d2
	move.l	d1,d3
	move.l	d6,d0
	move.l	d7,d1
	move.l	_MathIeeeDoubBasBase(a4),a6
	jsr	-$54(a6)
	move.l	d0,-$30(a5)
	move.l	d1,-$2c(a5)
;		cy = view->y0;
	move.l	a3,a0
	move.l	8(a0),-$20(a5)
	move.l	$c(a0),-$1c(a5)
;		for (y = gfxport->offsety;
	move.l	8(a1),-8(a5)
	bra	L116
L52:
;		
;			cx = view->x0;
	move.l	a3,a0
	move.l	(a0),-$18(a5)
	move.l	4(a0),-$14(a5)
;			for (x = gfxport->offsetx;
	move.l	4(a1),-4(a5)
	bra	L114
L53:
;			
;				double zx = 0.0;
	clr.l	-$38(a5)
	clr.l	-$34(a5)
;				double zy = 0.0;
	moveq	#0,d6
	moveq	#0,d7
;				int i = N;
	move.l	d5,d4
;				double c = 16.0;
	move.l	#$40300000,-$78(a5)
	clr.l	-$74(a5)
;				
L54:
;				
;					h1 = zx*zx;
	move.l	-$38(a5),d0
	move.l	-$34(a5),d1
	move.l	-$38(a5),d2
	move.l	-$34(a5),d3
	move.l	_MathIeeeDoubBasBase(a4),a6
	jsr	-$4e(a6)
	move.l	d0,-$48(a5)
	move.l	d1,-$44(a5)
;					h2 = zy*zy;
	move.l	d6,d0
	move.l	d7,d1
	move.l	d0,d2
	move.l	d1,d3
	move.l	_MathIeeeDoubBasBase(a4),a6
	jsr	-$4e(a6)
	move.l	d0,-$50(a5)
	move.l	d1,-$4c(a5)
;					g = zx*zy;
	move.l	-$38(a5),d0
	move.l	-$34(a5),d1
	move.l	d6,d2
	move.l	d7,d3
	move.l	_MathIeeeDoubBasBase(a4),a6
	jsr	-$4e(a6)
	move.l	d0,d6
	move.l	d1,d7
;					h3 = h1 - h2;
	move.l	-$48(a5),d0
	move.l	-$44(a5),d1
	move.l	-$50(a5),d2
	move.l	-$4c(a5),d3
	move.l	_MathIeeeDoubBasBase(a4),a6
	jsr	-$48(a6)
	move.l	d0,-$60(a5)
	move.l	d1,-$5c(a5)
;					h4 = g+g;
	move.l	d6,d0
	move.l	d7,d1
	move.l	d0,d2
	move.l	d1,d3
	move.l	_MathIeeeDoubBasBase(a4),a6
	jsr	-$42(a6)
	move.l	d0,d6
	move.l	d1,d7
;					zx = h3 + cx;
	move.l	-$60(a5),d0
	move.l	-$5c(a5),d1
	move.l	-$18(a5),d2
	move.l	-$14(a5),d3
	move.l	_MathIeeeDoubBasBase(a4),a6
	jsr	-$42(a6)
	move.l	d0,-$38(a5)
	move.l	d1,-$34(a5)
;					zy = h4 + cy;
	move.l	d6,d0
	move.l	d7,d1
	move.l	-$20(a5),d2
	move.l	-$1c(a5),d3
	move.l	_MathIeeeDoubBasBase(a4),a6
	jsr	-$42(a6)
	move.l	d0,d6
	move.l	d1,d7
;					i--;
	subq.l	#1,d4
	move.l	-$48(a5),d0
	move.l	-$44(a5),d1
	move.l	-$50(a5),d2
	move.l	-$4c(a5),d3
	move.l	_MathIeeeDoubBasBase(a4),a6
	jsr	-$42(a6)
	move.l	-$78(a5),d2
	move.l	-$74(a5),d3
	move.l	_MathIeeeDoubBasBase(a4),a6
	jsr	-$2a(a6)
	bge.b	L56
L55:
	tst.l	d4
	bne	L54
L56:
;				i = N - i;
	move.l	d5,d0
	sub.l	d4,d0
	move.l	d0,d4
;				address = gfxport->memptr + y * gfxport->bytesperrow + x * gfx
	moveq	#0,d0
	move.w	$14(a1),d0
	muls.l	-8(a5),d0
	move.l	(a1),a0
	add.l	d0,a0
	moveq	#0,d0
	move.w	$16(a1),d0
	muls.l	-4(a5),d0
	add.l	d0,a0
;				switch (gfxport->colormodel)
	move.w	$18(a1),d0
	cmp.w	#$d,d0
	bhi	L113
	move.l	L119(pc,d0.w*4),a2
	jmp	(a2)
L119:
	dc.l	L57
	dc.l	L61
	dc.l	L65
	dc.l	L69
	dc.l	L73
	dc.l	L77
	dc.l	L81
	dc.l	L85
	dc.l	L89
	dc.l	L93
	dc.l	L97
	dc.l	L101
	dc.l	L105
	dc.l	L109
;				
;					
L57:
;						if (i < N)
	cmp.l	d5,d4
	bge.b	L59
L58:
;							*address = i*256/N
	asl.l	#8,d4
	divs.l	d5,d4
	move.b	d4,(a0)
	bra	L113
L59:
;							*address = 0;
	clr.b	(a0)
L60:
;						
	bra	L113
L61:
;						if (i < N)
	cmp.l	d5,d4
	bge.b	L63
L62:
;							*((UWORD *) address) = ((i*32/N) << 10) | ((i*32/N) << 5)
	move.l	d4,d0
	asl.l	#5,d0
	divs.l	d5,d0
	moveq	#$a,d1
	asl.l	d1,d0
	move.l	d4,d1
	asl.l	#5,d1
	divs.l	d5,d1
	asl.l	#5,d1
	or.l	d1,d0
	asl.l	#5,d4
	divs.l	d5,d4
	or.l	d4,d0
	move.w	d0,(a0)
	bra	L113
L63:
;							*((UWORD *) address) = 0;
	clr.w	(a0)
L64:
;						
	bra	L113
L65:
;						if (i < N)
	cmp.l	d5,d4
	bge.b	L67
L66:
;							*((UWORD *) address) = ((i*32/N) << 10) | ((i*32/N) << 5)
	move.l	d4,d0
	asl.l	#5,d0
	divs.l	d5,d0
	moveq	#$a,d1
	asl.l	d1,d0
	move.l	d4,d1
	asl.l	#5,d1
	divs.l	d5,d1
	asl.l	#5,d1
	or.l	d1,d0
	asl.l	#5,d4
	divs.l	d5,d4
	or.l	d4,d0
	move.w	d0,(a0)
	bra	L113
L67:
;							*((UWORD *) address) = 0;
	clr.w	(a0)
L68:
;						
	bra	L113
L69:
;						if (i < N)
	cmp.l	d5,d4
	bge.b	L71
L70:
;						
;							UWORD c = ((i*32/N) << 10) | ((i*32/N) << 5) | (i*32/N);
	move.l	d4,d0
	asl.l	#5,d0
	divs.l	d5,d0
	moveq	#$a,d1
	asl.l	d1,d0
	move.l	d4,d1
	asl.l	#5,d1
	divs.l	d5,d1
	asl.l	#5,d1
	or.l	d1,d0
	asl.l	#5,d4
	divs.l	d5,d4
	or.l	d4,d0
;							*address++ = c;
	move.b	d0,(a0)+
;							*address = c >> 8;
	and.l	#$ffff,d0
	asr.l	#8,d0
	move.b	d0,(a0)
	bra	L113
L71:
;							*((UWORD *) address) = 0;
	clr.w	(a0)
L72:
;						
	bra	L113
L73:
;						if (i < N)
	cmp.l	d5,d4
	bge.b	L75
L74:
;						
;							UWORD c = ((i*32/N) << 10) | ((i*32/N) << 5) | (i*32/N);
	move.l	d4,d0
	asl.l	#5,d0
	divs.l	d5,d0
	moveq	#$a,d1
	asl.l	d1,d0
	move.l	d4,d1
	asl.l	#5,d1
	divs.l	d5,d1
	asl.l	#5,d1
	or.l	d1,d0
	asl.l	#5,d4
	divs.l	d5,d4
	or.l	d4,d0
;							*address++ = c;
	move.b	d0,(a0)+
;							*address = c >> 8;
	and.l	#$ffff,d0
	asr.l	#8,d0
	move.b	d0,(a0)
	bra	L113
L75:
;							*((UWORD *) address) = 0;
	clr.w	(a0)
L76:
;						
	bra	L113
L77:
;						if (i < N)
	cmp.l	d5,d4
	bge.b	L79
L78:
;							*((UWORD *) address) = ((i*32/N) << 11) | ((i*64/N) << 5)
	move.l	d4,d0
	asl.l	#5,d0
	divs.l	d5,d0
	moveq	#$b,d1
	asl.l	d1,d0
	move.l	d4,d1
	asl.l	#6,d1
	divs.l	d5,d1
	asl.l	#5,d1
	or.l	d1,d0
	asl.l	#5,d4
	divs.l	d5,d4
	or.l	d4,d0
	move.w	d0,(a0)
	bra	L113
L79:
;							*((UWORD *) address) = 0;
	clr.w	(a0)
L80:
;						
	bra	L113
L81:
;						if (i < N)
	cmp.l	d5,d4
	bge.b	L83
L82:
;							*((UWORD *) address) = ((i*32/N) << 11) | ((i*64/N) << 5)
	move.l	d4,d0
	asl.l	#5,d0
	divs.l	d5,d0
	moveq	#$b,d1
	asl.l	d1,d0
	move.l	d4,d1
	asl.l	#6,d1
	divs.l	d5,d1
	asl.l	#5,d1
	or.l	d1,d0
	asl.l	#5,d4
	divs.l	d5,d4
	or.l	d4,d0
	move.w	d0,(a0)
	bra	L113
L83:
;							*((UWORD *) address) = 0;
	clr.w	(a0)
L84:
;						
	bra	L113
L85:
;						if (i < N)
	cmp.l	d5,d4
	bge.b	L87
L86:
;						
;							UWORD c = ((i*32/N) << 11) | ((i*64/N) << 5) | (i*32/N);
	move.l	d4,d0
	asl.l	#5,d0
	divs.l	d5,d0
	moveq	#$b,d1
	asl.l	d1,d0
	move.l	d4,d1
	asl.l	#6,d1
	divs.l	d5,d1
	asl.l	#5,d1
	or.l	d1,d0
	asl.l	#5,d4
	divs.l	d5,d4
	or.l	d4,d0
;							*address++ = c;
	move.b	d0,(a0)+
;							*address = c >> 8;
	and.l	#$ffff,d0
	asr.l	#8,d0
	move.b	d0,(a0)
	bra	L113
L87:
;							*((UWORD *) address) = 0;
	clr.w	(a0)
L88:
;						
	bra	L113
L89:
;						if (i < N)
	cmp.l	d5,d4
	bge.b	L91
L90:
;						
;							UWORD c = ((i*32/N) << 11) | ((i*64/N) << 5) | (i*32/N);
	move.l	d4,d0
	asl.l	#5,d0
	divs.l	d5,d0
	moveq	#$b,d1
	asl.l	d1,d0
	move.l	d4,d1
	asl.l	#6,d1
	divs.l	d5,d1
	asl.l	#5,d1
	or.l	d1,d0
	asl.l	#5,d4
	divs.l	d5,d4
	or.l	d4,d0
;							*address++ = c;
	move.b	d0,(a0)+
;							*address = c >> 8;
	and.l	#$ffff,d0
	asr.l	#8,d0
	move.b	d0,(a0)
	bra	L113
L91:
;							*((UWORD *) address) = 0;
	clr.w	(a0)
L92:
;						
	bra	L113
L93:
;						if (i < N)
	cmp.l	d5,d4
	bge.b	L95
L94:
;						
;							*((UWORD *) address)++ = ((i*256/N) << 8) | (i*256/N);
	move.l	d4,d0
	asl.l	#8,d0
	divs.l	d5,d0
	asl.l	#8,d0
	move.l	d4,d1
	asl.l	#8,d1
	divs.l	d5,d1
	or.l	d1,d0
	move.w	d0,(a0)+
;							*address = i*256/N;
	asl.l	#8,d4
	divs.l	d5,d4
	move.b	d4,(a0)
	bra	L113
L95:
;						
;							*((UWORD *) address)++ = 0;
	clr.w	(a0)+
;							*address = 0;
	clr.b	(a0)
L96:
;						
	bra	L113
L97:
;						if (i < N)
	cmp.l	d5,d4
	bge.b	L99
L98:
;						
;							*((UWORD *) address)++ = ((i*256/N) << 8) | (i*256/N);
	move.l	d4,d0
	asl.l	#8,d0
	divs.l	d5,d0
	asl.l	#8,d0
	move.l	d4,d1
	asl.l	#8,d1
	divs.l	d5,d1
	or.l	d1,d0
	move.w	d0,(a0)+
;							*address = i*256/N;
	asl.l	#8,d4
	divs.l	d5,d4
	move.b	d4,(a0)
	bra	L113
L99:
;						
;							*((UWORD *) address)++ = 0;
	clr.w	(a0)+
;							*address = 0;
	clr.b	(a0)
L100:
;						
	bra	L113
L101:
;						if (i < N)
	cmp.l	d5,d4
	bge.b	L103
L102:
;						
;							*((ULONG *) address) = ((i*256/N) << 16) | ((i*256/N) <<
	move.l	d4,d0
	asl.l	#8,d0
	divs.l	d5,d0
	moveq	#$10,d1
	asl.l	d1,d0
	move.l	d4,d1
	asl.l	#8,d1
	divs.l	d5,d1
	asl.l	#8,d1
	or.l	d1,d0
	asl.l	#8,d4
	divs.l	d5,d4
	or.l	d4,d0
	move.l	d0,(a0)
	bra.b	L113
L103:
;						
;							*((ULONG *) address) = 0;
	clr.l	(a0)
L104:
;						
	bra.b	L113
L105:
;						if (i < N)
	cmp.l	d5,d4
	bge.b	L107
L106:
;						
;							*((ULONG *) address) = ((i*256/N) << 24) | ((i*256/N) <<
	move.l	d4,d0
	asl.l	#8,d0
	divs.l	d5,d0
	moveq	#$18,d1
	asl.l	d1,d0
	move.l	d4,d1
	asl.l	#8,d1
	divs.l	d5,d1
	moveq	#$10,d2
	asl.l	d2,d1
	or.l	d1,d0
	asl.l	#8,d4
	divs.l	d5,d4
	asl.l	#8,d4
	or.l	d4,d0
	move.l	d0,(a0)
	bra.b	L113
L107:
;						
;							*((ULONG *) address) = 0;
	clr.l	(a0)
L108:
;						
	bra.b	L113
L109:
;						if (i < N)
	cmp.l	d5,d4
	bge.b	L111
L110:
;						
;							*((ULONG *) address) = ((i*256/N) << 24) | ((i*256/N) <<
	move.l	d4,d0
	asl.l	#8,d0
	divs.l	d5,d0
	moveq	#$18,d1
	asl.l	d1,d0
	move.l	d4,d1
	asl.l	#8,d1
	divs.l	d5,d1
	moveq	#$10,d2
	asl.l	d2,d1
	or.l	d1,d0
	asl.l	#8,d4
	divs.l	d5,d4
	asl.l	#8,d4
	or.l	d4,d0
	move.l	d0,(a0)
	bra.b	L113
L111:
;						
;							*((ULONG *) address) = 0;
	clr.l	(a0)
L112:
;						
L113:
;				cx += dx;
	move.l	-$18(a5),d0
	move.l	-$14(a5),d1
	move.l	-$28(a5),d2
	move.l	-$24(a5),d3
	move.l	_MathIeeeDoubBasBase(a4),a6
	jsr	-$42(a6)
	move.l	d0,-$18(a5)
	move.l	d1,-$14(a5)
	addq.l	#1,-4(a5)
L114:
	move.l	-4(a5),d0
	cmp.l	-$c(a5),d0
	blt	L53
L115:
;			cy += dy;
	move.l	-$20(a5),d0
	move.l	-$1c(a5),d1
	move.l	-$30(a5),d2
	move.l	-$2c(a5),d3
	move.l	_MathIeeeDoubBasBase(a4),a6
	jsr	-$42(a6)
	move.l	d0,-$20(a5)
	move.l	d1,-$1c(a5)
	addq.l	#1,-8(a5)
L116:
	move.l	-8(a5),d0
	cmp.l	-$10(a5),d0
	blt	L52
L117:
	movem.l	(a7)+,d2-d7/a2/a3/a6
	unlk	a5
	rts

	END
