C and Z flags in comparisons
After subtraction A − B
Section titled “After subtraction A − B”| Flag | Meaning (unsigned subtract) |
|---|---|
| Z | 1 if result is zero |
| C | 1 if no borrow (A ≥ B); 0 if borrow (A < B) |
C acts as bit 9 of the unsigned result (course PDF).
SUBWF pattern
Section titled “SUBWF pattern”MOVF B,WSUBWF A,W ; A - B, updates C and ZA − B ≠ B − A in flags.
Which flag to check
Section titled “Which flag to check”| Relation | Flags |
|---|---|
| A = B | Z = 1 |
| A > B | C = 1, Z = 0 |
| A < B | C = 0 |
| A ≥ B | C = 1 |
| A ≤ B | C = 0 or Z = 1 |
Test instructions
Section titled “Test instructions”| Instruction | Skips if |
|---|---|
BTFSS STATUS,Z | Z = 1 |
BTFSC STATUS,Z | Z = 0 |
BTFSS STATUS,C | C = 1 |
BTFSC STATUS,C | C = 0 |
Ejercicio · Parcial
Predict
A=8,B=8 → C=1,Z=1. A=12,B=5 → C=1,Z=0. A=1,B=10 → C=0,Z=0.
Next: Equal to zero.
C and Z flags
Based on: Clase Tema 4 y 5.pdf
0 of 0 answered
Sign in with CALETAS to sync this result across devices.
Sign in with CALETAS