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

Subtracts the contents of the x register from the memory only affecting flags

Operation

X - M

Table

CPX | Compare Index Register X to Memory
================================================

X - M                            N V - B D I Z C
                                 + - - - - - + +

addressing       assembler    opc  bytes  cycles
------------------------------------------------
immediate        CPX #$nn      E0    2     2
absolute         CPX $nnnn     EC    3     4
zeropage         CPX $nn       E4    2     3

Flags

  • Negative: 1 if bit 7 of result is 1; 0 otherwise
  • Carry: 1 if X >= M; 0 otherwise
  • Zero: 1 if X == M; 0 otherwise

Link to this section Summary

Link to this section Functions