Professional Documents
Culture Documents
04 Modified Instructions - Programs
04 Modified Instructions - Programs
Instructions &
Programming
PART 1
INR R
● INR R – Increment the specified register by 1.
○ R←R+1
○ R can be any of the general purpose registers (A, B, C, D, E, H, L).
○ Affects all the flags except CY.
○ Register Addressing Mode.
○ 1-byte instruction and takes 1 Machine Cycle for execution.
○ E.g. INR B, INR A.
○ Amounts to 7 different Opcodes.
DCR R
● DCR R – Decrement the specified register by 1.
○ R←R-1
○ R can be any of the general purpose registers (A, B, C, D, E, H, L).
○ Affects all the flags except CY.
○ Register Addressing Mode.
○ 1-byte instruction and takes 1 Machine Cycle for execution.
○ E.g. DCR C, DCR H.
○ Amounts to 7 different Opcodes.
INR M
● INR M – Increment the content of memory (location specified by HL
Pair) by 1.
○ ((HL)) ← ((HL)) + 1
○ Affects all the flags except CY.
○ Indirect Addressing Mode.
○ 1-byte instruction
○ Takes 3 Machine Cycles (Fetch, Read and Write) for execution.
DCR M
● DCR M – Decrement the indirect byte by 1 (memory location
specified by HL Pair).
○ ((HL)) ← ((HL)) – 1
○ Affects all the flags except CY.
○ Indirect Addressing Mode.
○ 1-byte instruction
○ Takes 3 Machine Cycles (Fetch, Read and Write) for execution.
JMP Instruction
● JMP – Jump (Go) to an instruction to execute.
E.g. JMP LABEL
■ This instruction is used to change the execution sequence.
■ LABEL is a symbol placed before instruction where processor has to jump.
■ E.g. JMP HERE
All Data Y
STOP
N Cleared?
Program P6 (Contd.)
All Data Y
STOP
N Cleared?
Alternate Program P6 (Contd.)
All Data Y
STOP
N Copied?
Program P7 (Contd.)