translate and interpret new instructions

This commit is contained in:
Torsten Ruger
2015-11-19 10:09:55 +02:00
parent ac5a7ac4ca
commit 249f43ad34
3 changed files with 63 additions and 6 deletions

View File

@ -148,6 +148,36 @@ module Register
true
end
def execute_GetByte
object = get_register( @instruction.array )
if( @instruction.index.is_a?(Numeric) )
index = @instruction.index
else
index = get_register(@instruction.index)
end
if object.is_a?(Symbol)
raise "Unsupported action, must convert symbol to word:#{object}"
else
value = object.get_internal_byte( index )
end
#value = value.object_id unless value.is_a? Fixnum
set_register( @instruction.register , value )
true
end
def execute_SetByte
value = get_register( @instruction.register )
object = get_register( @instruction.array )
if( @instruction.index.is_a?(Numeric) )
index = @instruction.index
else
index = get_register(@instruction.index)
end
object.set_internal_byte( index , value )
trigger(:object_changed, @instruction.array , index / 4 )
true
end
def execute_RegisterTransfer
value = get_register @instruction.from
set_register @instruction.to , value