Luis Rossell
Luis Rossell

Reputation: 105

inline assembly Visual c++ get value from a pointer

I have a question yesterday I made a test to get value from a pointer like this is it correct?. It seems that it works fine.

    char *test ="abcdef";
_asm{
         mov ebx, test
         mov al, byte ptr ds:[ebx]; element at 0
         mov al, byte ptr ds:[ebx + 1]; element at 1...
         mov al, byte ptr ds:[ebx + x]; element at x...
     }

Upvotes: 1

Views: 1139

Answers (1)

Greg Hewgill
Greg Hewgill

Reputation: 993085

Yes, that is correct. A pointer is just an address, and you're using an indirect addressing mode through ebx to access what the pointer points to.

Upvotes: 4

Related Questions