16-bit Arithmetic

DAD, INX, DCX instructions.

Mohith N
Updated: 19 March 2026
11 min read

In the 8085 microprocessor, most arithmetic operations work on 8-bit data through registers like A, B, C, D, E, H, and L. However, many real applications require handling 16-bit values, such as memory addresses, large counters, or multi-byte data. The 8085 provides dedicated 16-bit arithmetic instructions, namely DAD, INX, and DCX, which operate on register pairs and the stack pointer, making 16-bit computation efficient without manual carry propagation.

8085 16-bit Arithmetic Instructions OverviewDAD rpHL = HL + rpINX rprp = rp + 1DCX rprp = rp - 1Register Pairs UsedBC pairDE pairHL pairSP (Stack Pointer)Flag BehaviorDADOnly CY flagaffectedINXNo flagsaffectedDCXNo flagsaffectedAll three instructions use 16-bit register pairs as operands
Figure 1: Overview of 16-bit arithmetic instructions in 8085 with register pairs and flag behavior

Core Concept Explanation

The 8085 CPU has a 16-bit address bus and 16-bit register pairs, but its ALU is fundamentally 8-bit. To handle 16-bit data, the processor uses dedicated instructions that treat two 8-bit registers as a single 16-bit unit. The four register pairs available are BC, DE, HL, and SP. The DAD instruction adds a 16-bit register pair to the HL register pair. This is the primary way to perform 16-bit addition. The result is always stored back in HL.

The INX instruction increments any 16-bit register pair by one. It is frequently used in pointer-based operations, where a register pair holds a memory address and you need to move to the next byte. Similarly, DCX decrements a 16-bit register pair by one. DCX is used when traversing memory in reverse or counting down from a value stored in a register pair.

A critical point for GATE preparation is the flag behavior of these instructions. DAD only affects the Carry flag (CY) if the 16-bit addition produces a carry out of the most significant bit. INX and DCX do not affect any flags at all, including the Zero flag. This means you cannot use INX/DCX result to decide a conditional jump directly based on the Zero flag alone without an explicit compare or test.

Mathematical Expression

For the DAD instruction, the operation is defined as: HL = HL + rp, where rp is the specified 16-bit register pair. The result is a 16-bit sum placed in HL. If the total exceeds 65535 (0xFFFF), the Carry flag is set to 1. For INX: rp = rp + 1. For DCX: rp = rp - 1. No flags are affected by INX or DCX, regardless of whether the result overflows or underflows.

Consider that HL holds 0x2500 and BC holds 0x1200. After DAD B, HL becomes 0x2500 + 0x1200 = 0x3700. If HL were 0xFF00 and BC were 0x0200, the result would be 0x0100 and the Carry flag would be set, indicating a 16-bit overflow.

Practical Understanding

These instructions are practically essential when writing programs that manipulate memory addresses. For example, when implementing a loop that scans through an array stored in memory, the HL pair typically serves as the memory pointer. INX H increments the pointer to the next memory location. This avoids the overhead of loading HL into the accumulator, adding one, and storing it back, which would require multiple instructions.

DAD is particularly useful in offset-based addressing. If the base address of a data block is in DE and an offset is in BC, DAD can be used indirectly after transferring values into HL to compute the effective address. In multiplication routines, DAD H (which adds HL to itself) is used to implement left shifts at the 16-bit level, effectively multiplying the 16-bit value in HL by 2.

Example
Given:
HL = 3050H, BC = 1200H

Why this formula applies:
DAD B adds the 16-bit value in BC to HL and stores result in HL.

Formula:
HL_new = HL + BC

Substitution:
HL_new = 3050H + 1200H

Calculation:
3050H = 12368 decimal
1200H = 4608 decimal
12368 + 4608 = 16976 decimal = 4250H

Final Answer:
HL = 4250H, CY flag = 0 (no carry out of 16-bit result)
Exam Tip: INX and DCX never affect any flags including Zero flag. If a GATE question asks which instruction sets the CY flag among DAD, INX, DCX — only DAD can set CY. INX and DCX touching 0x0000 or 0xFFFF boundaries do not set any flag.
DAD Instruction: Internal 16-bit Addition MechanismH regHigh byteL regLow byte}HL pair (16-bit)rp HighHigh byterp LowLow byteSource rp (16-bit)16-bit AdderInternal ALU unitH (result)High byteL (result)Low byteCY FlagSet if overflowINX and DCX MechanismINX rprp = rp + 1 (no flags)DCX rprp = rp - 1 (no flags)Use casePointer increment/decrementINX H and DCX H are single-byte, 6-cycle instructions
Figure 2: Internal mechanism of DAD showing 16-bit addition and how INX/DCX operate on register pairs

Mechanism in Key Points

  • DAD rp fetches 16-bit value from the specified register pair, adds it to HL using the internal 16-bit adder, and stores the result back in HL. The operation takes 10 T-states.
  • INX rp increments the 16-bit register pair by one. No flags are affected. This is a single-byte instruction and executes in 6 T-states.
  • DCX rp decrements the 16-bit register pair by one. No flags are affected. Also a single-byte, 6 T-state instruction.
  • DAD H is a special case where HL is added to itself, resulting in HL being doubled. This is equivalent to a 16-bit left shift or multiplication by 2.
  • DAD SP adds the Stack Pointer value to HL, which is useful for computing stack-relative addresses.
  • Only the Carry (CY) flag is modified by DAD. All other flags (Z, S, P, AC) remain unchanged.

Quick Revision

  • DAD rp: HL = HL + rp. Result in HL. Only CY flag affected. Valid rp values: BC, DE, HL, SP.
  • INX rp: rp = rp + 1. No flags affected. Used for memory pointer advancement.
  • DCX rp: rp = rp - 1. No flags affected. Used for reverse traversal or countdown.
  • DAD H doubles HL. Equivalent to 16-bit multiply by 2. Important for multiplication routines.
  • INX and DCX do not set Zero flag even if result becomes 0x0000. This is a common GATE trap.
  • All three instructions operate on 16-bit register pairs, not 8-bit registers.
  • T-states: DAD = 10, INX = 6, DCX = 6. These values appear in timing and performance questions.

16-bit Arithmetic Quiz

Test your knowledge of DAD, INX, and DCX 16-bit arithmetic operations in the 8085.

Question 1 of 3

Q1.If HL = 1234H and BC = 0F00H, what is the result in HL after executing "DAD B"?