PROCEDURE faltkarte;

VAR
	
	pageWidth:	REAL;
	pageHeight:	REAL;
	pageFold: REAL;
	abstand: REAL;
	a: INTEGER;
	v: REAL;
	height: REAL;
	
{*streifen*}

PROCEDURE streifen;
	VAR 
		i:INTEGER;

	BEGIN
		FOR i:=1 TO a DO BEGIN;

			moveto(abstand+((i-1)*(3*v)),height);
			lineto(abstand+((i-1)*(3*v)),3*height);
			moveto(abstand+(2*v)+((i-1)*(3*v)),height);
			lineto(abstand+(2*v)+((i-1)*(3*v)),3*height);

			moveto(abstand+v+((i-1)*(3*v)),height+(i*v));
			lineto(abstand+v+((i-1)*(3*v)),3*height-(i*v));

		END;

	END;

PROCEDURE faltkanten;
	VAR 
		i:INTEGER;	

	BEGIN
		FOR i:=1 TO a DO BEGIN
			moveto(abstand+v+((i-1)*(3*v)),height+(i*v));
			lineto(abstand+(2*v)+((i-1)*(3*v)),height+(i*v));
			moveto(abstand+v+((i-1)*(3*v)),3*height-(i*v));
			lineto(abstand+(2*v)+((i-1)*(3*v)),3*height-(i*v));
		END;
	END;

PROCEDURE faltkanten2;
	VAR 
		i:INTEGER;	

	BEGIN
		FOR i:=1 TO a DO BEGIN
			moveto(abstand+((i-1)*(3*v)),height);
			lineto(abstand+(2*v)+((i-1)*(3*v)),height);
			moveto(abstand+((i-1)*(3*v)),3*height);
			lineto(abstand+(2*v)+((i-1)*(3*v)),3*height);
		END;
	END;

BEGIN
	
	{*Variablen berechnen*}
	pageWidth:=210;
	pageHeight:=297;
	pageFold:= pageHeight/2;
	abstand:=12;
	a:=12;
	v:=(pageWidth-(2*abstand))  /((a*3)-1);
	height:=pageHeight/4;

	

	{*Stift einstellen*}
	penPat(2);
	penFore(0,0,65535);
	
	{*blatt zeichnen*}
	moveto(0,0);
	lineto(pageWidth,0);
	lineto(pageWidth,pageHeight);
	lineto(0,pageHeight);
	lineto(0,0);

	streifen;

	{*Stift einstellen*}
	penFore(65535,0,0);
	penPat(-2);

	{*faltkanten zeichen*}
	faltkanten;

	faltkanten2;

	moveto(0,pageFold);
	lineto(PageWidth,pageFold);

	{*faltkanten in streifen*}

END;

RUN(faltkarte);