Class: Tataru::Instructions::CallInstruction
- Inherits:
-
ImmediateModeInstruction
- Object
- Tataru::Instruction
- ImmediateModeInstruction
- Tataru::Instructions::CallInstruction
- Defined in:
- lib/tataru/instructions/call_instruction.rb
Overview
pushes the callstack and branches
Instance Attribute Summary
Attributes inherited from Tataru::Instruction
Instance Method Summary collapse
Methods inherited from ImmediateModeInstruction
Methods inherited from Tataru::Instruction
Constructor Details
This class inherits a constructor from Tataru::Instructions::ImmediateModeInstruction
Instance Method Details
#run ⇒ Object
7 8 9 10 11 12 13 14 15 16 |
# File 'lib/tataru/instructions/call_instruction.rb', line 7 def run labels = memory.hash[:labels] unless labels.key? @param memory.error = 'Label not found' return end memory.call_stack.push(memory.program_counter) memory.program_counter = labels[@param] - 1 end |