Pl INSTRUC2.DOC: Difference between revisions
Jump to navigation
Jump to search
Olivier.jan (talk | contribs) (Replacing content of with translated version) Tag: Removed redirect |
Olivier.jan (talk | contribs) mNo edit summary |
||
Line 1: | Line 1: | ||
CONTINUATION OF THE COURSE ON INSTRUCTIONS from the INSTRUC.DOC file---------------------------------------------------------- |
CONTINUATION OF THE COURSE ON INSTRUCTIONS from the INSTRUC.DOC file---------------------------------------------------------- |
||
− | |||
− | |||
− | |||
LSL #BBB,dn (.B),[.W],(.L) (Logical Shift Left) |
LSL #BBB,dn (.B),[.W],(.L) (Logical Shift Left) |
||
-------------- |
-------------- |
||
Line 14: | Line 11: | ||
------------------ |
------------------ |
||
− | + | Performs a shift of #BBB or dm (depending on the syntax) BITS |
|
of the data register dn to the left. |
of the data register dn to the left. |
||
− | + | The replacement bits are ZEROS. |
|
− | + | It is necessary that 1<= #BBB <= 8 for the 1st form. |
|
− | ------------- |
+ | ------------- |
− | For the 3rd form, the addressing modes |
+ | For the 3rd form, the allowed addressing modes for the |
− | destination are: |
+ | destination operand are: |
− | ----------- |
+ | ----------- |
BBBB |
BBBB |
||
BB |
BB |
||
Line 31: | Line 28: | ||
d(an) |
d(an) |
||
d(an,rn) |
d(an,rn) |
||
+ | |||
⚫ | |||
But in this case, the operation can only shift |
But in this case, the operation can only shift |
||
1 SINGLE BIT. |
1 SINGLE BIT. |
||
⚫ | |||
⚫ | |||
⚫ | |||
------ |
------ |
||
− | And I write |
+ | And if I write LSL.W #1,dn |
− | + | or MOVE.W #1,d1 |
|
− | + | LSL.W d1,d0, we get: |
|
− | + | d0=%00001011100011011110111000001100 |
|
− | + | <-------- <--:0 |
|
− | All |
+ | All the bits of the lower WORD of the data register dn (.W) |
have been shifted by 1 bit to the left: |
have been shifted by 1 bit to the left: |
||
− | The |
+ | The least significant bit entering is always replaced by a |
− | + | NULL bit. |
|
− | + | Meaning: #BBB or dm BITS are shifted out of dn to the left and the |
|
− | replacement bits entering on the right of dn are |
+ | replacement bits entering on the right of dn are NULL BITS. |
− | The |
+ | The contents of dn are therefore changed, the MSB is also likely to change, |
− | + | that's why the SIGN of dn may not necessarily be preserved. |
|
− | The CCR will |
+ | The CCR will change according to the new value of dn. |
--- |
--- |
||
− | N=1 if the MSB is 1, otherwise it is |
+ | N=1 if the MSB is 1, otherwise it is 0 |
− | Z=1 if all bits of dn are |
+ | Z=1 if all bits of dn are null, otherwise it is 0 |
V is always set to 0 |
V is always set to 0 |
||
C and X are set to the value of the LAST BIT EXITED from dn. |
C and X are set to the value of the LAST BIT EXITED from dn. |
||
Line 71: | Line 67: | ||
LSL.B #5,d0 |
LSL.B #5,d0 |
||
− | + | A shift of 5 bits of the lower BYTE of d0 is operated |
|
(only bits 0 to 7 of d0 are therefore concerned by lsl.B) |
(only bits 0 to 7 of d0 are therefore concerned by lsl.B) |
||
Line 80: | Line 76: | ||
X=C=0 <- 1111111110100000 in d0 |
X=C=0 <- 1111111110100000 in d0 |
||
− | 5 |
+ | 5 null bits have entered the right of the lower byte of d0, the |
− | last bit to exit from d0 was |
+ | last bit to exit from d0 was null: bit X=C=0 in the CCR |
+ | |||
⚫ | |||
+ | |||
+ | LSR #BBB,dn (.B),[.W],(.L) (Logical Shift Right) |
||
+ | -------------- |
||
⚫ | |||
+ | |||
+ | LSR dm,dn (.B),[.W],(.L) |
||
+ | -------------- |
||
+ | or |
||
+ | |||
+ | LSR.W destination (.W) |
||
+ | ------------------ |
||
+ | |||
+ | Performs a shift of #BBB or dm (depending on the syntax) BITS |
||
+ | of the data register dn to the right. |
||
+ | The replacement bits are ZEROS. |
||
+ | |||
+ | It is necessary that 1<= #BBB <= 8 for the 1st form. |
||
+ | ------------- |
||
+ | For the 3rd form, the allowed addressing modes for the |
||
+ | destination operand are: |
||
+ | ----------- |
||
+ | BBBB |
||
+ | BB |
||
+ | (an) |
||
+ | -(an) |
||
+ | (an)+ |
||
+ | d(an) |
||
+ | d(an,rn) |
||
⚫ | |||
+ | But in this case, the operation can only shift |
||
+ | 1 SINGLE BIT. |
||
+ | |||
+ | For example, if d0=%10000101110001101111011100000110 (word) |
||
+ | ------ |
||
+ | And if I write LSR.W #1,dn |
||
+ | |||
+ | or MOVE.W #1,d1 |
||
+ | LSR.W d1,d0, we get: |
||
+ | |||
+ | d0=%01000010111000110111101110000011 |
||
+ | 0:--> -------> |
||
+ | |||
+ | All the bits of the lower WORD of the data register dn (.W) |
||
+ | have been shifted by 1 bit to the right: |
||
+ | |||
+ | The most significant bit entering is always replaced by a |
||
+ | NULL bit. |
||
⚫ | |||
+ | Meaning: #BBB or dm BITS are shifted out of dn to the right and the |
||
+ | replacement bits entering on the left of dn are NULL BITS. |
||
+ | |||
+ | The contents of dn are therefore changed, the MSB is also likely to change, |
||
+ | that's why the SIGN of dn may not necessarily be preserved. |
||
+ | |||
+ | The CCR will change according to the new value of dn. |
||
+ | --- |
||
+ | N=1 if the MSB is 1, otherwise it is 0 |
||
+ | Z=1 if all bits of dn are null, otherwise it is 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 |
||
+ | LSR.B #5,d0 |
||
+ | |||
+ | A shift of 5 bits of the lower BYTE of d0 is operated. |
||
+ | (only bits 0 to 7 of d0 are therefore concerned by lsr.B) |
||
+ | |||
+ | We get: |
||
+ | |||
+ | ------0:>------> CCR |
||
+ | |||
+ | d0 :1111111100000010 -> X=C=1 |
||
+ | |||
+ | 5 null bits have entered the left of the lower byte of d0, the |
||
+ | last bit to exit from d0 was 1: bit X=C=1 in the CCR |
||
+ | |||
Back to [[ASM_Tutorial]] |
Back to [[ASM_Tutorial]] |
||
[[Category: ASSEMBLER 68000 on ATARI ST Part 1 ]] |
[[Category: ASSEMBLER 68000 on ATARI ST Part 1 ]] |
||
− | |||
− | (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.) |
Revision as of 12:24, 17 December 2023
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) ------------------
Performs a shift of #BBB or dm (depending on the syntax) BITS of the data register dn to the left. The replacement bits are ZEROS.
It is necessary that 1<= #BBB <= 8 for the 1st form. -------------
For the 3rd form, the allowed addressing modes for the destination operand are: ----------- BBBB BB (an) -(an) (an)+ d(an) d(an,rn)
But in this case, the operation can only shift 1 SINGLE BIT.
For example, if d0=%10000101110001101111011100000110 (word) ------ And if I write LSL.W #1,dn
or MOVE.W #1,d1 LSL.W d1,d0, we get:
d0=%00001011100011011110111000001100 <-------- <--:0
All the bits of the lower WORD of the data register dn (.W) have been shifted by 1 bit to the left:
The least significant bit entering is always replaced by a NULL bit. Meaning: #BBB or dm BITS are shifted out of dn to the left and the replacement bits entering on the right of dn are NULL BITS.
The contents of dn are therefore changed, the MSB is also likely to change, that's why the SIGN of dn may not necessarily be preserved.
The CCR will change according to the new value of dn. --- N=1 if the MSB is 1, otherwise it is 0 Z=1 if all bits of dn are null, otherwise it is 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
A shift of 5 bits of the lower BYTE of d0 is operated (only bits 0 to 7 of d0 are therefore concerned by lsl.B)
We get: CCR --------<------<:0 X=C=0 <- 1111111110100000 in d0
5 null bits have entered the right of the lower byte of d0, the last bit to exit from d0 was null: bit X=C=0 in the CCR
LSR #BBB,dn (.B),[.W],(.L) (Logical Shift Right) -------------- or
LSR dm,dn (.B),[.W],(.L) -------------- or
LSR.W destination (.W) ------------------
Performs a shift of #BBB or dm (depending on the syntax) BITS of the data register dn to the right. The replacement bits are ZEROS.
It is necessary that 1<= #BBB <= 8 for the 1st form. ------------- For the 3rd form, the allowed addressing modes for the destination operand are: ----------- BBBB BB (an) -(an) (an)+ d(an) d(an,rn) But in this case, the operation can only shift 1 SINGLE BIT.
For example, if d0=%10000101110001101111011100000110 (word) ------ And if I write LSR.W #1,dn
or MOVE.W #1,d1 LSR.W d1,d0, we get:
d0=%01000010111000110111101110000011 0:--> ------->
All the bits of the lower WORD of the data register dn (.W) have been shifted by 1 bit to the right:
The most significant bit entering is always replaced by a NULL bit. Meaning: #BBB or dm BITS are shifted out of dn to the right and the replacement bits entering on the left of dn are NULL BITS.
The contents of dn are therefore changed, the MSB is also likely to change, that's why the SIGN of dn may not necessarily be preserved.
The CCR will change according to the new value of dn. --- N=1 if the MSB is 1, otherwise it is 0 Z=1 if all bits of dn are null, otherwise it is 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 LSR.B #5,d0
A shift of 5 bits of the lower BYTE of d0 is operated. (only bits 0 to 7 of d0 are therefore concerned by lsr.B)
We get: ------0:>------> CCR d0 :1111111100000010 -> X=C=1
5 null bits have entered the left of the lower byte of d0, the last bit to exit from d0 was 1: bit X=C=1 in the CCR
Back to ASM_Tutorial