// rev 1.00
#pragma once

//test board
#include "vm1.h"
#include "vp1_037.h"
#include "qbus_irps.h"
#include "qbus_memory.h"

#include "Screen.h"
#include "FastDelegate.h"

#define BOARDMODEL11 0

class tboard
{
		CScreen *m_pScreen;

		CCommonBus  *m_pCMNB;    //объект МПИ
		C1801VM1    *m_pCPU;
#if (BOARDMODEL11)
		CVP1_037_014_BK11 *m_pVP1037;
		QBUS_Memory11 *m_pROMModule;
#else
		CVP1_037_014 *m_pVP1037;
		QBUS_Memory10 *m_pROMModule;
#endif

		QBUS_IRPS   *m_pIRPS;

		bool m_abReadAccess[64 * 1024];

		//IOPINS
		CCommonBus::CMNB_LINESET m_PIN_ACLO;
		CCommonBus::CMNB_LINESET m_PIN_DCLO;


		int         m_nClk;     //счётчик тактов, для лога
		int         m_nPhaseCounter;

		fastdelegate::FastDelegate0<> m_fdStartSeq;
		void START_SEQ_0();
		void START_SEQ_1();
	public:
		tboard();
		~tboard();
		void AttachDebugger(CDebugger *pDbg);
		CScreen *Getscreen() const
		{
			return m_pScreen;
		}
		bool init();

		void cpuInit();
		void screenCycle();
		int mainCycle();
		int mainCycle_p();
		int mainCycle_n();
};

