linker and collector test work again
had to give space a fixed number of addresses
This commit is contained in:
@ -38,7 +38,7 @@ module Parfait
|
||||
add_type(cl.instance_type)
|
||||
end
|
||||
101.times { @integers = Integer.new(0,@integers) }
|
||||
10.times { @addresses = ReturnAddress.new(0,@addresses) }
|
||||
200.times { @addresses = ReturnAddress.new(0,@addresses) }
|
||||
message = Message.new(nil)
|
||||
50.times do
|
||||
@messages = Message.new message
|
||||
@ -69,9 +69,6 @@ module Parfait
|
||||
|
||||
# hand out a return address for use as constant the address is added
|
||||
def get_address
|
||||
10.times do # 10 for whole pages
|
||||
@next_address = ReturnAddress.new(0,@next_address)
|
||||
end unless @next_address.next_integer
|
||||
addr = @next_address
|
||||
@next_address = @next_address.next_integer
|
||||
addr
|
||||
|
@ -21,7 +21,7 @@ module Risc
|
||||
attr_reader :stdout, :state , :flags # somewhat like the lags on a cpu, hash sym => bool (zero .. . )
|
||||
|
||||
#start in state :stopped and set registers to unknown
|
||||
def initialize()
|
||||
def initialize( linker )
|
||||
@stdout , @clock , @pc , @state = "", 0 , 0 , :stopped
|
||||
@registers = {}
|
||||
@flags = { :zero => false , :plus => false ,
|
||||
@ -29,11 +29,12 @@ module Risc
|
||||
(0...12).each do |reg|
|
||||
set_register "r#{reg}".to_sym , "r#{reg}:unknown"
|
||||
end
|
||||
@linker = linker
|
||||
end
|
||||
|
||||
def start_machine
|
||||
def start_program
|
||||
initialize
|
||||
init = Risc.machine.cpu_init
|
||||
init = @linker.cpu_init
|
||||
set_state(:running)
|
||||
set_pc( Position.get(init).at )
|
||||
end
|
||||
|
@ -25,7 +25,7 @@ module Risc
|
||||
@cpu_init = cpu_init_init
|
||||
end
|
||||
|
||||
attr_reader :constants
|
||||
attr_reader :constants , :cpu_init
|
||||
attr_reader :platform , :assemblers
|
||||
|
||||
# machine keeps a list of all objects and their positions.
|
||||
@ -104,7 +104,6 @@ module Risc
|
||||
|
||||
def prerun
|
||||
assemblers.each do |asm|
|
||||
puts "method #{asm.method.name}"
|
||||
asm.instructions.each {|i| i.precheck }
|
||||
end
|
||||
end
|
||||
|
Reference in New Issue
Block a user