<<< Data Allocation Directives for Uninitialized Data | Index | Copying Data Values >>> |
CPU has instructions to copy, move, and sign-extend integer values.
These instructions require operands to be the same size.
However, we may need to operate on data with size other than that originally declared.
The PTR operator forces expression to be treated as the specified type:
.DATA num DWORD 0 .CODE mov ax, WORD PTR num[0] ; Load a word-size value from mov dx, WORD PTR num[2] ; a doubleword variable
PTR operator re-casts the DWORD-sized memory location pointed by num[ index ] expression into a WORD-sized value.
<<< Data Allocation Directives for Uninitialized Data | Index | Copying Data Values >>> |