8086 Assembly Program for Subtraction of Two 32-bit Numbers
Subtracting two 32-bit numbers on the 16-bit 8086 uses the same two-pass approach as 32-bit addition, but with SBB (Subtract with Borrow) instead of ADC. The first pass subtracts the lower 16 bits with SUB; if that produces a borrow (CF=1), the second pass uses SBB to subtract the upper 16 bits and the borrow together. This post walks through a working implementation in three environments: MASM/TASM, emu8086, and NASM.