Skip to content

Compare two registers

MOVF B,W
SUBWF A,W
BTFSS STATUS,C
GOTO A_NO_ES_MAYOR_B
BTFSS STATUS,Z
GOTO A_ES_MAYOR_B
CaseCZ
A = B11
A > B10
A < B00
ABCZ
101011
5310
2700
MOVF REG2,W
SUBWF REG1,W
BTFSS STATUS,C
GOTO FIN_COMP
BTFSS STATUS,Z
GOTO MAYOR
FIN_COMP
RETURN
MAYOR
RETURN

Ejercicio · Parcial

Extra cases

A=15,B=8 → C=1,Z=0. A=0,B=1 → C=0,Z=0.

Interactive exam

Compare two registers — partial exam

Based on: Clase Tema 4 y 5.pdf

0 of 0 answered

To check if a register equals ZERO you preferably use...
MOVF REGISTRO,F compares to zero using flag...
To compare if A = B (registers) the base sequence is...
After MOVF B,W and SUBWF A,W (A-B), if A=10 and B=10, Z and C are...
If A=5 and B=3, after A-B flag Z is...
If A=2 and B=7 (A<B unsigned), after A-B flag C is...
For A > B you must check C=1 and...
It is correct that A-B and B-A give the same STATUS result...
After A-B with A=2 and B=7 (unsigned), C and Z are...
For A=B after MOVF B,W and SUBWF A,W, Z equals...