STOSD - All Ops - Prev <-> Next

Usage: STOSD Modifies flags: None

Stores value in accumulator to location at ES:(E)DI (even if operand is given). (E)DI is incremented or decremented based on the size of the operand (or instruction format) and the state of the Direction Flag.

Store Byte to String

STOSB ; AA [8086]

STOSW ; o16 AB [8086]

STOSD ; o32 AB [386]

STOSB stores the byte in AL at EDI, and sets the flags accordingly. It then increments or decrements (depending on the direction flag: increments if the flag is clear, decrements if it is set) EDI.

STOSW and STOSD work in the same way, but they store the word in AX or the doubleword in EAX instead of the byte in AL, and increment or decrement the addressing registers by 2 or 4 instead of 1.

The REP prefix may be used to repeat the instruction ECX times.


push eax, edi

mov eax 0 | rep stosd

pop edi, eax