2015-07-14 13:08:28 +02:00
|
|
|
|
|
|
|
require "opal"
|
2015-07-14 15:03:06 +02:00
|
|
|
require "opal-parser"
|
2018-04-03 18:35:25 +02:00
|
|
|
require 'opal/compiler'
|
2015-08-24 01:49:41 +02:00
|
|
|
|
2015-11-04 15:30:54 +01:00
|
|
|
require "logger"
|
2015-08-24 01:49:41 +02:00
|
|
|
require 'browser'
|
2015-10-21 13:03:56 +02:00
|
|
|
require 'browser/http'
|
2015-08-24 01:49:41 +02:00
|
|
|
require 'native'
|
2018-04-03 15:48:45 +02:00
|
|
|
require "rubyx"
|
2015-10-02 19:25:54 +02:00
|
|
|
require "ast"
|
2018-04-03 17:24:57 +02:00
|
|
|
require "util/eventable"
|
2018-04-03 15:48:45 +02:00
|
|
|
require "risc/interpreter"
|
2015-10-07 11:24:02 +02:00
|
|
|
# the base, our own litle framework, allows for child and parent views and handles updates
|
2015-08-24 01:49:41 +02:00
|
|
|
require "base/list_view"
|
2015-10-07 11:24:02 +02:00
|
|
|
# each seperate view is in it's own class.
|
2018-04-07 18:44:47 +02:00
|
|
|
require "views/left_view"
|
2015-10-19 18:56:35 +02:00
|
|
|
require "views/status_view"
|
2015-10-29 15:49:14 +01:00
|
|
|
require "views/source_view"
|
2015-10-19 18:56:35 +02:00
|
|
|
require "views/instruction_view"
|
|
|
|
require "views/registers_view"
|
2015-11-08 14:46:25 +01:00
|
|
|
class Bignum
|
|
|
|
end
|
2015-11-08 23:04:31 +01:00
|
|
|
class String
|
|
|
|
def codepoints
|
|
|
|
arr = []
|
|
|
|
one = nil
|
|
|
|
self.each_byte do |c|
|
|
|
|
if( one )
|
|
|
|
arr << (one + c * 256)
|
|
|
|
one = nil
|
|
|
|
else
|
|
|
|
one = c
|
|
|
|
end
|
|
|
|
end
|
|
|
|
arr
|
|
|
|
end
|
|
|
|
end
|
2015-08-24 01:49:41 +02:00
|
|
|
class MainView < ListView
|
2015-10-27 11:44:02 +01:00
|
|
|
include AST::Sexp
|
2015-08-24 01:49:41 +02:00
|
|
|
|
|
|
|
def initialize
|
2018-04-03 15:48:45 +02:00
|
|
|
Risc.machine.boot
|
|
|
|
@interpreter = Risc::Interpreter.new
|
2018-04-07 18:44:47 +02:00
|
|
|
super( [LeftView.new(@interpreter) ,
|
2015-10-29 15:49:14 +01:00
|
|
|
SourceView.new(@interpreter) ,
|
2015-08-24 01:49:41 +02:00
|
|
|
InstructionView.new(@interpreter) ,
|
|
|
|
StatusView.new(@interpreter) ,
|
|
|
|
RegistersView.new(@interpreter) ] )
|
|
|
|
end
|
|
|
|
|
|
|
|
end
|
2015-07-14 13:08:28 +02:00
|
|
|
|
2015-08-20 19:40:47 +02:00
|
|
|
view = MainView.new()
|
|
|
|
view.draw.append_to($document.body)
|