=== ================== ===
=== Cpy – Compare to Y ===
=== ================== ===

Format
110.0bb.00

Description
The specified contents are substracted from the index register Y. The result is not stored, but the
flags NZC are conditioned, depending whether the result is positive, null or negative. The value of the
index register Y is not changed. Z is set by an equality, reset otherwise; N is set by the sign bit; C
is set when Y>=M. Cpy is usually followed by a branch: Bcc detects Y<M, Beq detects Y=M, Bcs de-
tects Y>=N, and Beq followed by Bcs detects Y>M.

Addressing Modes
┌─────────┬────────────┬──────────┬─────────────┬─────┬─────┬────────────────┬────────────────┐
│ Imm     │ 110.000.00 │ c0 ab    │ Cpy #ab     │ -bb │ #2  │ 1100.0000 = c0 │ 0000.0000 = 00 │
│ Zpg     │ 110.001.00 │ c4 ab    │ Cpy   aa    │ -bb │ #3  │ 1100.0000 = c0 │ 0000.0100 = 04 │
│ Abs     │ 110.011.00 │ cc cd ab │ Cpy abcd    │ -bb │ #4  │ 1100.0000 = c0 │ 0000.1100 = 0C │
└─────────┴────────────┴──────────┴─────────────┴─────┴─────┴────────────────┴────────────────┘

Result
    ┌───────────┐
    │    Y?M    │
    ├───┬───┬───┤
    │ > │ = │ < │
┌───┼───┼───┼───┤
│ N │ 0 │ 0 │ 1 │
│ Z │ 0 │ 1 │ 0 │
│ C │ 1 │ 1 │ 0 │
└───┴───┴───┴───┘

┌──────┬────┬─────┐
│ N==0 │ >= │ Bpl │
│ N==1 │ <  │ Bmi │
├──────┼────┼─────┤
│ Z==0 │ != │ Bne │
│ Z==1 │ == │ Beq │
├──────┼────┼─────┤
│ C==0 │ <  │ Bcc │
│ C==1 │ >= │ Bcs │
└──────┴────┴─────┘

Flags
NV-BDIZC
•-----••

Fehlerhinweise, Kommentare und Anregungen sind mir herzlich willkommen.

Letzte Aktualisierung: 2017-02-23