Skip to content

Compare to zero

  1. MOVF REGISTRO,F moves the register onto itself.
  2. That updates flag Z in STATUS.
  3. If register = 0 → Z = 1; else Z = 0.
  4. Use Z, not C.
MOVF REGISTRO,F
BTFSS STATUS,Z
GOTO NO_ES_CERO
GOTO ES_CERO

MOVF is not subtraction. For zero compare the course uses MOVF + Z, not carry.

For A = 5 use subtract:

MOVLW .5
SUBWF A,W
BTFSS STATUS,Z

Next: Between registers.

Interactive exam

Compare to zero

Based on: Clase Tema 4 y 5.pdf

0 of 0 answered

MOVF REGISTRO,F compares to zero using flag...
If REGISTRO=0 after MOVF REGISTRO,F, Z equals...
Why MOVF,F and not only C for zero?
To detect "not zero" you typically use...
Comparing A to literal 5 is done with...