make the instructions jump over the BinaryCode end
This commit is contained in:
@ -26,7 +26,7 @@ module Arm
|
||||
end
|
||||
def test_mov_big
|
||||
code = @machine.mov :r0, 0x222 # is not 8 bit and can't be rotated by the arm system in one instruction
|
||||
Risc::Position.set(code,0, nil)
|
||||
Risc::Position.new(code,0)
|
||||
# mov 512(0x200) = e3 a0 0c 02 add 34(0x22) = e2 90 00 22
|
||||
assert_code code , :mov , [ 0x02,0x0c,0xb0,0xe3]
|
||||
assert_code code.next , :add , [ 0x22,0x00,0x90,0xe2]
|
||||
|
@ -5,7 +5,7 @@ module Risc
|
||||
def setup
|
||||
Risc.machine.boot
|
||||
@binary = Parfait::BinaryCode.new(1)
|
||||
@bin_pos = Position.new(@binary,0)
|
||||
@bin_pos = CodeListener.init(@binary,0)
|
||||
@instruction = DummyInstruction.new
|
||||
13.times {@instruction.last.insert(DummyInstruction.new) }
|
||||
@position = InstructionListener.init(@instruction , @binary)
|
||||
@ -28,5 +28,10 @@ module Risc
|
||||
@instruction.insert DummyInstruction.new
|
||||
assert_equal 76 , Position.get(@instruction.last).at
|
||||
end
|
||||
def test_pushes_after_insert
|
||||
@instruction.insert DummyInstruction.new
|
||||
@position.set(12)
|
||||
assert_equal 80 , Position.get(@instruction.last).at
|
||||
end
|
||||
end
|
||||
end
|
||||
|
@ -28,6 +28,12 @@ module Risc
|
||||
pos = @pos.set(10)
|
||||
assert_equal 10 , pos
|
||||
end
|
||||
def test_object_class_test
|
||||
assert_equal :object , @pos.object_class
|
||||
end
|
||||
def test_object_class_instr
|
||||
assert_equal :instruction , Position.new(Label.new("hi","ho",FakeAddress.new(1)),4).object_class
|
||||
end
|
||||
def test_at
|
||||
pos = Position.at(5)
|
||||
assert_equal 5 , pos.at
|
||||
|
Reference in New Issue
Block a user