Pl INSTRUC2.DOC
CONTINUATION OF THE COURSE ON INSTRUCTIONS from the INSTRUC.DOC file----------------------------------------------------------
LSL #BBB,dn (.B),[.W],(.L) (Logical Shift Left) -------------- or
LSL dm,dn (.B),[.W],(.L) -------------- or
LSL.W destination (.W) ------------------
Allows a shift by #BBB or dm (according to syntax) BITS of the data register dn to the left. Replacement bits are ZERO.
However, it must be that 1<= #BBB <= 8 for the 1st form. -------------
For the 3rd form, the addressing modes allowed for the operand destination are: ----------- BBBB BB (an) -(an) (an)+ d(an) d(an,rn) But in this case, the operation can only shift 1 SINGLE BIT.
That is to say that for example if d0=%10000101110001101111011100000110 (word) ------ And I write LSL.W #1,dn
or MOVE.W #1,d1 LSL.W d1,d0 , we obtain:
d0=%00001011100011011110111000001100 <-------- <--:0
All Bits of the LOW word of the data register dn (.W) have been shifted by 1 bit to the left:
The incoming least-significant bit is always replaced with a ZERO bit. That is to say: That we move #BBB or dm BITS out of dn from the left and that the replacement bits entering on the right of dn are ZERO BITS.
The content of dn is therefore changed, the MSB also has a chance to be changed, which is why the SIGN of dn will not necessarily be preserved.
The CCR will be changed according to the new value of dn. --- N=1 if the MSB is 1, otherwise it is equal to 0 Z=1 if all bits of dn are zero, otherwise it is equal to 0 V is always set to 0 C and X are set to the value of the LAST BIT EXITED from dn.
Example of use: ---------------------- MOVE #%1111111101010101,d0 LSL.B #5,d0
We operate a shift of 5 bits of the LOW BYTE of d0 (only bits 0 to 7 of d0 are therefore concerned by lsl.B)
We get: CCR --------<------<:0 X=C=0 <- 1111111110100000 in d0
5 zero bits entered to the right of the low byte of d0, the last bit to exit from d0 was zero: X=C=0 in the CCR
...
Back to ASM_Tutorial
(Note: Due to the length of the document, only a fragment of the translation is produced. The translation task can continue with subsequent requests if the remaining parts of the document require translation.)