What does `dword ptr` mean?

AssemblyX86DwordPointers

Assembly Problem Overview


Could someone explain what this means? (Intel Syntax, x86, Windows)

and     dword ptr [ebp-4], 0

Assembly Solutions


Solution 1 - Assembly

The dword ptr part is called a size directive. This page explains them, but it wasn't possible to direct-link to the correct section.

Basically, it means "the size of the target operand is 32 bits", so this will bitwise-AND the 32-bit value at the address computed by taking the contents of the ebp register and subtracting four with 0.

Solution 2 - Assembly

Consider the figure enclosed in this other question. ebp-4 is your first local variable and, seen as a dword pointer, it is the address of a 32 bit integer that has to be cleared. Maybe your source starts with

Object x = null;

Solution 3 - Assembly

It is a 32bit declaration. If you type at the top of an assembly file the statement [bits 32], then you don't need to type DWORD PTR. So for example:

[bits 32]
.
.
and  [ebp-4], 0

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
Question小太郎View Question on Stackoverflow
Solution 1 - AssemblyunwindView Answer on Stackoverflow
Solution 2 - AssemblymicoView Answer on Stackoverflow
Solution 3 - AssemblyL4m0rView Answer on Stackoverflow