6c7e4c0fe2
before: r0-message , r1-self , r2-frame , r3-new_message , r4 + tmps now: r0-message , r1-new_message , r2 + tmps programs got smaller, less fuss also fix in return implementation that got the address from the wrong message
37 lines
743 B
Ruby
37 lines
743 B
Ruby
require_relative "../helper"
|
|
require "interpreter/interpreter"
|
|
|
|
module Ticker
|
|
def ticks num
|
|
last = nil
|
|
num.times do
|
|
last = @interpreter.instruction
|
|
@interpreter.tick
|
|
end
|
|
return last
|
|
end
|
|
|
|
def show_ticks
|
|
classes = []
|
|
error = nil
|
|
tick = 1
|
|
begin
|
|
while true and (classes.length < 100)
|
|
cl = ticks(1).class
|
|
tick += 1
|
|
classes << cl
|
|
break if cl == NilClass
|
|
end
|
|
rescue => e
|
|
puts "Error at tick #{tick}"
|
|
puts e
|
|
end
|
|
classes = classes.collect {|c| '"' + c.name.sub("Register::","") + '",' }
|
|
classes << "length = #{classes.length}"
|
|
classes.each_slice(5).each do |line|
|
|
puts " " + line.join
|
|
end
|
|
exit(1)
|
|
end
|
|
end
|