more work on instrucitons, mov this time
This commit is contained in:
@@ -83,5 +83,27 @@ module Arm
|
||||
return nil
|
||||
end
|
||||
end
|
||||
|
||||
#slighly wrong place for this code, but since the module gets included in instructions anyway . . .
|
||||
# implement the barrel shifter on the operand (which is set up before as an integer)
|
||||
def shift_handling
|
||||
#codes that one can shift, first two probably most common.
|
||||
# l (in lsr) means logical, ie unsigned, a (in asr) is arithmetic, ie signed
|
||||
{'lsl' => 0b000, 'lsr' => 0b010, 'asr' => 0b100, 'ror' => 0b110, 'rrx' => 0b110}.each do |short, bin|
|
||||
long = "shift_#{short}".to_sym
|
||||
if shif = @attributes[long]
|
||||
shif = shif.integer if (shif.is_a?(Vm::IntegerConstant))
|
||||
if (shif.is_a?(Vm::Integer))
|
||||
raise "should not be supported, check code #{inspect}"
|
||||
bin |= 0x1;
|
||||
shift = shif.register << 1
|
||||
end
|
||||
raise "0 < shift <= 32 #{shif} #{inspect}" if (shif >= 32) or( shif < 0)
|
||||
@operand |= shift(bin , 4 )
|
||||
@operand |= shift(shif , 4+3)
|
||||
break
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
Reference in New Issue
Block a user