             @tick()
 
     getStatus: ->
-        status = @carryFlag
-        status |= @zeroFlag << 1 
-        status |= @interruptDisable << 2
-        status |= @decimalMode << 3 
-        status |= @breakCommand << 4
-        status |= @overflowFlag << 6
-        status |= @negativeFlag << 7
+        status = 0
+        status &= Bit0 if @carryFlag
+        status &= Bit1 if @zeroFlag
+        status &= Bit2 if @interruptDisable
+        status &= Bit3 if @decimalMode
+        status &= Bit4 if @breakCommand
+        status &= Bit6 if @overflowFlag
+        status &= Bit7 if @negativeFlag
+        status
 
     setStatus: (status) ->
-        @carryFlag = status & 1
-        @zeroFlag = (status >> 1) & 1
-        @interruptDisable = (status >> 2) & 1
-        @decimalMode = (status >> 3) & 1
-        @breakCommand = (status >> 4) & 1
-        @overflowFlag = (status >> 6) & 1
-        @negativeFlag = (status >> 7) & 1
+        @carryFlag        = (status & Bit0) != 0
+        @zeroFlag         = (status & Bit1) != 0
+        @interruptDisable = (status & Bit2) != 0
+        @decimalMode      = (status & Bit3) != 0
+        @breakCommand     = (status & Bit4) != 0
+        @overflowFlag     = (status & Bit6) != 0
+        @negativeFlag     = (status & Bit7) != 0
 
     tick: ->
         @cycle++

        @instructionsTable[instruction] = execution

    computeCarryFlag: (result) ->
        @carryFlag = if result > 0xFF then 1 else 0

    computeZeroFlag: (result) ->
        @zeroFlag = if (result & 0xFF) != 0 then 1 else 0

    computeOverflowFlag: (operand1, operand2, result) ->
        @overflowFlag = if (operand1 ^ result) & (operand2 ^ result) & 0x80 != 0 then 1 else 0

    computeNegativeFlag: (result) ->
        @negativeFlag = (result >> 7) & 1

    branchIfTrue: (condition, address) ->
        if condition
            @programCounter = address
            @tick()

                @accumulator = result & 0xFF

        @registerInstruction Instruction.BCC, (address) ->
            @branchIf @carryFlag is off, address

        @registerInstruction Instruction.BCS, (address) ->
            @branchIf @carryFlag is on, address

        @registerInstruction Instruction.BEQ, (address) ->
            @branchIf @zeroFlag is on, address

        @registerInstruction Instruction.BIT, (address) ->
            result = @accumulator & @readByte address
            @computeZeroFlag result
            @overflowFlag = result & Bit7 != 0 # Exception on overflow computation
            @computeNegativeFlag result

        @registerInstruction Instruction.BMI, (address) ->
            @branchIfTrue @negativeFlag, address

        @registerInstruction Instruction.BNE, (address) ->
            @branchIfFalse @zeroFlag,  address

        @registerInstruction Instruction.BPL, (address) ->
            @branchIfFalse @negativeFlag,  address

        @registerInstruction Instruction.BRK, ->
            @breakCommand = 1
            @handleInterrupt 0xFFFE

        @registerInstruction Instruction.BVC, (address) ->
            @branchIf @overflowFlag is off, address

        @registerInstruction Instruction.BVS, (address) ->
            @branchIf @overflowFlag is on,  address

        @registerInstruction Instruction.CLC, ->
            @carryFlag = off

        @registerInstruction Instruction.CLD, ->
            @decimalMode = off

        @registerInstruction Instruction.CLI, ->
            @interruptDisable = off

        @registerInstruction Instruction.CLV, ->
            @overflowFlag = off

        @registerInstruction Instruction.CMP, (address) ->
            @compareRegisterAndMemory @accumulator, address
