News |
Coming soon! 9060 Blade. |
|
RLF & RRF |
Command:
Syntax:
Status Flags Effected: |
RLF / RRF
RLF f,d / RRF f,d
C |
The RLF command will shift the bits specified by f to the left one
place and the RRF command will shift the bits specified by f to the
right one place. The bit that is shifted into the register comes from
the carry flag and the bit that is shifted out of the register is
stored in the carry flag.
Like
other commands, if d is equal to 0 then the result of the operation is
stored in the working register and if d is equal to 1 then the result
is stored back int the register specified by f.
Example 1:
Assume we have a register labeled TEMP with the value b'11110001' and
the carry flag is currently clear, then using the RLF command once
would result in: TEMP = 11110001 before RLF and carry equals 0. TEMP = 11100010 after RLF and carry now equals 1.
If we then did another RLF command, then: TEMP = 11000101 after RLF and the carry flag now equals 1.
So, whatever the carry bit equals before the RLF is placed into bit zero of the register and whatever is in bit 7 gets placed into the carry flag after the RLF command has executed.
|
The RRF command works exactly the same, except bits are shifted one place to the right.
Example 2:
Assume we have a register labeled TEMP with the value b'11110001' and
the carry flag is currently clear, then using the RRF command once
would result in: TEMP = 11110001 before RRF and carry equals 0. TEMP = 01111000 after RRF and carry now equals 1.
If we then did another RRF command, then: TEMP = 10111100 after RLF and the carry flag now equals 0.
So, whatever the carry bit equals before the RRF is placed into bit seven of the register and whatever is in bit 0 gets placed into the carry flag after the RRF command has executed.
|
|
|