// ###########################################################################
// #
// # OSCAMathsAssist - Definition of OSCA Maths Assist Unit
// # Copyright (C) 2009-2011 Tony Friery [DialTone]
// #
// # ALL RIGHTS RESERVED
// #
// ###########################################################################

#ifndef OSCAMathsAssistH
#define OSCAMathsAssistH

#include "z80.h"

///////////////////////////////////////////////////////////////////////
//
//		Definition of Maths Assist Device Handler Class
//
///////////////////////////////////////////////////////////////////////

class TOSCAMathsAssist
{
	private:
		bool						fMathsDirty;
		short						fMathsEntries[256];		// Maths Table Array
		byte						fMultIndex;					// Index into Maths Table
		short						fMultValue;					// Multiplicand Value
		short						fMultResult;				// Result of Maths Operation

		void __fastcall		UpdateMathsResult(void);

	public:
		void __fastcall		WriteMathsTable(word Address, byte Value);
		void __fastcall		WriteMathsIndex(byte Value);
		void __fastcall		WriteMathsValueMSB(byte Value);
		void __fastcall		WriteMathsValueLSB(byte Value);
		byte __fastcall		GetMathsResultLSB(void);
		byte __fastcall		GetMathsResultMSB(void);
		void __fastcall		Reset(void);

		__fastcall 				TOSCAMathsAssist();
};

//---------------------------------------------------------------------------

#endif
