четверг, 20 сентября 2012 г.

Directive segmentation

Recall that the microprocessor has six segment registers, through which can run simultaneously:

• With one code segment;

• with one segment of the stack;

• with one segment of the data;

• three additional data segments.

Again, that is a physical segment of the memory occupied by the teams and (or) data, the addresses of which are calculated relative to the value in the corresponding segment register.

It is important to note that the functional purpose of the segment is wider than simply splitting the program into blocks of code, data, and stack. Segmentation is part of a more general mechanism associated with the concept of modular programming. It involves the unification of design object modules produced by the compiler, including those with different programming languages. This feature allows programs written in different languages.

The segments are described in assembler directive SEGMENT.

Syntactic description of the segment is the following construction

<Segment name> SEGMENT [the alignment] [type of combination]

[Class segment] [type segment size]

<Body segment>

<Segment name> ENDS

There are many possible parameter values.

And with the directive ASSUME you can tell the compiler which segment to which segment register-element attached.

Format guidelines:

ASSUME <segment register> <segment name>

SEGMENT directive and ASSUME - standard guidelines segmentation.

A description of these directives is rather complicated and requires serious knowledge assembly and architecture, so

simple programs containing one segment for code, data, and stack commonly used simplified descriptions of each business.

Translators MASM and TASM are provided for use of simplified segmentation directives (instead SEGMENT).

! Standard and simplified segmentation directives do not exclude each other.

! Standard guidelines are used when the programmer wants to take complete control over the placement of segments in memory, and their combination with the segments of the other modules.

! Simplified guidelines should be used

1) for simple programs

2) programs designed to bind to the software modules written in high level languages ​​(this allows the linker to effectively bind modules in different languages ​​through the standardization of communication and control).

Комментариев нет:

Отправить комментарий