Quantcast
Channel: x86 Assembly - Programmers Heaven
Viewing all articles
Browse latest Browse all 152

Continuous Memory Location :: ASM

$
0
0
Hi.

I notice an interesting property of data variables declared in the .DATA section. For example, when you use BYTE swapping i.e. BYTE PSTR VariableName + #bytes, you could actually go belong the memory addresses of that a variable, which in this example is VariableName.

-----
.DATA

varOne DB 'testing 1 2 3'
varTwo DW 'September 2002'
...
...

mov ax, WORD PTR DB + 12
-----

In the last line above, the code will make a copy of "3" and "S." ASM is interesting because when you declare variables in .DATA, variables get memory locations right after one another. I am most familiar with C++. In C++, you have no idea where memory gets allocated.

Is it valid that in ASM memory gets allocated continuously, or is it random?

Thanks,
Kuphryn

Viewing all articles
Browse latest Browse all 152

Trending Articles