             @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++

        @registerY = 0       # 8-bit

    resetFlags: ->
        @carryFlag = 0        # bit 0
        @zeroFlag = 0         # bit 1
        @interruptDisable = 1 # bit 2
        @decimalMode = 0      # bit 3
        @breakCommand = 1     # bit 4
        @overflowFlag = 0     # bit 6
        @negativeFlag = 0     # bit 7

    resetVariables: ->
        @cycle = 0

    compareRegisterAndMemory: (register, address) -> 
        operand = @readByte address
        result = register - operand 
        @carryFlag = result >= 0 # Exception on carry computation
        @computeZeroFlag result
        @computeNegativeFlag result

