2 Replies - 621 Views - Last Post: 04 April 2018 - 01:25 AM

#1 sunshine33   User is offline

  • D.I.C Head

Reputation: 0
  • View blog
  • Posts: 129
  • Joined: 15-September 17

Pointer in assembly language ?

Posted 04 April 2018 - 01:03 AM

I saw this in some other forum , and i have few questions .

Quote

Pointers - both as a concept and how to write them. ex. 'dword [eax]'


Can somebody please explain this to me and give me few more examples ?
Is This A Good Question/Topic? 0
  • +

Replies To: Pointer in assembly language ?

#2 Programmer2004   User is offline

  • D.I.C Head

Reputation: 18
  • View blog
  • Posts: 96
  • Joined: 25-October 17

Re: Pointer in assembly language ?

Posted 04 April 2018 - 01:13 AM

Pointer is a value which is an address to some location in memory. For example, the pointer can hold address of some variable. Pointers are used in assembly to access variables and other locations in memory.

In the example you found "dword [eax]" means access 4-byte value at memory location pointed by EAX.
[ and ] characters are used for accessing memory locations, while the word before them (in this case dword) means how many bytes you want to access.

And as you wanted here are more examples:

mov al, byte [0] - This reads 1 byte from the first location in memory (memory addressing starts from 0) and writes it to AL register
mov ax, word [bx] - This reads 2 bytes from the location pointed by BX register
mov eax, dword [ebx] - This reads 4 bytes from the location pointed by EBX register
Was This Post Helpful? 2
  • +
  • -

#3 sunshine33   User is offline

  • D.I.C Head

Reputation: 0
  • View blog
  • Posts: 129
  • Joined: 15-September 17

Re: Pointer in assembly language ?

Posted 04 April 2018 - 01:25 AM

Nice explanation

Thanks a lot Programmer2004
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1