THE JUMPS
All the conditional jumps branch (or not) depending on the contents of the flags. So, for instance, JPZ says 'jump if the Zero flag is set'. Now we can see how the CP instruction can be used. Suppose, for example, that we wish to see if a particular byte, pointed at by HL, contains 1E hex. If it does, we want to branch to address 447B. The code is:
LD A, 1E
CP A, (HL)
JP Z, 447Bh
All the other jumps behave similarly, as can be seen here:
JPNZ - jump on a non-zero result (zero flag not set)
JPZ - jump on a zero result (zero flag set)
JPP - jump on a positive result (sign flag not set)
JPM - jump on a negative result (sign flag set)
JPNC - jump on no carry (carry flag not set)
JPC - jump on carry (carry flag set)
|