             @writeByte address, result
 
         @registerInstruction Instruction.DEX, ->
-            @registerX--
+            @registerX = (@registerX - 1) & 0xFF
             @computeZeroFlag @registerX
             @computeNegativeFlag @registerX
 
         @registerInstruction Instruction.DEY, ->
-            @registerY--
+            @registerY = (@registerY - 1) & 0xFF
             @computeZeroFlag @registerY
             @computeNegativeFlag @registerY
 

            result = (@readByte address) + 1
            @computeZeroFlag result
            @computeNegativeFlag result
            @writeByte address, result

        @registerInstruction Instruction.INX, ->
            @registerX++
            @computeZeroFlag @registerX
            @computeNegativeFlag @registerX

        @registerInstruction Instruction.INY, ->
            @registerY++
            @computeZeroFlag @registerY
            @computeNegativeFlag @registerY



    getStatus: ->
        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) ->
