| Win32 Assembly Chapter14 | |
|---|---|
| Topic Started: Jan 10 2008, 03:46 PM (286 Views) | |
| astropirate | Jan 10 2008, 03:46 PM Post #1 |
![]()
Not Lurking
![]() ![]() ![]()
|
Structure in Assembly Welcome Hi! Welcome to the fourteenth chapter of this series. Now, we're going to discover how we can group several datatypes just like those in high level languages. This grouping is actually done by the assembler, not by the Intel x86 instructions. Assembler will later expand the structure into the variables we know so far. Of course, we don't have to care about the expansion like the one in macros. Note that the structure in assembly is equivalent to struct in C/C++ or record in Pascal. So, you won't be surprised here. This chapter is going to be a short one. Defining Structure Defining structure is just similar to defining subroutines and macros, except now we won't have parameters, of course. Examine the excerpt below: TASM
MASM
That's the structure type definition. To declare the variable is like this:
This define a and b as a variable of type circle. Then, we can use the variable as usual. For example:
Simple right? Most of the instructions can be applied in structures. The rule of thumb is that if we can apply an instruction into a variable, then we can also apply it into structures. Simple, no? Memory Map If we declare these variables:
The memory map (see here to refresh) is like this (Suppose the variable a starts at address 100h): Address Variable 100h a.x 102h a.y 104h a.radius 106h b.x 108h b.y 10Ah b.radius So, it's similar with having two stacks of x, y and radius, right? Closing OK, I think that's all for now. See you next time. Roby Joehanes © 2001 |
You will Bow before me!![]() | |
![]() |
|
| 1 user reading this topic (1 Guest and 0 Anonymous) | |
| « Previous Topic · Tutorials · Next Topic » |






![]](http://z3.ifrm.com/static/1/pip_r.png)




12:28 PM May 20