#include <cinstruction.h>
Public Member Functions | |
CInstruction (std::string name) | |
Default ctor. | |
virtual | ~CInstruction () |
Default dtor. | |
virtual bool | operator== (std::string &name) |
implementation of operator == | |
virtual CInstruction & | operator() (CCPU< T > *cpu) |
implementation of operator (CCPU) | |
virtual const std::string & | getName () |
returns instruction name | |
virtual std::ostream & | dump (std::ostream &stream) |
dumps information about instruction to outputstream | |
virtual const unsigned | parseRegister (const std::string &str) |
parses register syntax Rx (e.g. "R1") | |
virtual void | checkRegister (CCPU< T > *cpu, const unsigned regidx) |
performs a register boundary check does the register exist in cpu? | |
virtual CInstruction * | factory ()=0 |
creates a new instance of this instruction | |
virtual void | compile (std::list< std::string > ¶ms)=0 |
parses instruction parameters and prepares the instruction for executing | |
virtual void | execute (CCPU< T > *cpu)=0 |
executes the instruction | |
Protected Attributes | |
std::string | m_name |
Friends | |
std::ostream & | operator<< (std::ostream &stream, CInstruction &instr) |
Shift/output operator for outputstream. |
CInstruction< T >::CInstruction | ( | std::string | name | ) | [inline] |
Default ctor.
name | name of instruction |
none |
virtual CInstruction< T >::~CInstruction | ( | ) | [inline, virtual] |
Default dtor.
- |
none |
virtual bool CInstruction< T >::operator== | ( | std::string & | name | ) | [inline, virtual] |
implementation of operator ==
name | reference to std::string |
none |
virtual CInstruction& CInstruction< T >::operator() | ( | CCPU< T > * | cpu | ) | [inline, virtual] |
implementation of operator (CCPU)
cpu | pointer to cpu |
CInstructionError |
virtual const std::string& CInstruction< T >::getName | ( | ) | [inline, virtual] |
returns instruction name
- |
none |
virtual std::ostream& CInstruction< T >::dump | ( | std::ostream & | stream | ) | [inline, virtual] |
dumps information about instruction to outputstream
stream | outputstream |
none |
const unsigned CInstruction< T >::parseRegister | ( | const std::string & | str | ) | [inline, virtual] |
parses register syntax Rx (e.g. "R1")
str | register in assembler syntax |
CInstructionError |
void CInstruction< T >::checkRegister | ( | CCPU< T > * | cpu, | |
const unsigned | regidx | |||
) | [inline, virtual] |
performs a register boundary check does the register exist in cpu?
cpu | pointer to cpu | |
regidx | registernumber |
CInstructionError |
virtual CInstruction* CInstruction< T >::factory | ( | ) | [pure virtual] |
creates a new instance of this instruction
- |
none |
Implemented in CInstructionInc< T >, CInstructionDec< T >, CInstructionAdd< T >, CInstructionSub< T >, CInstructionMul< T >, CInstructionDiv< T >, CInstructionLoad< T >, CInstructionStore< T >, CInstructionTest< T >, CInstructionLabel< T >, CInstructionJumpA< T >, CInstructionJumpZ< T >, CInstructionJumpS< T >, and CInstructionWrite< T >.
virtual void CInstruction< T >::compile | ( | std::list< std::string > & | params | ) | [pure virtual] |
parses instruction parameters and prepares the instruction for executing
params | list of parameters of this instruction |
CInstructionError |
Implemented in CInstructionInc< T >, CInstructionDec< T >, CInstructionAdd< T >, CInstructionSub< T >, CInstructionMul< T >, CInstructionDiv< T >, CInstructionLoad< T >, CInstructionStore< T >, CInstructionTest< T >, CInstructionLabel< T >, CInstructionJumpA< T >, CInstructionJumpZ< T >, CInstructionJumpS< T >, and CInstructionWrite< T >.
virtual void CInstruction< T >::execute | ( | CCPU< T > * | cpu | ) | [pure virtual] |
executes the instruction
cpu | pointer to cpu |
CInstructionError |
Implemented in CInstructionInc< T >, CInstructionDec< T >, CInstructionAdd< T >, CInstructionSub< T >, CInstructionMul< T >, CInstructionDiv< T >, CInstructionLoad< T >, CInstructionStore< T >, CInstructionTest< T >, CInstructionLabel< T >, CInstructionJumpA< T >, CInstructionJumpZ< T >, CInstructionJumpS< T >, and CInstructionWrite< T >.
std::ostream& operator<< | ( | std::ostream & | stream, | |
CInstruction< T > & | instr | |||
) | [friend] |
Shift/output operator for outputstream.
stream | reference to outputstream | |
instr | object which will be printed to stream |
none |
std::string CInstruction< T >::m_name [protected] |
name of instruction