Mano pdp8 SymbolMano.cc

From Minor Miracle Software
Jump to: navigation, search

SymbolMano.cc

// SymbolMano Class

#ifndef SYMBOLMANO_CC
#define SYMBOLMANO_CC

#ifndef MANO_H
  #include "mano.h"
#endif

#ifndef CHAR_STRING_CC
  #include "charString.cc"
#endif

// Nested Label's are not allowed.
// tackle indirection later.
class SymbolMano {

    charString Label_charString_m; // Label.
    short MemoryAddress_short_m;   // Memory Address.
    short LC_short_m;              // LC Location Counter
    short Pointer_short_m;         // What it points to.
    short Pointee_short_m;         // What points to this.

public:

SymbolMano()
{
   MemoryAddress_short_m = -1;
   LC_short_m = 0;
   Pointer_short_m = -1;
   Pointee_short_m = -1;
}

~SymbolMano(){}

SymbolMano( const SymbolMano& B)
{
    Label_charString_m = B.Label_charString_m;
    MemoryAddress_short_m = B.MemoryAddress_short_m;
   LC_short_m = B.LC_short_m;
   Pointer_short_m = B.Pointer_short_m;
   Pointee_short_m = B.Pointee_short_m;
}

int operator != ( const SymbolMano &B )
{
if( DEBUG ) cout << "SymbolMano: != 0" << endl;

     return ( Label_charString_m != B.Label_charString_m );
}

int operator < ( const SymbolMano &B )
{
if( DEBUG ) cout << "SymbolMano: < 0" << endl;

     return ( Label_charString_m < B.Label_charString_m );
}

int operator > ( const SymbolMano &B )
{
if( DEBUG ) cout << "SymbolMano: > 0" << endl;

     return ( Label_charString_m > B.Label_charString_m );
}

SymbolMano operator = ( const SymbolMano &B )
{
if( DEBUG ) cout << "SymbolMano: = 0" << endl;

    Label_charString_m = B.Label_charString_m;
    MemoryAddress_short_m = B.MemoryAddress_short_m;
   LC_short_m = B.LC_short_m;
   Pointer_short_m = B.Pointer_short_m;
   Pointee_short_m = B.Pointee_short_m;

     return *this;
}

int operator == ( const SymbolMano &B )
{
if( DEBUG ) cout << "SymbolMano: == 0" << endl;

     return ( Label_charString_m == B.Label_charString_m );
}

	void FillSymbolMano( charString charString_A, short s_Location, short LC )
	{
	if( DEBUG ) cout << "SymbolMano: FillSymbolMano 0" << endl;

	     Label_charString_m = charString_A;
	     MemoryAddress_short_m = s_Location;
	     LC_short_m = LC;
	}

	charString returnLabel()
	{
	if( DEBUG ) cout << "SymbolMano: returnLabel 0" << endl;

	     return Label_charString_m;
	}

	short returnLocation()
	{
	if( DEBUG ) cout << "SymbolMano: returnLocation 0" << endl;

	     return MemoryAddress_short_m;
	}

	void SetPointer( short s )
	{
       Pointer_short_m = s;
	}

	short PointerTo()
	{
	 	return Pointer_short_m;
	}

	void SetPointee( short s )
	{
       Pointee_short_m = s;
	}

	short PointeeFrom()
	{
		return Pointee_short_m;
	}


	short GetLC( )
	{
		return LC_short_m;
	}


	void SetLC( short s )
	{
		LC_short_m = s;
	}


	int MultipleIndirection()
	{
		return ( Pointer_short_m && Pointee_short_m );
	}

};
#endif // SymbolMano

Internal Links

Parent Article: Mano PDP-8 Simulation Project Source Code