The operator lets you create a user-defined type that has all the status of a built-in type when defining variables.
It is ideal for creating pointer variables.
PWORD TYPEDEF PTR WORD
PWORD TYPEDEF PTR DWORD
INCLUDE Irvine32.inc
PWORD TYPEDEF PTR WORD
.data
array WORD 10h, 20h, 30h, 40h
pointer PWORD array
.code
main PROC
mov ecx, LENGTHOF array
mov eax, 0
mov esi, pointer
L1: add ax, [esi]
add esi, 2
loop L1
call WriteHex
exit
main ENDP
END main
INCLUDE Irvine32.inc
PDWORD TYPEDEF PTR DWORD
.data
array WORD 10h, 20h, 30h, 40h
pointer PDWORD array
.code
main PROC
mov ecx, 2
mov eax, 0
mov esi, pointer
L1: add eax, [esi]
add esi, 4
loop L1
call WriteHex
exit
main ENDP
END main
Output
Output
The following list gives the differences between and :
gives the contents of the register .
dereferences the offset and obtains the contents of memory if the register contains an offset.
“I’m not arguing, I’m just explaining why I’m right.”
― Unknown