var

	const greets_y :byte = 8*12;

procedure RenderGreets();
begin
	y1 := greets_y+16;

/*	c1 := Crtc::pixtab1[6];
	c1:=c1 | Crtc::pixtab2[15];*/
	c1 := Crtc::pixtab1[15-scroll];
	c1:=c1 | Crtc::pixtab2[6];
	zp := tzp;
	Crtc::PointToY(y1);
	Crtc::sp:=Crtc::sp+79;

	for k:=0 to 8 do
	begin
		ll:=zp^>>scroll;
		n:=0;//Crtc::sp[k];
		if (ll&1=1) then n:=c1;
		asm("
			ld de,$800
			ld hl,[Crtc_sp]
			ld a,[n]
			ld [hl],a
			add hl,de		
			ld [hl],a
			add hl,de		
			ld [hl],a
			add hl,de		
			ld [hl],a
			add hl,de		
			ld [hl],a

		");		

		Crtc::sp:=Crtc::sp+80;
		zp:=zp+40;		

	end;
/*	frame := frame +8 ;
	if (frame = 8) then
	begin*/
	//	frame := 0;
		scroll := scroll+1;
		if (scroll = 8) then
		begin
			scroll := 0;
			textp := textp+1;
			j:=textp^-64;
			tzp := #charset +j;
			if (textp^=32) then tzp := $B000;
			
			
		end;
//	end;

end;

procedure ScrollText();
begin
	y1:=greets_y-32;
	k:=0;
	if (c2x&1=0) then k:=2;

	
	for j:=0 to 54 do
	begin
		Crtc::PointToY(y1+k);
		zp:=Crtc::sp+1;
		Crtc::PointToY(y1);
		asm("
			ld de,[Crtc_sp]
			ld hl,[zp]

			ld bc,79
			call z80_copy_mem
;			
		");
	//	memcpy(zp,Crtc::sp,79);
		y1:=y1+2;
		
	end;
end;



procedure EffectGreets();
begin
	Compression::Decompress(#image2, screen);
	textp := #greets;
//	j:=textp -64;
	tzp := #charset + 0;
	j:=224; // Space
	scroll := 0;
	frame := 0;
	fill(^$B000,0,256);
	while (done = false) do
	begin
		while (ready = false) do
		begin
		
		end;
		RenderGreets();
		ScrollText();		
		c2x:=c2x+1;	
		ready := false;
	end;

end;