#include <bitset>

class X51
{	
public:
	unsigned char
		step,
		byte1,
		byte2,
		*Ram, 	//Data + SFR = 256 байт
		RA,
		RB,
		WRK,
		WRK1,
		WRK2,
		IR,
		*Reg,
		*Bit,
		*Idata,
		*Data,
		*SFR,
		*Stack,
		Code[65536],	
		Xdata[65536],
	    Rom[256];
	unsigned int
		DPTR,
		PC;
	std::bitset<8>
		PSW;
	
	static const unsigned char
		copAcall	 = 0x11,
		copLcall	 = 0x12,
		copMov_A_aR  = 0xE6,
		copRr		 = 0x03,
		copSetb_bit  = 0xD2,
		copSetb_C	 = 0xD3,
		copSubb_A_d  = 0x94,
		copSubb_A_aR = 0x96,
		copXch_ad	 = 0xC5,
		copXch_R	 = 0xC8,
		copXrl_ad_A  = 0x62,
		copXrl_ad_d  = 0x63;

	#define A  Ram[0xE0]
	#define B  Ram[0xF0]
	#define SP Ram[0x81]
	#define P0 Ram[0x80]
	#define P1 Ram[0x90]
	#define P2 Ram[0xA0]
	#define P3 Ram[0xB0]

	X51();
	~X51();
	unsigned char& R(const unsigned i);
	bool isP(unsigned char res);
	bool isOV(unsigned char res);
	bool isC();
	void Reset();
	void operator() ();
};
Соседние файлы в папке MyProject3