diff --git a/app/main/controllers/main_controller.rb b/app/main/controllers/main_controller.rb index d854f33..aef52a3 100644 --- a/app/main/controllers/main_controller.rb +++ b/app/main/controllers/main_controller.rb @@ -12,16 +12,16 @@ module Main init_blocks end - def about - # Add code for when the about view is loaded + def tick + @interpreter.tick end private def init_machine machine = Virtual.machine.boot - machine.run_before "Register::CallImplementation" code = Ast::ExpressionList.new( [Ast::CallSiteExpression.new(:putstring, [] ,Ast::StringExpression.new("Hello again"))]) Virtual::Compiler.compile( code , machine.space.get_main ) + machine.run_before "Register::CallImplementation" @interpreter = Interpreter.new @interpreter.start machine.init end diff --git a/app/main/models/blocks_model.rb b/app/main/models/blocks_model.rb index 812999f..05fd0d5 100644 --- a/app/main/models/blocks_model.rb +++ b/app/main/models/blocks_model.rb @@ -1,8 +1,10 @@ class BlocksModel < Volt::ArrayModel def instruction_changed old , ins - self.last._class_name = "" if( page._blocks.length > 0) - self << { :name => ins.to_s , :class_name => "active" } + self.last._class_name = "inactive" if( self.length > 0) + self << { :name => ins.to_s , :class_name => "bright" } + puts "block #{self.length}" + self.delete_at(0) if( self.length > 5) end end diff --git a/app/main/models/register_model.rb b/app/main/models/register_model.rb index c54ccf4..e6d2bd1 100644 --- a/app/main/models/register_model.rb +++ b/app/main/models/register_model.rb @@ -3,7 +3,7 @@ class RegisterModel < Volt::Model field :value def register_changed reg , old , ins - self.last._class_name = "" if( page._blocks.length > 0) + self.last._class_name = "" if( self.length > 0) self << { :name => ins.to_s , :class_name => "active" } end diff --git a/app/main/views/main/index.html b/app/main/views/main/index.html index 7a01b7d..c2c5930 100644 --- a/app/main/views/main/index.html +++ b/app/main/views/main/index.html @@ -28,13 +28,14 @@ {{ page._blocks.each do |b| }}