class Vm::Instructions::MemoryAccessOperations::ConstantOperation
Attributes
index[R]
Public Class Methods
new(index)
click to toggle source
# File lib/hackasm/vm/instructions/memory_access_operations/constant_operation.rb, line 8 def initialize(index) @index = index end
segments()
click to toggle source
# File lib/hackasm/vm/instructions/memory_access_operations/constant_operation.rb, line 24 def self.segments %w[constant] end
Public Instance Methods
to_asm()
click to toggle source
# File lib/hackasm/vm/instructions/memory_access_operations/constant_operation.rb, line 12 def to_asm %Q{ @#{index} D=A @SP A=M M=D @SP M=M+1 }.strip end