Bit shifting operations
ASL and LSR
LDA #$02 ; Load the value $02 into A
ASL A ; Multiply A by 2
; A is now $04LDA #$02 ; Load the value %00000010 into A
ASL A ; Shift bits left once
; A is now %00000100LDA #$02 ; Load the value $02 into A
STA $00 ; Store this into address $7E0000
ASL $00 ; Shift bits of $7E0000 left once
; A is still $02, while $7E0000 is now $04Edge-cases and carry flag
Chaining ASL and LSR
ROL and ROR
16-bit mode bit shifting
Last updated