[Prev] [Next] [Contents] [Commodore] [New] [Search] [Home]

System Specification for C65Fred BowenMarch 1, 1991

Arithmetic shifts, memory or accumator, left or right   ASL ASR ASW

    ASL Arithmetic shift left A or M        A<A<<1 or M<M<<1
    ASR Arithmetic shift right A or M       A<A>>1 or M<M>>1
    ASW Arithmetic shift left M (word)      Mx<Mw<<1
 Opcodes
Addressing Mode Abbrev. ASL ASR ASW
register (A) 0A 43
base page BP 06 44
base page indexed X BP,X 16 54
absolute ABS 0E CB
absolute indexed X ABS,X 1E
BytesCyclesMode
1 1 register (ASL)
1 2 register (ASR)
2 4 base page (byte) non-indexed, or indexed X
3 5 absolute non-indexed, or indexed X
3 7 absolute (ASW)

The ASL instructions shift a single byte of data in memory or the accumulator left (towards the most significant bit) one bit position. A 0 is shifted into bit 0.

The "N" or Negative bit will be set if the result bit 7 is (operand bit 6 was) a 1. Otherwise, it is cleared. The "Z" or Zero flag is set if ALL result bits are zero. The "C" or Carry flag is set if the bit shifted out is (operand bit 7 was) a 1. Otherwise, it is cleared.

The ASR instructions shift a single byte of data in memory or the accumulator right (towards the least significant bit) one bit position. Since this is an arithmetic shift, the sign of the operand will be maintained.

The "N" or Negative bit will be set if bit 7 (operand and result) a 1. Otherwise, it is cleared. The "Z" or Zero flag is set if ALL result bits are zero. The "C" or Carry flag is set if the bit shifted out is (operand bit 0 was) a 1. Otherwise, it is cleared.

The ASW instruction shifts a word (two bytes) of data i3l memory left (towards the most significant bit) one bit position. A zero is shifted into bit 0.

The "N" or Negative bit will be set if the result bit 15 is (operand bit 14 was) a 1. Otherwise, it is cleared. The "Z" or Zero flag is set if ALL result bits (both bytes) are zero. The "C" or Carry flag is set if the bit shifted out is (operand bit 15 was) a 1. Otherwise, it is cleared.

         Flags
    N V E B D I Z C
    N - - - - - Z C


[Prev] [Next] [Contents] [Commodore] [New] [Search] [Home]
This page has been created by Sami Rautiainen.
Read the small print. Last updated April 06, 2006.