Skip to content

Register comparisons

Almost every decision in PIC assembly uses comparisons. The PIC18 has no CMP instruction — you subtract (or MOVF for zero) and read STATUS.

CaseMethod
Equal to zeroMOVF A,F → test Z
Equal registersMOVF B,W / SUBWF A,WZ
Less / greaterSame subtract → C (and Z)
PageExam topic
C and Z flagsTheory: explain C and Z
Equal to zeroTheory: why MOVF,F
Between registersREG1>REG2, C/Z table

Next: C and Z flags.

Interactive exam

Introduction — Register comparisons

Based on: Clase Tema 4 y 5.pdf

0 of 0 answered

The PIC18 has no CMP instruction; you usually compare using...
To compare a register to ZERO you preferably use...
To compare two registers A and B the base operation is...
A − B and B − A in STATUS give...
After SUBWF for comparison, the most used flags are...