start passing positions along inside the position code
This commit is contained in:
@ -78,7 +78,7 @@ module Risc
|
||||
translate_arm unless @translated
|
||||
#need the initial jump at 0 and then functions
|
||||
Position.set(binary_init,0)
|
||||
Position.set(cpu_init , 3 , binary_init)
|
||||
Position.set(cpu_init , 12 , binary_init)
|
||||
@code_start = position_objects( binary_init.padded_length )
|
||||
# and then everything code
|
||||
position_code
|
||||
|
@ -36,7 +36,7 @@ module Risc
|
||||
"0x#{@at.to_s(16)}"
|
||||
end
|
||||
# just a callback after creation AND insertion
|
||||
def init
|
||||
def init(pos)
|
||||
end
|
||||
def reset_to(pos)
|
||||
return false if pos == at
|
||||
@ -77,7 +77,7 @@ module Risc
|
||||
end
|
||||
position = for_at( object , pos , extra)
|
||||
self.positions[object] = position
|
||||
position.init
|
||||
position.init(pos)
|
||||
position
|
||||
end
|
||||
|
||||
@ -102,23 +102,17 @@ module Risc
|
||||
@binary = binary
|
||||
end
|
||||
|
||||
def set_position( position , binary = nil)
|
||||
raise "invalid position #{position}" if position > 15
|
||||
binary = Risc::Position.get(self).binary unless binary
|
||||
Risc::Position.set(self, position , binary)
|
||||
position += byte_length / 4 #assumes 4 byte instructions, as does the whole setup
|
||||
if self.next
|
||||
if( 3 == position % 15) # 12 is the amount of instructions that fit into a BinaryCode
|
||||
position = 3
|
||||
binary = binary.next
|
||||
end
|
||||
self.next.set_position( position , binary)
|
||||
else
|
||||
position
|
||||
def init(at)
|
||||
return unless instruction.next
|
||||
at += instruction.byte_length
|
||||
bin = binary
|
||||
if( 12 == at % 60)
|
||||
at = 12
|
||||
bin = binary.next
|
||||
end
|
||||
Position.set(instruction.next, at , binary)
|
||||
end
|
||||
|
||||
|
||||
def reset_to(pos)
|
||||
changed = super(pos)
|
||||
#puts "Reset (#{changed}) #{instruction}"
|
||||
@ -135,5 +129,9 @@ module Risc
|
||||
@code = code
|
||||
@method = method
|
||||
end
|
||||
def init(at)
|
||||
return unless code.next
|
||||
Position.set(code.next , at + code.padded_length, method)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
Reference in New Issue
Block a user