103 lines
2.7 KiB
C++
103 lines
2.7 KiB
C++
#ifndef _AS68HC11_INSTRUCTION_HPP_
|
|
#define _AS68HC11_INSTRUCTION_HPP_
|
|
#ifndef _AS68HC11_ADDRESSMODE_HPP_
|
|
#include <as68hc11/mode.hpp>
|
|
#endif
|
|
#ifndef _COMMON_ARRAY_HPP_
|
|
#include <common/array.hpp>
|
|
#endif
|
|
|
|
class Instruction : public Array<AddressMode>
|
|
{
|
|
public:
|
|
enum RegisterLength{SingleByte,DoubleByte,NotApplicable};
|
|
Instruction(void);
|
|
Instruction(const Instruction &someInstruction);
|
|
Instruction(int count,RegisterLength registerLength=NotApplicable,...);
|
|
virtual ~Instruction();
|
|
Instruction &operator=(const Instruction &someInstruction);
|
|
BOOL operator==(const Instruction &someInstruction)const;
|
|
operator String(void);
|
|
RegisterLength registerLength(void)const;
|
|
void registerLength(RegisterLength registerLength);
|
|
BOOL hasInherentMode(void)const;
|
|
BOOL hasImmediateMode(void)const;
|
|
BOOL hasDirectMode(void)const;
|
|
BOOL hasExtendedMode(void)const;
|
|
BOOL hasRelativeMode(void)const;
|
|
BOOL hasIndexedMode(void)const;
|
|
BOOL hasIndexedRelativeMaskMode(void)const;
|
|
BOOL hasDirectRelativeMaskMode(void)const;
|
|
BOOL hasRelativeMaskMode(void)const;
|
|
BOOL hasMaskMode(void)const;
|
|
BOOL hasPreByte(void)const;
|
|
BOOL hasInherentMode(WORD &indexForm)const;
|
|
BOOL hasImmediateMode(WORD &indexForm)const;
|
|
BOOL hasDirectMode(WORD &indexForm)const;
|
|
BOOL hasExtendedMode(WORD &indexForm)const;
|
|
BOOL hasRelativeMode(WORD &indexForm)const;
|
|
BOOL hasIndexedMode(WORD &indexForm)const;
|
|
BOOL hasIndexedRelativeMaskMode(WORD &indexForm)const;
|
|
BOOL hasDirectRelativeMaskMode(WORD &indexForm)const;
|
|
BOOL hasRelativeMaskMode(WORD &indexForm)const;
|
|
BOOL hasMaskMode(WORD &indexForm)const;
|
|
BOOL hasPreByte(WORD &indexForm)const;
|
|
private:
|
|
RegisterLength mRegisterLength;
|
|
};
|
|
|
|
inline
|
|
Instruction::Instruction(void)
|
|
: mRegisterLength(NotApplicable)
|
|
{
|
|
}
|
|
|
|
inline
|
|
Instruction::Instruction(int count,RegisterLength registerLength,...)
|
|
: mRegisterLength(registerLength)
|
|
{
|
|
va_list varList;
|
|
|
|
size(count);
|
|
va_start(varList,registerLength);
|
|
for(int index=0;index<count;index++)Array<AddressMode>::operator[](index)=va_arg(varList,AddressMode);
|
|
}
|
|
|
|
inline
|
|
Instruction::Instruction(const Instruction &someInstruction)
|
|
{
|
|
*this=someInstruction;
|
|
}
|
|
|
|
inline
|
|
Instruction::~Instruction()
|
|
{
|
|
}
|
|
|
|
inline
|
|
Instruction &Instruction::operator=(const Instruction &someInstruction)
|
|
{
|
|
Array<AddressMode>::operator=(someInstruction);
|
|
registerLength(someInstruction.registerLength());
|
|
return *this;
|
|
}
|
|
|
|
inline
|
|
BOOL Instruction::operator==(const Instruction &someInstruction)const
|
|
{
|
|
return (Array<AddressMode>::operator==(someInstruction)&&
|
|
registerLength()==someInstruction.registerLength());
|
|
}
|
|
|
|
inline
|
|
Instruction::RegisterLength Instruction::registerLength(void)const
|
|
{
|
|
return mRegisterLength;
|
|
}
|
|
|
|
inline
|
|
void Instruction::registerLength(RegisterLength registerLength)
|
|
{
|
|
mRegisterLength=registerLength;
|
|
}
|
|
#endif |