/********************************************************************/
/* Kamui function test program subroutine							*/
/* string display routine for KAMUI									*/
/********************************************************************/
/*   COPYRIGHT (C) NEC Corporation 1997 - 1998                      */
/*   All rights reserved by NEC Corporation. This program must be   */
/*   used solely for the purpose for which it was furnished by NEC  */
/*   Corporation. No part of this program may be reproduced or      */
/*   disclosed to others, in any form, without the prior written    */
/*   permission of NEC Corporation.                                 */
/*   Use of copyright notice does not evidence publication of this  */
/*   program.                                                       */
/*                                                                  */
/*   Author   : Takeshi Muto / NEC Software, Ltd.                   */
/*   Created  : October 19 1997 by NEC Software, Ltd.               */
/*   Modified : April 9 1998 for SET5                               */
/********************************************************************/
#define		TEX_TYPE			KM_TEXTURE_ARGB4444		/* Font Texture type */
#define		TEXCHAR_U			(256)					/* Font Texture width */
#define		TEXCHAR_V			(256)					/* Font Texture height */
#define		CHAR_SIZE_X			(16.0f)					/* Font display size (width) */
#define		CHAR_SIZE_Y			(32.0f)					/* Font display size (height) */
#define		CHAR_PITCH			(-6.0f)					/* Character pitch 0=standard */
#define		LINE_PITCH			(-10.0f)				/* Line pitch 0=standard */

#include	<stdio.h>
#include	<stdarg.h>
#include	"kamui.h"				/* for Kamui Call */

extern const unsigned char character[];

typedef struct tagTXTATTRIB
{
	float	red;			/* color red */
	float	green;			/* color green */
	float	blue;			/* color blue */
	int		reverse;		/* reverse flag */
	int		blink;			/* blink flag */
} TXTATTRIB, *PTXTATTRIB;

/***************************************************************************/
/**	グローバル変数 *********************************************************/
/***************************************************************************/
#define	MAXLINE		21		/* = 480 / ( CHAR_SIZE_Y + LINE_PITCH ) */
#define	MAXCOLMN	64		/* = 640 / ( CHAR_SIZE_X + CHAR_PITCH ) */
static	KMUINT32	colmn = 0;			/* cursor x number */
static	KMUINT32	line = 0;			/* cursor y number */
static	KMUINT32	initialized = 0;	/* initialized ? or not ? */
static	KMUINT32	scrn[MAXCOLMN][MAXLINE];		/* screen image */
static	TXTATTRIB	attrib[MAXCOLMN][MAXLINE];		/* attribute */
static	float		colorRed	= 1.0f;	/* current color red */
static	float		colorGreen	= 1.0f;	/* current color green */
static	float		colorBlue	= 1.0f;	/* current color blue */
static	int			reverse		= 0;	/* current reverse flag */
static	int			blink		= 0;	/* current blink flag */
static	int			blinkcount	= 0;	/* current blink flag */
static	int			blinkspeed	= 30;	/* blink speed */
static	float		scaleX		= 1.0f;	/* character size scale X */
static	float		scaleY		= 1.0f;	/* character size scale Y */

/****************************************************************************/
/**	Valuables for KAMUI *****************************************************/
/****************************************************************************/
static	KMSURFACEDESC		kmiDispStrTexSurfaceDesc;	/* texture surface */
static	KMVERTEXCONTEXT		kmiDispStrVertexContext01;	/* Vertex context(Normal Object) */
static	KMVERTEXCONTEXT		kmiDispStrVertexContext02;	/* Vertex context(Reverse Object) */

/***************************************************************************/
/**	サブルーチン ***********************************************************/
/***************************************************************************/

/****************************************************************************/
/** Set Cursor **************************************************************/
/****************************************************************************/
void
txt_SetCursor(KMUINT32 x, KMUINT32 y)
{
	colmn = x; line = y;
}

/****************************************************************************/
/** Set Scale ***************************************************************/
/****************************************************************************/
void
txt_SetScale( float x, float y )
{
	scaleX = x;
	if( x <=  0.0f ) scaleX =  1.0f;
	if( x >  20.0f ) scaleX = 20.0f;
	scaleY = y;
	if( y <=  0.0f ) scaleY =  1.0f;
	if( y >  20.0f ) scaleY = 20.0f;
}

/****************************************************************************/
/** Set Color ***************************************************************/
/****************************************************************************/
void
txt_SetColor( float R, float G, float B )
{
	colorRed = R;
	if( R < 0.0f ) colorRed = 0.0f;
	if( R > 1.0f ) colorRed = 1.0f;
	colorGreen = G;
	if( G < 0.0f ) colorGreen = 0.0f;
	if( G > 1.0f ) colorGreen = 1.0f;
	colorBlue = B;
	if( B < 0.0f ) colorBlue = 0.0f;
	if( B > 1.0f ) colorBlue = 1.0f;
}

/****************************************************************************/
/** Set Reverce *************************************************************/
/****************************************************************************/
void
txt_SetReverce( int flag )
{
	if( flag == TRUE ) {
		reverse = 1;
	}
	else {
		reverse = 0;
	}
}

/****************************************************************************/
/** Set Blink ***************************************************************/
/****************************************************************************/
void
txt_SetBlink( int flag )
{
	if( flag == TRUE ) {
		blink = 1;
	}
	else {
		blink = 0;
	}
}

/****************************************************************************/
/** Set Blink speed *********************************************************/
/****************************************************************************/
void
txt_SetBlinkSpeed( int speed )
{
	blinkspeed = 30 - speed;
	if(blinkspeed <= 0) blinkspeed = 1;
	if(blinkspeed > 500) blinkspeed = 500;
}

/****************************************************************************/
/** Clear screen ************************************************************/
/****************************************************************************/
void
txt_ClearScreen(void)
{
	KMUINT32	x, y;

	for(y = 0; y < MAXLINE; y++) {
		for(x = 0; x < MAXCOLMN; x++) {
			scrn[x][y] = 0;
			attrib[x][y].red		= 1.0f;		/* color red */
			attrib[x][y].green		= 1.0f;		/* color green */
			attrib[x][y].blue		= 1.0f;		/* color blue */
			attrib[x][y].reverse	= 0;		/* reverse flag */
			attrib[x][y].blink		= 0;		/* blink flag */
		}
	}
	colmn = 0; line = 0;
}

void
txt_FreeDisplayString(void)
{
	KMSTATUS			status;						/* return status of KAMUI API */

	status = kmFreeTexture(&kmiDispStrTexSurfaceDesc);
}
/****************************************************************************/
/** Init Display String *****************************************************/
/****************************************************************************/
void
txt_InitDisplayString(void)
{
	KMSTATUS			status;						/* return status of KAMUI API */
	PKMDWORD			pTexture01;					/* Pointer to texture */
	KMTEXTURETYPE		nTextureType;				/* texture type definition */

	/*-----------------------------------------------------------------------------------*/
	/* Create texture surface */
	nTextureType = KM_TEXTURE_TWIDDLED | TEX_TYPE;	/* Set texture type */
	status = kmCreateTextureSurface(
		&kmiDispStrTexSurfaceDesc,		/* OUT	PKMSURFACEDESC	pSurfaceDesc */
		TEXCHAR_U,						/*	IN	KMINT32			nWidth */
		TEXCHAR_V,						/*	IN	KMINT32			nHeight */
		nTextureType					/*	IN	KMTEXTURETYPE	nTextureType */
	);
	if(status != KMSTATUS_SUCCESS) return;

	/*-----------------------------------------------------------------------------------*/
	/* Load and set texture */
	pTexture01 = (unsigned long *)&character;
	status = kmLoadTexture(&kmiDispStrTexSurfaceDesc,	/* PKMSURFACEDESC pSurfaceDesc */
							pTexture01 + (16 / sizeof(KMDWORD)),	/* PKMDWORD pTexture */
							FALSE,						/* KMBOOLEAN bAutoMipMap */
							FALSE						/* KMBOOLEAN bDither */
							);
	if(status != KMSTATUS_SUCCESS) return;

	/*-----------------------------------------------------------------------------------*/
	/* Initialize VertexContext 01 */

	/* Clear VertexContext */
	memset(&kmiDispStrVertexContext01,0,sizeof(KMVERTEXCONTEXT));

	/* 頂点CONTEXTの生成 */
	kmiDispStrVertexContext01.RenderState
								= KM_DEPTHMODE  		| KM_CULLINGMODE
								| KM_SCREENCOORDINATION	| KM_SHADINGMODE
								| KM_MODIFIER 			| KM_ZWRITEDISABLE
								| KM_SRCBLENDINGMODE	| KM_DSTBLENDINGMODE
								| KM_SRCSELECT			| KM_DSTSELECT
								| KM_FOGMODE			| KM_USESPECULAR
								| KM_USEALPHA			| KM_IGNORETEXTUREALPHA
								| KM_FLIPUV 			| KM_CLAMPUV
								| KM_FILTERMODE			| KM_SUPERSAMPLE
								| KM_MIPMAPDADJUST 		| KM_TEXTURESHADINGMODE
								| KM_PARAMTYPE 			| KM_LISTTYPE
								| KM_COLORTYPE			| KM_USESPECULAR
								| KM_UVFORMAT;

	/* for ParameterControlWord */
	kmiDispStrVertexContext01.ParamType				= KM_POLYGON;
	kmiDispStrVertexContext01.ListType				= KM_TRANS_POLYGON;
	kmiDispStrVertexContext01.ColorType				= KM_FLOATINGCOLOR;
	kmiDispStrVertexContext01.bUseSpecular			= FALSE;
	kmiDispStrVertexContext01.UVFormat				= KM_32BITUV;

	/* for ISP/TSP InstructionWord */
	kmiDispStrVertexContext01.DepthMode				= KM_GREATER;
	kmiDispStrVertexContext01.CullingMode			= KM_NOCULLING;
	kmiDispStrVertexContext01.ScreenCoordination	= KM_SCREEN;
	kmiDispStrVertexContext01.ShadingMode			= KM_TEXTUREGOURAUD;
	kmiDispStrVertexContext01.SelectModifier		= KM_NOMODIFIER;
	kmiDispStrVertexContext01.bZWriteDisable		= FALSE;			/* ARC1にはない */

	/* for TSP ControlWord */
	kmiDispStrVertexContext01.SRCBlendingMode		= KM_SRCALPHA;
	kmiDispStrVertexContext01.DSTBlendingMode		= KM_INVSRCALPHA;
	kmiDispStrVertexContext01.bSRCSel				= FALSE;			/* ARC1にはない */
	kmiDispStrVertexContext01.bDSTSel				= FALSE;			/* ARC1にはない */
	kmiDispStrVertexContext01.FogMode				= KM_NOFOG;			/* 11はリザーブ */
	kmiDispStrVertexContext01.bUseSpecular			= FALSE;
	kmiDispStrVertexContext01.bUseAlpha				= TRUE;
	kmiDispStrVertexContext01.FlipUV				= KM_NOFLIP;
	kmiDispStrVertexContext01.ClampUV				= KM_CLAMP_UV;
	kmiDispStrVertexContext01.FilterMode			= KM_POINT_SAMPLE;
	kmiDispStrVertexContext01.bSuperSample			= FALSE;
	kmiDispStrVertexContext01.MipMapAdjust			= 0x00000004;		/* D=1.00 */
	kmiDispStrVertexContext01.TextureShadingMode	= KM_MODULATE;

	/* for Texture ControlBit */

	/* No effect on ARC1 */
	kmiDispStrVertexContext01.bColorClamp		= FALSE;
	kmiDispStrVertexContext01.PaletteBank		= 0;

	/* Set texture surface */
	kmiDispStrVertexContext01.pTextureSurfaceDesc	= &kmiDispStrTexSurfaceDesc;

	/* for GlobalColorData */
	kmiDispStrVertexContext01.fFaceColorAlpha	= 1.0f;		/* Face Color Alpha */
	kmiDispStrVertexContext01.fFaceColorRed		= 1.0f;		/* Face Color Red */
	kmiDispStrVertexContext01.fFaceColorGreen	= 1.0f;		/* Face Color Green */
	kmiDispStrVertexContext01.fFaceColorBlue	= 1.0f;		/* Face Color Blue */
	kmiDispStrVertexContext01.fOffsetColorAlpha	= 1.0f;		/* Specular Color Alpha */
	kmiDispStrVertexContext01.fOffsetColorRed	= 1.0f;		/* Specular Color Red */
	kmiDispStrVertexContext01.fOffsetColorGreen	= 1.0f;		/* Specular Color Green */
	kmiDispStrVertexContext01.fOffsetColorBlue	= 1.0f;		/* Specular Color Blue */

	status = kmProcessVertexRenderState(&kmiDispStrVertexContext01);
	if(status != KMSTATUS_SUCCESS) return;

	/*-----------------------------------------------------------------------------------*/
	/* Initialize VertexContext 02 */

	/* Clear VertexContext */
	memset(&kmiDispStrVertexContext02,0,sizeof(KMVERTEXCONTEXT));

	/* 頂点CONTEXTの生成 */
	kmiDispStrVertexContext02.RenderState
								= KM_DEPTHMODE  		| KM_CULLINGMODE
								| KM_SCREENCOORDINATION	| KM_SHADINGMODE
								| KM_MODIFIER 			| KM_ZWRITEDISABLE
								| KM_SRCBLENDINGMODE	| KM_DSTBLENDINGMODE
								| KM_SRCSELECT			| KM_DSTSELECT
								| KM_FOGMODE			| KM_USESPECULAR
								| KM_USEALPHA			| KM_IGNORETEXTUREALPHA
								| KM_FLIPUV 			| KM_CLAMPUV
								| KM_FILTERMODE			| KM_SUPERSAMPLE
								| KM_MIPMAPDADJUST 		| KM_TEXTURESHADINGMODE
								| KM_PARAMTYPE 			| KM_LISTTYPE
								| KM_COLORTYPE			| KM_USESPECULAR
								| KM_UVFORMAT;

	/* for ParameterControlWord */
	kmiDispStrVertexContext02.ParamType				= KM_POLYGON;
	kmiDispStrVertexContext02.ListType				= KM_TRANS_POLYGON;
	kmiDispStrVertexContext02.ColorType				= KM_FLOATINGCOLOR;
	kmiDispStrVertexContext02.bUseSpecular			= FALSE;
	kmiDispStrVertexContext02.UVFormat				= KM_32BITUV;

	/* for ISP/TSP InstructionWord */
	kmiDispStrVertexContext02.DepthMode				= KM_GREATER;
	kmiDispStrVertexContext02.CullingMode			= KM_NOCULLING;
	kmiDispStrVertexContext02.ScreenCoordination	= KM_SCREEN;
	kmiDispStrVertexContext02.ShadingMode			= KM_TEXTUREGOURAUD;
	kmiDispStrVertexContext02.SelectModifier		= KM_NOMODIFIER;
	kmiDispStrVertexContext02.bZWriteDisable		= FALSE;			/* ARC1にはない */

	/* for TSP ControlWord */
	kmiDispStrVertexContext02.SRCBlendingMode		= KM_INVSRCALPHA;
	kmiDispStrVertexContext02.DSTBlendingMode		= KM_SRCALPHA;
	kmiDispStrVertexContext02.bSRCSel				= FALSE;			/* ARC1にはない */
	kmiDispStrVertexContext02.bDSTSel				= FALSE;			/* ARC1にはない */
	kmiDispStrVertexContext02.FogMode				= KM_NOFOG;			/* 11はリザーブ */
	kmiDispStrVertexContext02.bUseSpecular			= FALSE;
	kmiDispStrVertexContext02.bUseAlpha				= TRUE;
	kmiDispStrVertexContext02.FlipUV				= KM_NOFLIP;
	kmiDispStrVertexContext02.ClampUV				= KM_CLAMP_UV;
	kmiDispStrVertexContext02.FilterMode			= KM_POINT_SAMPLE;
	kmiDispStrVertexContext02.bSuperSample			= FALSE;
	kmiDispStrVertexContext02.MipMapAdjust			= 0x00000004;		/* D=1.00 */
	kmiDispStrVertexContext02.TextureShadingMode	= KM_MODULATE;

	/* for Texture ControlBit */

	/* No effect on ARC1 */
	kmiDispStrVertexContext02.bColorClamp		= FALSE;
	kmiDispStrVertexContext02.PaletteBank		= 0;

	/* Set texture surface */
	kmiDispStrVertexContext02.pTextureSurfaceDesc	= &kmiDispStrTexSurfaceDesc;

	/* for GlobalColorData */
	kmiDispStrVertexContext02.fFaceColorAlpha	= 1.0f;		/* Face Color Alpha */
	kmiDispStrVertexContext02.fFaceColorRed		= 1.0f;		/* Face Color Red */
	kmiDispStrVertexContext02.fFaceColorGreen	= 1.0f;		/* Face Color Green */
	kmiDispStrVertexContext02.fFaceColorBlue	= 1.0f;		/* Face Color Blue */
	kmiDispStrVertexContext02.fOffsetColorAlpha	= 1.0f;		/* Specular Color Alpha */
	kmiDispStrVertexContext02.fOffsetColorRed	= 1.0f;		/* Specular Color Red */
	kmiDispStrVertexContext02.fOffsetColorGreen	= 1.0f;		/* Specular Color Green */
	kmiDispStrVertexContext02.fOffsetColorBlue	= 1.0f;		/* Specular Color Blue */

	status = kmProcessVertexRenderState(&kmiDispStrVertexContext02);
	if(status != KMSTATUS_SUCCESS) return;

	initialized = 1;	/* set initialize flag */
}

/****************************************************************************/
/** Display String **********************************************************/
/****************************************************************************/
void
txt_DispString(char *instring,...)
{
	KMINT32		i = 0;
	KMINT32		j;

	char		string[4096];
	va_list		vaArgs;

/*--
	if(initialized == 0) return;
--*/

	va_start (vaArgs, instring);
	vsprintf (string, instring, vaArgs);

	do{
		if(string[i] == '\n') {
			for(j = colmn; j < MAXCOLMN; j++) {
				scrn[j][line] = 0;
			}
			colmn = 0; line++;
			if(line >= MAXLINE) {
				line = 0;
			}
		}
		else if(string[i] >= ' ') {
			scrn[colmn][line]			= string[i];	/* set character */
			attrib[colmn][line].red		= colorRed;		/* set current color red */
			attrib[colmn][line].green	= colorGreen;	/* set current color green */
			attrib[colmn][line].blue	= colorBlue;	/* set current color blue */
			attrib[colmn][line].reverse	= reverse;		/* set current reverse flag */
			attrib[colmn][line].blink	= blink;		/* set current blink flag */
			colmn++;
			if(colmn >= MAXCOLMN) {
				colmn = 0; line++;
				if(line >= MAXLINE) {
					line = 0;
				}
			}
		}
		else {
			scrn[colmn][line] = 0;
			colmn++;
			if(colmn >= MAXCOLMN) {
				colmn = 0; line++;
				if(line >= MAXLINE) {
					line = 0;
				}
			}
		}
	} while(string[++i] != 0);
}

/****************************************************************************/
/** Display String **********************************************************/
/****************************************************************************/
void
txt_DispScreen(KMVERTEXBUFFDESC BufferDesc)
{
	KMINT32			x, y;
	KMVERTEX_05		Ver[4];
	KMSTATUS		status;		/* return status of KAMUI API */

	float		x_scale, y_scale, x_size, y_size;

	if(initialized == 0) return;

	x_scale	= (CHAR_SIZE_X + CHAR_PITCH) * scaleX;
	y_scale	= (CHAR_SIZE_Y + LINE_PITCH) * scaleY;
	x_size	= CHAR_SIZE_X * scaleX;
	y_size	= CHAR_SIZE_Y * scaleY;

	for(y = 0; y < MAXLINE; y++) {
		for(x = 0; x < MAXCOLMN; x++) {
			if(scrn[x][y] >= ' ') {

				if(attrib[x][y].reverse == 0) {	/* Normal */
					status = kmSetVertexRenderState(&kmiDispStrVertexContext01);
					if(status != KMSTATUS_SUCCESS) return;
				}
				else {	/* Reverce */
					status = kmSetVertexRenderState(&kmiDispStrVertexContext02);
					if(status != KMSTATUS_SUCCESS) return;
				}

				if((attrib[x][y].blink == 0)||(blinkcount > 0))
				{

					status = kmStartVertexStrip(&BufferDesc);
					if(status != KMSTATUS_SUCCESS) return;

					Ver[0].ParamControlWord	= KM_VERTEXPARAM_NORMAL;
					Ver[0].fX	= x * x_scale;	Ver[0].fY	= y * y_scale + y_size;
#if defined(_STRICT_UNION_)
					Ver[0].u.fZ	= 256.0f;
#else
					Ver[0].fZ	= 256.0f;
#endif
					Ver[0].fU	= 0.0625f * ((scrn[x][y] - 32) % 16);
					Ver[0].fV	= 0.125f * ( 7.0f - (float)((scrn[x][y] - 32) / 16));
					Ver[0].fBaseAlpha	= 1.0f;	Ver[0].fBaseRed	= attrib[x][y].red;	Ver[0].fBaseGreen	= attrib[x][y].green;	Ver[0].fBaseBlue	= attrib[x][y].blue;
					Ver[0].fOffsetAlpha	= 0.0f;	Ver[0].fOffsetRed	= 0.0f;	Ver[0].fOffsetGreen	= 0.0f;	Ver[0].fOffsetBlue	= 0.0f;
					status = kmSetVertex(&BufferDesc,&Ver[0],KM_VERTEXTYPE_05,sizeof(KMVERTEX5) );
					if(status != KMSTATUS_SUCCESS) return;

					Ver[1].ParamControlWord	= KM_VERTEXPARAM_NORMAL;
					Ver[1].fX	= x * x_scale;	Ver[1].fY	= y * y_scale;
#if defined(_STRICT_UNION_)
					Ver[1].u.fZ	= 256.0f;
#else
					Ver[1].fZ	= 256.0f;
#endif
					Ver[1].fU	= Ver[0].fU;
					Ver[1].fV	= Ver[0].fV + 0.125f;
					Ver[1].fBaseAlpha	= 1.0f;	Ver[1].fBaseRed	= attrib[x][y].red;	Ver[1].fBaseGreen	= attrib[x][y].green;	Ver[1].fBaseBlue	= attrib[x][y].blue;
					Ver[1].fOffsetAlpha	= 0.0f;	Ver[1].fOffsetRed	= 0.0f;	Ver[1].fOffsetGreen	= 0.0f;	Ver[1].fOffsetBlue	= 0.0f;
					status = kmSetVertex(&BufferDesc,&Ver[1],KM_VERTEXTYPE_05,sizeof(KMVERTEX5) );
					if(status != KMSTATUS_SUCCESS) return;

					Ver[2].ParamControlWord	= KM_VERTEXPARAM_NORMAL;
					Ver[2].fX	= x * x_scale + x_size;	Ver[2].fY	= Ver[0].fY;
#if defined(_STRICT_UNION_)
					Ver[2].u.fZ	= 256.0f;
#else
					Ver[2].fZ	= 256.0f;
#endif
					Ver[2].fU	= Ver[0].fU + 0.0625f;
					Ver[2].fV	= Ver[0].fV;
					Ver[2].fBaseAlpha	= 1.0f;	Ver[2].fBaseRed	= attrib[x][y].red;	Ver[2].fBaseGreen	= attrib[x][y].green;	Ver[2].fBaseBlue	= attrib[x][y].blue;
					Ver[2].fOffsetAlpha	= 0.0f;	Ver[2].fOffsetRed	= 0.0f;	Ver[2].fOffsetGreen	= 0.0f;	Ver[2].fOffsetBlue	= 0.0f;
					status = kmSetVertex(&BufferDesc,&Ver[2],KM_VERTEXTYPE_05,sizeof(KMVERTEX5) );
					if(status != KMSTATUS_SUCCESS) return;

					Ver[3].ParamControlWord	= KM_VERTEXPARAM_ENDOFSTRIP;
					Ver[3].fX	= Ver[2].fX;	Ver[3].fY	= Ver[1].fY;
#if defined(_STRICT_UNION_)
					Ver[3].u.fZ	= 256.0f;
#else
					Ver[3].fZ	= 256.0f;
#endif
					Ver[3].fU	= Ver[2].fU;
					Ver[3].fV	= Ver[1].fV;
					Ver[3].fBaseAlpha	= 1.0f;	Ver[3].fBaseRed	= attrib[x][y].red;	Ver[3].fBaseGreen	= attrib[x][y].green;	Ver[3].fBaseBlue	= attrib[x][y].blue;
					Ver[3].fOffsetAlpha	= 0.0f;	Ver[3].fOffsetRed	= 0.0f;	Ver[3].fOffsetGreen	= 0.0f;	Ver[3].fOffsetBlue	= 0.0f;
					status = kmSetVertex(&BufferDesc,&Ver[3],KM_VERTEXTYPE_05,sizeof(KMVERTEX5) );
					if(status != KMSTATUS_SUCCESS) return;
				}	/* End of if((attrib[x][y].blink == 0)||(blinkcount > 0)) */
			}	/* End of if(scrn[x][y] >= ' ') */
		}	/* End of for(x = 0; x < MAXCOLMN; x++) */
	}	/* End of for(y = 0; y < MAXLINE; y++) */

	if(--blinkcount < -blinkspeed) blinkcount = blinkspeed;
}

/*--------------------------- End of File --------------------------------*/