fix interpreter to handle registers in set

This commit is contained in:
Torsten Ruger 2015-11-09 23:25:34 +02:00
parent 9075f1af37
commit dd7973875c

View File

@ -76,7 +76,7 @@ module Interpreter
return unless @instruction return unless @instruction
@clock += 1 @clock += 1
name = @instruction.class.name.split("::").last name = @instruction.class.name.split("::").last
log.debug "#{@clock}: #{@instruction}" log.debug "#{@clock.to_s}: #{@instruction.to_s}"
fetch = send "execute_#{name}" fetch = send "execute_#{name}"
return unless fetch return unless fetch
set_instruction @instruction.next set_instruction @instruction.next
@ -131,11 +131,12 @@ module Interpreter
value = get_register( @instruction.register ) value = get_register( @instruction.register )
object = get_register( @instruction.array ) object = get_register( @instruction.array )
if( @instruction.index.is_a?(Numeric) ) if( @instruction.index.is_a?(Numeric) )
object.set_internal( @instruction.index , value ) index = @instruction.index
else else
object.set_internal( get_register(@instruction.index) , value ) index = get_register(@instruction.index)
end end
trigger(:object_changed, @instruction.array , @instruction.index) object.set_internal( index , value )
trigger(:object_changed, @instruction.array , index)
true true
end end