class FutureLabel

FutureLabel is a label in memory that hasn't been defined yet and will go back and fill in the appropriate memory bytes later

Attributes

positions[RW]

Public Class Methods

new() click to toggle source
Calls superclass method Operand.new
# File lib/wilson.rb, line 1025
def initialize
  super
  self.positions = []
end

Public Instance Methods

add(aPosition) click to toggle source
# File lib/wilson.rb, line 1058
def add aPosition
  positions << aPosition
end
future_label?() click to toggle source
# File lib/wilson.rb, line 1054
def future_label?
  position.nil?
end
plant() click to toggle source
# File lib/wilson.rb, line 1030
def plant
  self.position = machine.stream.size

  positions.each do |each|
    size = machine.stream[each + 1]
    address = []
    case size
    when 2 then
      address.push_B(position - each - 2)
    when 3 then
      address.push_W(position - each - 3)
    when 5 then
      address.push_D(position - each - 5)
    else
      raise "unhandled size #{size}"
    end

    address.each_with_index do |byte, index|
      idx = each + index + 1
      machine.stream[idx] = byte
    end
  end
end