Sha256: 14e871711564af1811c518295caff9fc030f9800aa86022396a62d751984e368

Contents?: true

Size: 533 Bytes

Versions: 1

Compression:

Stored size: 533 Bytes

Contents

# frozen_string_literal: true

module Tataru
  module Instructions
    # sets a hash entry and resolves from rom what was set
    class ValueRomInstruction < ImmediateModeInstruction
      include RomReader

      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

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

        rom[@param]
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
tataru-0.2.0 lib/tataru/instructions/value_rom_instruction.rb