=== ================== === === Cpx – Compare to X === === ================== === Format 111.0bb.00 Description The specified contents are substracted from the index register X. 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 X is not changed. Z is set by an equality, reset otherwise; N is set by the sign bit; C is set when X>=M. Cpy is usually followed by a branch: Bcc detects X<M, Beq detects X=M, Bcs de- tects X>=N, and Beq followed by Bcs detects X>M. Addressing Modes ┌─────────┬────────────┬──────────┬─────────────┬─────┬─────┬────────────────┬────────────────┐ │ Imm │ 111.000.00 │ e0 ab │ Cpx #ab │ -bb │ #2 │ 1110.0000 = e0 │ 0000.0000 = 00 │ │ Zpg │ 111.001.00 │ e4 ab │ Cpx ab │ -bb │ #3 │ 1110.0000 = e0 │ 0000.0100 = 04 │ │ Abs │ 111.011.00 │ ec cd ab │ Cpx abcd │ -bb │ #4 │ 1110.0000 = e0 │ 0000.1100 = 0c │ └─────────┴────────────┴──────────┴─────────────┴─────┴─────┴────────────────┴────────────────┘ Result ┌───────────┐ │ X?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