def shift_handling
     op = 0
     #codes that one can shift, first two probably most common.
     # l (in lsr) means logical, ie unsigned, a (in asr) is arithmetic, ie signed
     shift_codes = {'lsl' => 0b000, 'lsr' => 0b010, 'asr' => 0b100, 'ror' => 0b110, 'rrx' => 0b110}
     shift_codes.each do |short, bin|
       long = "shift_#{short}".to_sym
       if shif = @attributes[long]
         # TODO  need more tests
         if (shif.is_a?(Numeric))
           raise "0 < shift <= 32  #{shif} #{inspect}"  if (shif >= 32) or( shif < 0)
           op |=   shift(bin  , 4 )
           op |=   shift(shif , 4+3)
         else
           bin |= 0x1;
           op  |=   shift(bin  , 4 )
           op  |=   shift(shif.reg_no , 8)
         end
         break
       end
     end
     return op
   end
def shift_handling
     op = 0
     #codes that one can shift, first two probably most common.
     # l (in lsr) means logical, ie unsigned, a (in asr) is arithmetic, ie signed
     shift_codes = {'lsl' => 0b000, 'lsr' => 0b010, 'asr' => 0b100, 'ror' => 0b110, 'rrx' => 0b110}
     shift_codes.each do |short, bin|
       long = "shift_#{short}".to_sym
       if shif = @attributes[long]
         # TODO  need more tests
         if (shif.is_a?(Numeric))
           raise "0 < shift <= 32  #{shif} #{inspect}"  if (shif >= 32) or( shif < 0)
           op |=   shift(bin  , 4 )
           op |=   shift(shif , 4+3)
         else
           bin |= 0x1;
           op  |=   shift(bin  , 4 )
           op  |=   shift(shif.reg_no , 8)
         end
         break
       end
     end
     return op
   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)