MCPcopy Create free account
hub / github.com/devosoft/avida / Inst_WriteInst

Method Inst_WriteInst

avida-core/source/cpu/cHardwareCPU.cc:3158–3181  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

3156}
3157
3158bool cHardwareCPU::Inst_WriteInst(cAvidaContext& ctx)
3159{
3160 const int src = FindModifiedRegister(REG_CX);
3161 const int op1 = REG_BX;
3162 const int op2 = REG_AX;
3163
3164 cHeadCPU to(this, GetRegister(op2) + GetRegister(op1));
3165 const int value = Mod(GetRegister(src), m_inst_set->GetSize());
3166
3167 // Change value on a mutation... checkNoMutList is for head to head
3168 //kaboom experiments
3169 if (m_organism->TestCopyMut(ctx) && !(checkNoMutList(to))) {
3170 to.SetInst(m_inst_set->GetRandomInst(ctx));
3171 to.SetFlagMutated(); // Mark this instruction as mutated...
3172 to.SetFlagCopyMut(); // Mark this instruction as copy mut...
3173 } else {
3174 to.SetInst(Instruction(value));
3175 to.ClearFlagMutated(); // UnMark
3176 to.ClearFlagCopyMut(); // UnMark
3177 }
3178
3179 to.SetFlagCopied(); // Set the copied flag.
3180 return true;
3181}
3182
3183bool cHardwareCPU::Inst_StackReadInst(cAvidaContext&)
3184{

Callers

nothing calls this directly

Calls 11

ModFunction · 0.85
GetRandomInstMethod · 0.80
InstructionClass · 0.50
GetSizeMethod · 0.45
TestCopyMutMethod · 0.45
SetInstMethod · 0.45
SetFlagMutatedMethod · 0.45
SetFlagCopyMutMethod · 0.45
ClearFlagMutatedMethod · 0.45
ClearFlagCopyMutMethod · 0.45
SetFlagCopiedMethod · 0.45

Tested by

no test coverage detected