Class: Tataru::Instructions::ValueRomInstruction

Inherits:
ImmediateModeInstruction show all
Includes:
RomReader
Defined in:
lib/tataru/instructions/value_rom_instruction.rb

Overview

sets a hash entry and resolves from rom what was set

Instance Attribute Summary

Attributes inherited from Tataru::Instruction

#memory

Instance Method Summary collapse

Methods included from RomReader

#resolve, #resolve_array, #resolve_hash, #resolve_output, #rom

Methods inherited from ImmediateModeInstruction

#initialize

Methods inherited from Tataru::Instruction

#execute, expects

Constructor Details

This class inherits a constructor from Tataru::Instructions::ImmediateModeInstruction

Instance Method Details

#rom_objectObject



16
17
18
19
20
# File 'lib/tataru/instructions/value_rom_instruction.rb', line 16

def rom_object
  raise 'Not found' unless rom.key? @param

  rom[@param]
end

#runObject



9
10
11
12
13
14
# File 'lib/tataru/instructions/value_rom_instruction.rb', line 9

def run
  return memory.error = 'No key set' unless memory.hash[:temp].key? :_key

  key = memory.hash[:temp].delete :_key
  memory.hash[:temp][key] = resolve(rom_object)
end