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
|
|
|
|
|
2014-04-25 10:56:53 +02:00
|
|
|
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
|