## ALP Programming Guide and Reference

[prev][next][parent][TOC]

### Operation

    (* count is an unsigned integer corresponding to the last operand of the instruction, either an
    immediate byte or the byte in register CL *)
    ShiftAmt  count MOD 32;
    inBits  register; (* Allow overlapped operands *)
    IF ShiftAmt = 0
    THEN no operation
    ELSE
      IF ShiftAmt ò OperandSize
      THEN (* Bad parameters *)
        r/m  UNDEFINED;
        CF, OF, SF, ZF, AF, PF  UNDEFINED;
      ELSE (* Perform the shift *)
        CF  BIT[Base, OperandSize - ShiftAmt];
          (* Last bit shifted out on exit *)
        FOR i  OperandSize - 1 DOWNTO ShiftAmt
        DO
          BIT[Base, i]  BIT[Base, i - ShiftAmt];
        OF;
        FOR i  ShiftAmt - 1 DOWNTO 0
        DO
          BIT[Base, i]  BIT[inBits, i - ShiftAmt + OperandSize];
        OD;
        Set SF, ZF, PF (r/m);
          (* SF, ZF, PF are set according to the value of the result *)
        AF  UNDEFINED;
      FI;
    FI;