The branching instructions alter the normal sequential program either conditionaly or unconditionally.
UNCONDITIONAL BRANCHING INSRTRUCTIONS:
This instruction is used to jump from one set of programs to another set
e.g: In a 8 bit multiplication program, JN2 LOOP it means that if no zero results in previous arithmetic operation, it will jump to LOOP.
This instruction is used to call the function.
e.g: CALL DIV,CALL SUB etc..
This instruction is used to return to the program after doing some manipulation for a program to succeed.
CONDITIONAL BRANCHING INSTRUCTIONS :
Here we are going to discuss some instructions which we use with jump instruction.
The instructions are
NZ Not Zero (Z = 0)
Z Zero (Z = 1)
NC No Carry (C = 0)
C Carry (C = 1)
PO Parity Odd (P = 0)
PE Parity Even (P = 1)
P Plus (S = 0)
M Minus (S = 1)
Jumps Calls Returns
C CC RC (Carry)
INC CNC RNC (No Carry)
JZ CZ RZ (Zero)
JNZ CNZ RNZ (Not Zero)
JP CP RP (Plus)
JM CM RM (Minus)
JPE CPE RPE (Parity Even)
JP0 CPO RPO (Parity Odd)
Two other instructions can affect a branch by replacing the contents or the program counter:
PCHL Move H & L to Program Counter
RST Special Restart Instruction Used with Interrupts
Stack I/O, and Machine Control Instructions:
The following instructions affect the Stack and/or Stack Pointer:
PUSH Push Two bytes of Data onto the Stack
POP Pop Two Bytes of Data off the Stack
XTHL Exchange Top of Stack with H & L
SPHL Move content of H & L to Stack Pointer
The I/0 instructions are as follows:
IN Initiate Input Operation
OUT Initiate Output Operation
The Machine Control instructions are as follows:
EI Enable Interrupt System
DI Disable Interrupt System
NOP No Operation