Ex6502.CPU.Executor.DEC (ex6502 v0.1.0) View Source

Subtract 1, in two's complement, from the memory location

Operation

M - 1 -> M

Table

DEC | Decrement Memory by One
================================================

M - 1 -> M                       N V - B D I Z C
                                 + - - - - - + -

addressing       assembler    opc  bytes  cycles
------------------------------------------------
accumulator      DEC           3A    1     2
absolute         DEC $nnnn     CE    3     6
absolute,X       DEC $nnnn,X   DE    3     7
zeropage         DEC $nn       C6    2     5
zeropage,X       DEC $nn,X     D6    2     6

Flags

  • Negative: 1 if bit 7 of result is 1; 0 otherwise
  • Zero: 1 if result is zero; 0 otherwise

Link to this section Summary

Link to this section Functions