use fake memory

fix integer offset bug
(which only didn’t cause errors as fixnums are still an order too big
and the famous +1 error hit the empty space)
This commit is contained in:
Torsten Ruger
2018-05-28 15:09:59 +03:00
parent 6c06f61ab8
commit f9a89db10c
14 changed files with 42 additions and 20 deletions

View File

@ -51,7 +51,7 @@ module Risc
raise "No position #{pos.to_s(16)}" unless position
if position.is_a?(Position::CodePosition)
raise "Setting Code #{clock}-#{position}, #{position.method}"
#return set_pc(position.at + Parfait::BinaryCode.offset)
#return set_pc(position.at + Parfait::BinaryCode.byte_offset)
end
log.debug "Setting Position #{clock}-#{position}, #{position.binary}"
raise "not instruction position #{position}-#{position.class}-#{position.object.class}" unless position.is_a?(Position::InstructionPosition)
@ -120,7 +120,7 @@ module Risc
def execute_Branch
label = @instruction.label
pos = Position.get(label).at
pos += Parfait::BinaryCode.offset if label.is_a?(Parfait::BinaryCode)
pos += Parfait::BinaryCode.byte_offset if label.is_a?(Parfait::BinaryCode)
set_pc pos
false
end
@ -218,7 +218,7 @@ module Risc
meth = @instruction.method
at = Position.get(meth.binary).at
log.debug "Call to #{meth.name} at:#{at}"
set_pc(at + Parfait::BinaryCode.offset)
set_pc(at + Parfait::BinaryCode.byte_offset)
#set_instruction @instruction.method.risc_instructions
false
end