     # Increment instructions
     ###########################################################
 
-    INC: (address) =>
+    INC: (address) ->
         @$storeValueIntoMemory address, ((@$readByte address) + 1) & 0xFF
 
-    INX: =>
+    INX: ->
         @$storeValueIntoRegisterX (@registerX + 1) & 0xFF
 
-    INY: =>
+    INY: ->
         @$storeValueIntoRegisterY (@registerY + 1) & 0xFF
 
     ###########################################################
     # Decrement instructions
     ###########################################################
 
-    DEC: (address) =>
+    DEC: (address) ->
         @$storeValueIntoMemory address, ((@$readByte address) - 1) & 0xFF
 
-    DEX: =>
+    DEX: ->
         @$storeValueIntoRegisterX (@registerX - 1) & 0xFF
 
-    DEY: =>
+    DEY: ->
         @$storeValueIntoRegisterY (@registerY - 1) & 0xFF
 
     ###########################################################
     # Comparison instructions
     ###########################################################
 
-    CMP: (address) =>
+    CMP: (address) ->
         @$compareRegisterAndMemory @accumulator, address
 
-    CPX: (address) =>
+    CPX: (address) ->
         @$compareRegisterAndMemory @registerX, address
 
-    CPY: (address) =>
+    CPY: (address) ->
         @$compareRegisterAndMemory @registerY, address
 
     ###########################################################
     # Branching instructions
     ###########################################################
 
-    BCC: (address) =>
+    BCC: (address) ->
         @$branchIf not @carryFlag, address
 
-    BCS: (address) =>
+    BCS: (address) ->
         @$branchIf @carryFlag, address
 
-    BNE: (address) =>
+    BNE: (address) ->
         @$branchIf not @zeroFlag, address
 
-    BEQ: (address) =>
+    BEQ: (address) ->
         @$branchIf @zeroFlag, address
 
-    BVC: (address) =>
+    BVC: (address) ->
         @$branchIf not @overflowFlag, address
 
-    BVS: (address) =>
+    BVS: (address) ->
         @$branchIf @overflowFlag,  address
 
-    BPL: (address) =>
+    BPL: (address) ->
         @$branchIf not @negativeFlag, address
 
-    BMI: (address) =>
+    BMI: (address) ->
         @$branchIf @negativeFlag, address
 
     ###########################################################
     # Jump / subroutine instructions
     ###########################################################
 
-    JMP: (address) =>
+    JMP: (address) ->
         @programCounter = address
 
-    JSR: (address) =>
+    JSR: (address) ->
         @$pushWord (@programCounter - 1) & 0xFFFF # The pushed address must be the end of the current instruction
         @programCounter = address
 
-    RTS: =>
+    RTS: ->
         @programCounter = (@$popWord() + 1) & 0xFFFF # We decremented the address when pushing it during JSR
         @tick()
 

    # Addition / subtraction instructions
    ###########################################################

    ADC: (address) =>
        @$addValueToAccumulator @$readByte address

    SBC: (address) =>
        @$addValueToAccumulator (@$readByte address) ^ 0xFF # With internal carry incremment makes negative operand

    ###########################################################
    # Shifting / rotation instructions
    ###########################################################

    ASL: (address) =>
        @$rotateAccumulatorOrMemory address, @rotateLeft, false

    LSR: (address) =>
        @$rotateAccumulatorOrMemory address, @rotateRight, false

    ROL: (address) =>
        @$rotateAccumulatorOrMemory address, @rotateLeft, true

    ROR: (address) =>
        @$rotateAccumulatorOrMemory address, @rotateRight, true

    ###########################################################
    # Hybrid instructions
    ###########################################################

    DCP: (address) =>
        @$compareRegisterAndOperand @accumulator, @DEC address

    ISB: (address) =>
        @$addValueToAccumulator (@INC address) ^ 0xFF # With internal carry incremment makes negative operand

    SLO: (address) =>
        @$storeValueIntoAccumulator @accumulator | @ASL address

    SRE: (address) =>
        @$storeValueIntoAccumulator @accumulator ^ @LSR address

    RLA: (address) =>
        @$storeValueIntoAccumulator @accumulator & @ROL address

    XAA: (address) => # Also known as ANE
        @$storeValueIntoAccumulator @registerX & @AND address

    RRA: (address) =>
        @$addValueToAccumulator @ROR address

    AXS: (address) => # Also known as SBX
        @registerX = @compareRegisterAndMemory @accumulator & @registerX, address

    ANC: (address) =>
        @$rotateLeft @AND(address), false # rotateLeft computes carry

    ALR: (address) =>
        @AND address
        @LSR()

    ARR: (address) =>
        @AND address
        @ROR()
        @carryFlag = (@accumulator >>> 6) & 1
        @overflowFlag = ((@accumulator >>> 5) & 1) ^ @carryFlag

    TAS: (address) => # Also known as SHS
        @stackPointer = @accumulator & @registerX
        @SHA address


    # Basic addressing modes
    ###########################################################

    impliedMode: ->
        @tick()

    accumulatorMode: ->
        @tick()

    immediateMode: ->
        @$moveProgramCounter 1

    ###########################################################
    # Zero page addressing modes
    ###########################################################

    zeroPageMode: ->
        @$readNextProgramByte()

    zeroPageXMode: ->
        @$getIndexedAddressByte @$readNextProgramByte(), @registerX

    zeroPageYMode: ->
        @$getIndexedAddressByte @$readNextProgramByte(), @registerY

    ###########################################################
    # Absolute addressing modes
    ###########################################################

    absoluteMode: ->
        @$readNextProgramWord()

    absoluteXMode: ->
        @$getIndexedAddressWord @$readNextProgramWord(), @registerX

    absoluteYMode: ->
        @$getIndexedAddressWord @$readNextProgramWord(), @registerY

    ###########################################################
    # Relative addressing mode
    ###########################################################

    relativeMode: ->
        base = (@programCounter + 1) & 0xFFFF # We need to get address of the next instruction
        offset = @$getSignedByte @$readNextProgramByte()
        @$getIndexedAddressWord base, offset
