labels dont need to have l_ as prefix anymore
parent
0989bd54f0
commit
0c2217168d
10
assembler.rb
10
assembler.rb
|
@ -39,6 +39,10 @@ class Assembler
|
||||||
def initialize(base, size)
|
def initialize(base, size)
|
||||||
@base_addr = base
|
@base_addr = base
|
||||||
@file_size = size
|
@file_size = size
|
||||||
|
|
||||||
|
@first_pass = true
|
||||||
|
@labels = {}
|
||||||
|
@bytes = []
|
||||||
end
|
end
|
||||||
|
|
||||||
def inspect
|
def inspect
|
||||||
|
@ -55,9 +59,9 @@ class Assembler
|
||||||
|
|
||||||
def method_missing(m, *args, &block)
|
def method_missing(m, *args, &block)
|
||||||
return 0 if @first_pass
|
return 0 if @first_pass
|
||||||
if m.to_s[0, 2] == "l_" then
|
if @labels.member?(m.to_s) then # if m.to_s[0, 2] == "l_" then
|
||||||
return @labels[m.to_s[2..]] if @labels.member?(m.to_s[2..])
|
return @labels[m.to_s] #return @labels[m.to_s[2..]] if @labels.member?(m.to_s[2..])
|
||||||
raise "label doesn't exist #{m.to_s}"
|
#raise "label doesn't exist #{m.to_s}"
|
||||||
else
|
else
|
||||||
super
|
super
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in New Issue