Let us suppose that the first 16 bit number is stored in
memory location 9000H and the second number is stored in memory location 9002H.
These two 16 numbers are to be subtracted and the result is to be stored in memory location 9004H.
Algorithm:
- Start.
- Load first data from 9000H directly into register pair HL.
- Exchange contents of register pair DE and HL.
- Load second data from 9002H directly into register pair HL.
- Move contents of register L into accumulator A.