Sha256: 73ee71a300f02c3f26b2158fa7725503509995ba11bd80bf95cd081b2080c468

Contents?: true

Size: 466 Bytes

Versions: 1

Compression:

Stored size: 466 Bytes

Contents

module Vm
  module Instructions
    module MemoryAccessOperations
      class ConstantOperation

        attr_reader :index

        def initialize(index)
          @index = index
        end

        def to_asm
          %Q{
            @#{index}
            D=A
            @SP
            A=M
            M=D
            @SP
            M=M+1
          }.strip
        end

        def self.segments
          %w[constant]
        end
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
hackasm-0.1.0 lib/hackasm/vm/instructions/memory_access_operations/constant_operation.rb