The size directives BYTE PTR, WORD PTR, and DWORD PTR serve this purpose, indicating sizes of 1, 2, and 4 bytes respectively.
DWORD defines 'size' of the memory location used for move operation. In you example, you'd be moving 0000000Ah (4 bytes) into memory location ESP+18h. As 0Ah is immediate value its size cannot be determined without using DWORD , WORD , BYTE or other similar qualifier.
Specifies the operand addresses a WORD. The operand may be any address expression representing a data variable or a code label. The PTR operator may be used to override the default type of the operand. When specifying pointer overrides, the PTR keyword is optional and may be omitted.
The dword ptr means "write a doubleword". Yes, it stands for pointer, because you put a memory address as destination.
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.
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;
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
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With