rubyx/lib/asm/label.rb

35 lines
510 B
Ruby
Raw Normal View History

2014-04-23 12:52:34 +02:00
module Asm
class Label
def initialize(name , asm)
@name = name
@asm = asm
@position = nil
end
attr_writer :position , :name
def position
if (@position.nil?)
raise 'Tried to use label object that has not been set'
end
@position
end
def at pos
@position = pos
end
def length
0
end
def assemble(io)
2014-04-23 12:52:34 +02:00
self.position = io.tell
end
def set!
@asm.add_value self
self
end
end
end