x86 Assembly - $ not displaying correct address

Viewed 58

I am using Visual Studio 2017, and wanted to test the $ symbol. Using the following code, I would expect the values of var1 and var2 to be different, but they are identical.

.data
var1 DWORD $
var3 BYTE 16 dup (0FFh)
var2 DWORD $

This is an image of what VS shows in memory

what VS shows in memory

The value for var1 makes sense to me, but if $ is supposed to display the next memory address, why is var2 displaying the same this as var1? Shouldn't it be displaying 004068A4?

1 Answers
.data
var1 DWORD $
var3 BYTE 16 dup (0FFh)
var2 DWORD $

You won't see any difference because the special $ compile-time symbol represents the current location in the code (.code) of the program.

Here you are using it in the .data section which has a separate address space.

Related