Shift Instructions

Used to move a group of bits one or more places to the left or right. If the contents of the data register are shifted left or right by one bit, the bit that falls off the edge is transferred to the carry flag. A shift instruction and a branch instruction that depends on the condition of the carry flag are often used together.

The leftmost bit falls off into carry flag C. The rightmost bit always becomes zero.

Logical Shift Left - LSL

   Shift to be performed on rightmost byte of data register D2
LSL.B #1, D2
Number of bits to shift

Branch if Carry Clear - BCC

Looks at the value placed in the carry flag by the previous instruction. If this value is zero the branch is taken, otherwise control simply moves to the next instruction.

Often used with LSL. Control will branch to the instruction labelled if the bit that fell off into the carry flag was zero. Otherwise control moves to the next instruction.

Branch if Carry Set - BCS

Causes control to branch if the value placed in the carry flag by the previous instruction is 1.

Revision #1
Created Sun, Apr 30, 2017 8:47 PM by Christopher Wilkinson
Updated Sun, Apr 30, 2017 9:16 PM by Christopher Wilkinson