diff --git a/lib/risc/assembler.rb b/lib/risc/assembler.rb index 4cc47752..01f4a016 100644 --- a/lib/risc/assembler.rb +++ b/lib/risc/assembler.rb @@ -29,6 +29,21 @@ module Risc position_code_from( at ) end + def position_objects( at ) + at += 8 # thats the padding + # want to have the objects first in the executable + @objects.each do | id , objekt| + if objekt.is_a? Risc::Label # will get assembled as method.cpu_instructions + Positioned.set_position(objekt,at) + next + end + next if objekt.is_a? Parfait::BinaryCode + Positioned.set_position(objekt,at) + at += objekt.padded_length + end + at + end + def position_code_from( at ) @objects.each do |id , objekt| next unless objekt.is_a? Parfait::TypedMethod @@ -53,21 +68,6 @@ module Risc at end - def position_objects( at ) - at += 8 # thats the padding - # want to have the objects first in the executable - @objects.each do | id , objekt| - if objekt.is_a? Risc::Label # will get assembled as method.cpu_instructions - Positioned.set_position(objekt,at) - next - end - next if objekt.is_a? Parfait::BinaryCode - Positioned.set_position(objekt,at) - at += objekt.padded_length - end - at - end - # objects must be written in same order as positioned / assembled def write_as_string assemble