         @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
+        @carryFlag = off       # bit 0
+        @zeroFlag = off        # bit 1
+        @interruptDisable = on # bit 2
+        @decimalMode = off     # bit 3
+        @breakCommand = on     # bit 4
+        @overflowFlag = off    # bit 6
+        @negativeFlag = off    # bit 7
 
     resetVariables: ->
         @cycle = 0

        @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()


        @registerInstruction Instruction.ADC, (address) ->
            operand = @readByte address
            result = @accumulator + operand
            result++ if @carryFlag
            @computeCarryFlag result
            @computeZeroFlag result
            @computeOverflowFlag @accumulator, operand, result
