rubyx/lib/register/set_implementation.rb

22 lines
705 B
Ruby
Raw Normal View History

module Register
# This implements setting of the various slot variables the vm defines.
# Basic mem moves, but have to shuffle the type nibbles
2014-08-23 12:57:14 +02:00
class SetImplementation
def run block
block.codes.dup.each do |code|
next unless code.is_a? Virtual::Set
if( code.to.is_a? Virtual::NewMessageSlot)
2014-08-23 19:25:19 +02:00
to = RegisterReference.new(:r0)
tmp = RegisterReference.new(:r5)
move = RegisterMachine.instance.ldr( to , tmp , code.to.index )
block.replace(code , move )
2014-08-23 19:25:19 +02:00
else
raise "Start coding #{code.inspect}"
end
2014-08-23 12:57:14 +02:00
end
end
end
2014-08-24 20:32:21 +02:00
Virtual::BootSpace.space.add_pass_after SetImplementation , GetImplementation
2014-08-23 12:57:14 +02:00
end