start with #14 by implementing factory

page was maybe a too low level name
pages may be the unit of the syscall, but after that objects desolve (maybe later to be added on from different pages)
Factory has the job of handing out a new instance of a type
it keeps a freelist for that and a reserve
This commit is contained in:
Torsten Ruger
2018-08-23 19:55:06 +03:00
parent 9687d6611f
commit d396da16e3
9 changed files with 172 additions and 20 deletions

View File

@ -45,7 +45,7 @@ module Risc
ret = main_ticks(64)
assert_equal FunctionReturn , ret.class
assert_equal :r1 , ret.register.symbol
assert_equal 26472 , @interpreter.get_register(ret.register)
assert_equal 27080 , @interpreter.get_register(ret.register)
end
end
end

View File

@ -54,7 +54,7 @@ module Risc
end
def test_pc1
@interpreter.tick
assert_equal 26136 , @interpreter.pc
assert_equal 26680 , @interpreter.pc
end
def test_tick2
@interpreter.tick
@ -68,7 +68,7 @@ module Risc
def test_pc2
@interpreter.tick
@interpreter.tick
assert_equal 26140 , @interpreter.pc
assert_equal 26684 , @interpreter.pc
end
def test_tick_14_jump
14.times {@interpreter.tick}

View File

@ -25,7 +25,7 @@ module Risc
assert_equal 0 , Position.get(@linker.cpu_init).at
end
def test_cpu_at
assert_equal "0x74cc" , Position.get(@linker.cpu_init.first).to_s
assert_equal "0x76ec" , Position.get(@linker.cpu_init.first).to_s
end
def test_cpu_label
assert_equal Position , Position.get(@linker.cpu_init.first).class