258 lines
5.0 KiB
C++
258 lines
5.0 KiB
C++
#include <as68hc11/instrctn.hpp>
|
|
|
|
Instruction::operator String(void)
|
|
{
|
|
String strInstruction;
|
|
|
|
strInstruction.reserve(1024);
|
|
for(int index=0;index<size();index++)strInstruction+=String("\n\t")+(String)operator[](index);
|
|
return strInstruction;
|
|
}
|
|
|
|
BOOL Instruction::hasInherentMode(void)const
|
|
{
|
|
WORD indexForm;
|
|
return hasInherentMode(indexForm);
|
|
}
|
|
|
|
BOOL Instruction::hasImmediateMode(void)const
|
|
{
|
|
WORD indexForm;
|
|
return hasImmediateMode(indexForm);
|
|
}
|
|
|
|
BOOL Instruction::hasDirectMode(void)const
|
|
{
|
|
WORD indexForm;
|
|
return hasDirectMode(indexForm);
|
|
}
|
|
|
|
BOOL Instruction::hasExtendedMode(void)const
|
|
{
|
|
WORD indexForm;
|
|
return hasExtendedMode(indexForm);
|
|
}
|
|
|
|
BOOL Instruction::hasRelativeMode(void)const
|
|
{
|
|
WORD indexForm;
|
|
return hasRelativeMode(indexForm);
|
|
}
|
|
|
|
BOOL Instruction::hasIndexedMode(void)const
|
|
{
|
|
WORD indexForm;
|
|
return hasIndexedMode(indexForm);
|
|
}
|
|
|
|
BOOL Instruction::hasPreByte(void)const
|
|
{
|
|
WORD indexForm;
|
|
return hasPreByte(indexForm);
|
|
}
|
|
|
|
BOOL Instruction::hasIndexedRelativeMaskMode(void)const
|
|
{
|
|
WORD indexForm;
|
|
return hasIndexedRelativeMaskMode(indexForm);
|
|
}
|
|
|
|
BOOL Instruction::hasDirectRelativeMaskMode(void)const
|
|
{
|
|
WORD indexForm;
|
|
return hasDirectRelativeMaskMode(indexForm);
|
|
}
|
|
|
|
BOOL Instruction::hasRelativeMaskMode(void)const
|
|
{
|
|
WORD indexForm;
|
|
return hasRelativeMaskMode(indexForm);
|
|
}
|
|
|
|
BOOL Instruction::hasMaskMode(void)const
|
|
{
|
|
WORD indexForm;
|
|
return hasMaskMode(indexForm);
|
|
}
|
|
|
|
BOOL Instruction::hasInherentMode(WORD &indexForm)const
|
|
{
|
|
AddressMode::Attribute attribute;
|
|
indexForm=0xFFFF;
|
|
|
|
for(int index=0;index<size();index++)
|
|
{
|
|
attribute=((Instruction&)*this).operator[](index).attribute();
|
|
if(AddressMode::Inherent&attribute)
|
|
{
|
|
indexForm=index;
|
|
return TRUE;
|
|
}
|
|
}
|
|
return FALSE;
|
|
}
|
|
|
|
BOOL Instruction::hasImmediateMode(WORD &indexForm)const
|
|
{
|
|
AddressMode::Attribute attribute;
|
|
|
|
indexForm=0xFFFF;
|
|
for(int index=0;index<size();index++)
|
|
{
|
|
attribute=((Instruction&)*this).operator[](index).attribute();
|
|
if(AddressMode::Immediate&attribute)
|
|
{
|
|
indexForm=index;
|
|
return TRUE;
|
|
}
|
|
}
|
|
return FALSE;
|
|
}
|
|
|
|
BOOL Instruction::hasDirectMode(WORD &indexForm)const
|
|
{
|
|
AddressMode::Attribute attribute;
|
|
|
|
indexForm=0xFFFF;
|
|
for(int index=0;index<size();index++)
|
|
{
|
|
attribute=((Instruction&)*this).operator[](index).attribute();
|
|
if(AddressMode::Direct&attribute)
|
|
{
|
|
indexForm=index;
|
|
return TRUE;
|
|
}
|
|
}
|
|
return FALSE;
|
|
}
|
|
|
|
BOOL Instruction::hasExtendedMode(WORD &indexForm)const
|
|
{
|
|
AddressMode::Attribute attribute;
|
|
|
|
indexForm=0xFFFF;
|
|
for(int index=0;index<size();index++)
|
|
{
|
|
attribute=((Instruction&)*this).operator[](index).attribute();
|
|
if(AddressMode::Extended&attribute)
|
|
{
|
|
indexForm=index;
|
|
return TRUE;
|
|
}
|
|
}
|
|
return FALSE;
|
|
}
|
|
|
|
BOOL Instruction::hasRelativeMode(WORD &indexForm)const
|
|
{
|
|
AddressMode::Attribute attribute;
|
|
|
|
indexForm=0xFFFF;
|
|
for(int index=0;index<size();index++)
|
|
{
|
|
attribute=((Instruction&)*this).operator[](index).attribute();
|
|
if(AddressMode::Relative&attribute)
|
|
{
|
|
indexForm=index;
|
|
return TRUE;
|
|
}
|
|
}
|
|
return FALSE;
|
|
}
|
|
|
|
BOOL Instruction::hasIndexedMode(WORD &indexForm)const
|
|
{
|
|
AddressMode::Attribute attribute;
|
|
|
|
indexForm=0xFFFF;
|
|
for(int index=0;index<size();index++)
|
|
{
|
|
attribute=((Instruction&)*this).operator[](index).attribute();
|
|
if(AddressMode::Indexed&attribute)
|
|
{
|
|
indexForm=index;
|
|
return TRUE;
|
|
}
|
|
}
|
|
return FALSE;
|
|
}
|
|
|
|
BOOL Instruction::hasIndexedRelativeMaskMode(WORD &indexForm)const
|
|
{
|
|
AddressMode::Attribute attribute;
|
|
|
|
indexForm=0xFFFF;
|
|
for(int index=0;index<size();index++)
|
|
{
|
|
attribute=((Instruction&)*this).operator[](index).attribute();
|
|
if((AddressMode::Indexed&attribute)&&(AddressMode::Relative&attribute)&&(AddressMode::Mask&attribute))
|
|
{
|
|
indexForm=index;
|
|
return TRUE;
|
|
}
|
|
}
|
|
return FALSE;
|
|
}
|
|
|
|
BOOL Instruction::hasDirectRelativeMaskMode(WORD &indexForm)const
|
|
{
|
|
AddressMode::Attribute attribute;
|
|
|
|
indexForm=0xFFFF;
|
|
for(int index=0;index<size();index++)
|
|
{
|
|
attribute=((Instruction&)*this).operator[](index).attribute();
|
|
if((AddressMode::Direct&attribute)&&(AddressMode::Relative&attribute)&&(AddressMode::Mask&attribute))
|
|
{
|
|
indexForm=index;
|
|
return TRUE;
|
|
}
|
|
}
|
|
return FALSE;
|
|
}
|
|
|
|
BOOL Instruction::hasRelativeMaskMode(WORD &indexForm)const
|
|
{
|
|
AddressMode::Attribute attribute;
|
|
|
|
indexForm=0xFFFF;
|
|
for(int index=0;index<size();index++)
|
|
{
|
|
attribute=((Instruction&)*this).operator[](index).attribute();
|
|
if((AddressMode::Relative&attribute)&&(AddressMode::Mask&attribute))
|
|
{
|
|
indexForm=index;
|
|
return TRUE;
|
|
}
|
|
}
|
|
return FALSE;
|
|
}
|
|
|
|
BOOL Instruction::hasMaskMode(WORD &indexForm)const
|
|
{
|
|
AddressMode::Attribute attribute;
|
|
|
|
indexForm=0xFFFF;
|
|
for(int index=0;index<size();index++)
|
|
{
|
|
attribute=((Instruction&)*this).operator[](index).attribute();
|
|
if(AddressMode::Mask&attribute)
|
|
{
|
|
indexForm=index;
|
|
return TRUE;
|
|
}
|
|
}
|
|
return FALSE;
|
|
}
|
|
|
|
BOOL Instruction::hasPreByte(WORD &indexForm)const
|
|
{
|
|
indexForm=0xFFFF;
|
|
for(int index=0;index<size();index++)if(((Instruction&)*this).operator[](index).prebyte())
|
|
{
|
|
indexForm=index;
|
|
return TRUE;
|
|
}
|
|
return FALSE;
|
|
}
|