The usage of each segment is described below:
[thrive_headline_focus title=”.Model” orientation=”left”]
.Model define the size of data and code a program can have. In the above example, we have use .model small which means we will be having one segment of code and one segment of data. some other model directives are:
- Medium # more than one code and one data segment
- Compact # one code and more than one data segment
- Large # more than one code and data segment (Array not greater than 64k bytes)
- Huge # more than one code and data segment (Array can be greater than 64k bytes)
[thrive_headline_focus title=”.Stack” orientation=”left”]
In Stack segment, we set aside a block of memory to store stack. Its size is considered in kb. In the above example, we have given the size of 100h which means 1kb.
[thrive_headline_focus title=”.Data” orientation=”left”]
In Data segment, all the variables are declared or initialized. For example:
MSG DB ‘THIS IS A MESSAGE’
[thrive_headline_focus title=”.Code” orientation=”left”]
The Code segment, contain program instructions. In the above example, we have a main procedure in the .code section.
[thrive_headline_focus title=”Main Proc” orientation=”left”]
Proc stands for “procedure” so main proc means main procedure. Here we will write our further instruction and the we will end our main proc with following statements:
Hope the above tutorial helped you understand the basic syntax of x86 instruction set. If you have any problem let us know in the comment box.