/*******************************************************************************************


      modified for DOS MHG dec 96


*******************************************************************************************/
#include <limits.h>
#include <string.h>

/* Used for accelerating copies */
//typedef long long EightByteType;
///typedef __int64 EightByteType;	// $NRM for MSVC. Will it work though?


/* Used to keep a count of total number of cycles executed */
typedef int CycleCountT;

#define CycleCountTMax INT_MAX

typedef struct
{
  		unsigned char eig[8];
} EightByteType;

typedef union
{
		unsigned char data[8];
  		EightByteType eightbyte;
} EightUChars;

typedef union
{
		unsigned char data[16];
  		EightByteType eightbytes[2];
} SixteenUChars;


#if 0
typedef struct
{
	unsigned char cols[8]; 			/* Beeb colour lookup */
}WINS;

WINS	mainwin0= { 0,1,1,1,1,1,1,1 };

WINS	*mainWin=&mainwin0;
#endif

class BeebWin
{
	int DataSize;

public:
	char * m_screen;

private:
  	//BOOL InitClass(void);
	//void CreateBeebWindow(void);

public:
	unsigned char cols[8]; /* Beeb colour lookup */
  	BeebWin();
	~BeebWin();
	char *imageData();
	int bytesPerLine() const;
	void updateLines(int starty, int nlines);

	void doHorizLine(unsigned long Col, int y, int sx, int width)
	{
		if (y>255) return;
	  	memset(m_screen+ (y* bytesPerLine()) + sx, Col , width);
  	}; /* doHorizLine */

	void doHorizLine(unsigned long Col, int offset, int width)
	{
		if ((offset+width)<bytesPerLine()*256) return;
		memset(m_screen+offset,Col,width);
	}; /* BeebWin::doHorizLine */

	EightUChars *GetLinePtr(int y);
	SixteenUChars *GetLinePtr16(int y);
}; /* BeebWin */

