var lines = new Array("	move.w	#0,FX_step", "	move.l 	screen_adr,a1			; a1 points to screen address", "	; fill 4 screens", " ", "	move.w 	#(FX_HS_Vsize*2)-1,d2", ".Vloop", "	move.w 	#(FX_HS_Hsize*2)-1,d1", ".Hloop", "	move.w 	(a0)+,(a1)+", " ", "	dbf 	d1,.Hloop				; next pixel until Hsize-1", "	dbf 	d2,.Vloop				; next scanline until Vsize-1", " ", "	; $FFFF820E : _______0 Line Wide Hi", "	; $FFFF820F : 76543210 Line Wide Lo		-> end to end line word distance", "	; $FFFF8210 : ______10 Vertical Wrap Hi", "	; $FFFF8211 : 76543210 Vertical Wrap Lo	-> line wordlength", " ", " ", "	move.w #FX_HS_Hsize,$ffff820E.w		; Set Falcon Line Width register (in words) to Hsize", "	move.w #FX_HS_Hsize,$ffff8210.w 		; Set Falcon Vert Wrap register (in words) to Hsize", " ", "	; generate path table, here a lissajou curve table", "	; x(t) = cos(2*t)", "	; y(t) = sin(3*t+5)", " ", " ", "	lea FX_HS_sin_tbl,a0 			; a0 points to empty table", " ", "	move.w #199,d5				; loop counter = 400 values", "	move.l	#120,d3				; zoomfactor", "	fmove.w		#0,fp1", " ", ".genR8_sinus_tbl:", " ", "	moveq	#0,d2", "	moveq	#0,d0", " ", "	fadd.s	#1.4899999E-2,FP1	; t = 9.4999999E-2");
//var colors = new Array("#090FFB", "#161BFB", "#2328FB", "#3035FC", "#3C41FC", "#494EFC", "#565BFC", "#6367FC", "#7073FD", "#7D80FD", "#8A8DFD", "#9799FD", "#A3A6FE", "#B0B2FE", "#BDBFEE", "#CACBFE", "#D7D8FE", "#E4E4FF", "#F1F1FF", "#FEFEFF", "#FEF8E2", "#F9F2D6", "#F4EBCA", "#EFE4BE", "#E9DDB2", "#E4D7A6", "#DFD09A", "#D9C98E", "#D4C283", "#CFBC77", "#C9B56B", "#C4AE5F", "#BFA753", "#BAA147", "#B49A3B", "#AF932F", "#AA8C24", "#A58618", "#9F7F0C", "#9A7800");
var colors = new Array("#FF0000", "#FF2100", "#FF4208" ,"#FF6B08" ,"#FF8C10" ,"#FFAD18" ,"#FFC631" ,"#FFCE52" ,"#FFD673" ,"#FFE794" ,"#FFEFBD" ,"#FFF7DE" ,"#FFFFFF" ,"#FFFFFF" ,"#E7FFFF" ,"#BDFFFF" ,"#9CFFFF" ,"#73FFFF" ,"#4AFFFF" ,"#42FFEF" ,"#42FFCE" ,"#39FFAD" ,"#39FF8C" ,"#21FF63" ,"#00FF31" ,"#29FF21" ,"#5AFF18" ,"#8CFF10" ,"#C6FF08" ,"#F7FF00" ,"#FFFF00" ,"#FFF700" ,"#FFCE00" ,"#FFAD00" ,"#FF8C00" ,"#FF6300" ,"#FF4200" ,"#FF2100" ,"#FF0000");
var rastOffset = 0;
var rastersTable = new Array(39);

// PROFILER
var stepRastersloop = 100;
var totalTimeRasters = 0;
var avgTimeRasters =0;
var avgTotalRasters = 0;
// END PROFILER

function startRasters(){
	if (document.all)
	setTimeout("moveRasters()",0);

}

function moveRasters(){

	// PROFILER
	//startTimeRasters = new Date();
	// END PROFILE

	rastOffset = (rastOffset + 1) % 40;

	for (var i = 38; i >= 0; i--){
		// eval is tooo slow ! +100% vs table of objects !
		//eval("TextScroll").style.color = colors[(i + rastOffset) % 40];
		rastersTable[i].style.color = colors[(i + rastOffset) % 40];
	}
	setTimeout("moveRasters()",0);
	
	// PROFILER
	//endTimeRasters = new Date();
	
	//stepRastersloop--;
	//totalTimeRasters = totalTimeRasters + (endTimeRasters-startTimeRasters);
	
	//if(stepRastersloop == 0){
	//	avgTimeRasters = avgTimeRasters + totalTimeRasters;
	//	avgTotalRasters++;
	//	stepRastersloop = 100;
	//	window.status = "Temps d'execution " + stepRastersloop + " moveRasters() = " + totalTimeRasters + " ms (avg = " + Math.floor(avgTimeRasters/avgTotalRasters) + " ms)";
	//	totalTimeRasters = 0;
	//}	
	// END PROFILE		
}

function textRasters(){

	//document.write('<style>.asciiart { line-height: 10px; font-family: \"Courier New\"; font-size: 11px}</style>');


	for (var i = 0; i < 39; i++){

		currentline = "<DIV ID=\"TextScroll" + "\" class=\"asciiart\"><PRE>" + lines[i] + "</PRE></DIV>";
		document.write(currentline);
	}
	

	// This should work elsewhere ! :D
	var inc = 0;
	var divTableSize = divTable.length;
	
	for(var i=0; i<divTableSize; i++){
		if(divTable[i].getAttribute("ID") == "TextScroll") rastersTable[inc++] = divTable[i];	
	}
	
	

}
