Assembly Programming Assembly Memory Segments - Assembly Programming

What is Assembly Memory Segments?

We have already discussed the three sections of an assembly program. These sections represent various memory segments as well.

Interestingly, if you replace the section keyword with segment, you will get the same result. Try the following code –

When the above code is compiled and executed, it produces the following result –

Memory Segments

A segmented memory model divides the system memory into groups of independent segments referenced by pointers located in the segment registers. each segment is used to contain a selected type of data. One segment is used to contain instruction codes, some other segment stores the information elements, and a third segment keeps the program stack.

In the light of the above discussion, we can specify various memory segments as −

  • Data segment − it is represented by .data section and the .bss. The .data section is used to declare the memory region, where data elements are stored for the program. This section cannot be expanded after the data elements are declared, and it remains static throughout the program.

The .bss section is also a static memory section that contains buffers for data to be declared later in the program. This buffer memory is 0-filled.

  • Code segment − it is represented by .text section. This defines an area in memory that stores the instruction codes. this is also a fixed area.
  • Stack − This segment includes data values passed to functions and procedures within the program

All rights reserved © 2020 Wisdom IT Services India Pvt. Ltd Protection Status

Assembly Programming Topics