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

Method Inst_StackWriteInst

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

Source from the content-addressed store, hash-verified

3189}
3190
3191bool cHardwareCPU::Inst_StackWriteInst(cAvidaContext& ctx)
3192{
3193 const int dst = FindModifiedRegister(REG_BX);
3194 const int op1 = REG_AX;
3195 cHeadCPU to(this, GetRegister(op1) + GetRegister(dst));
3196 const int value = Mod(StackPop(), m_inst_set->GetSize());
3197
3198 // Change value on a mutation... checkNoMutList is for head to head kaboom experiments
3199 if (m_organism->TestCopyMut(ctx) && !(checkNoMutList(to))) {
3200 to.SetInst(m_inst_set->GetRandomInst(ctx));
3201 to.SetFlagMutated(); // Mark this instruction as mutated...
3202 to.SetFlagCopyMut(); // Mark this instruction as copy mut...
3203 } else {
3204 to.SetInst(Instruction(value));
3205 to.ClearFlagMutated(); // UnMark
3206 to.ClearFlagCopyMut(); // UnMark
3207 }
3208
3209 to.SetFlagCopied(); // Set the copied flag.
3210 return true;
3211}
3212
3213bool cHardwareCPU::Inst_Compare(cAvidaContext& ctx)
3214{

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