remove extra instruction and use next instead
was messing with binary writing as the assumption of 1 word writes is baked in
This commit is contained in:
@ -12,7 +12,7 @@ module Arm
|
||||
|
||||
# code is what the generator spits out, at least one instruction worth (.first)
|
||||
# the op code is wat was witten as assembler in the first place and the binary result
|
||||
def assert_code code , op , should
|
||||
def assert_code( code , op , should )
|
||||
assert_equal op , code.opcode
|
||||
io = StringIO.new
|
||||
code.assemble(io)
|
||||
|
@ -83,10 +83,12 @@ module Arm
|
||||
def test_too_big_add
|
||||
code = @machine.add :r1 , :r1, 0x222
|
||||
begin # add 0x02 (first instruction) and then 0x220 shifted
|
||||
assert_code code , :add , [0x02,0x1c,0x91,0xe2, 0x22,0x10,0x91,0xe2] #e2 91 1e 22
|
||||
assert_code code , :add , [0x02,0x1c,0x91,0xe2] #e2 91 1e 02
|
||||
rescue Risc::LinkException
|
||||
retry
|
||||
end
|
||||
# added extra instruction to add "extra"
|
||||
assert_code code.next , :add , [0x22,0x10,0x91,0xe2] #e2 91 10 22
|
||||
end
|
||||
|
||||
def label pos = 0x22 + 8
|
||||
|
@ -24,10 +24,11 @@ module Arm
|
||||
code = @machine.mov :r0, 0x222 # is not 8 bit and can't be rotated by the arm system in one instruction
|
||||
code.set_position(0)
|
||||
begin # mov 512(0x200) = e3 a0 0c 02 add 34(0x22) = e2 90 00 22
|
||||
assert_code code , :mov , [ 0x02,0x0c,0xb0,0xe3 , 0x22,0x00,0x90,0xe2]
|
||||
assert_code code , :mov , [ 0x02,0x0c,0xb0,0xe3]
|
||||
rescue Risc::LinkException
|
||||
retry
|
||||
end
|
||||
assert_code code.next , :add , [ 0x22,0x00,0x90,0xe2]
|
||||
end
|
||||
def test_mvn
|
||||
code = @machine.mvn :r1, 5
|
||||
|
Reference in New Issue
Block a user