Models of memory and the simplified directives of segment definition. Order of loading segments.Models of memory are set by the directive .MODEL
.model model, language, modifier
where model — one of the following words:
TINY — a code, data and a stack take place in the same segment up to 64 KB in
size. This model of memory is most often used when writing on the assembler of
small programs;
SMALL — a code takes place in one segment, and data and a stack — in other
(different segments can be applied to their description, but united in one group). It
is also convenient to use this model of memory for creation of programs on the
assembler;
COMPACT — a code takes place in one segment, and for data storage some
segments so for the appeal to data it is required to specify a segment and shift
(data of distant type) can be used;
MEDIUM — a code takes place in several segments, and all data — in one
therefore for access to data shift is used only, and calls of subprogrammes apply
commands of far call of procedure;
LARGE and HUGE — both a code, and data can occupy some segments;
FLAT — the same, as TINY, but are used 32-bit segments so the maximum size
of the segment containing both data, and a code, and a stack — 4 Mb.
Language — the optional operand accepting values of C, PASCAL, BASIC,
FORTRAN, SYSCALL and STDCALL. If it is specified, it is meant that
procedures are calculated on a call from programs in the corresponding language
of high level, therefore, if the language C, all names of the assembly procedures
declared as by PUBLIC is specified, will be changed so that to begin with an
underlining symbol as it is accepted in C.
Modifier — the optional operand accepting NEARSTACK values (by default) or
FARSTACK. In the second case the segment of a stack won't unite in one group
with data segments.
Directive .CODE describes the main segment of a code
.code segment_name
it is equivalent
_TEXT segment word public 'CODE'
for the TINY, SMALL and COMPACT models and
name_TEXT segment word public 'CODE'
for the MEDIUM, HUGE and LARGE models (name — module name in which
this segment is described). In these models directive .CODE also allows an
optional operand — a name of a defined segment, but all segments of a code
described so in the same module, unite in one segment with the name
NAME_TEXT.
.stack size
Directive .STACK describes stack segment and is equivalent to the directive
STACK segment para public 'stack'
Optional parameter specifies the stack size. By default it is equal to 1 KB.
.data
Describes a usual data segment and corresponds to the directive
_DATA segment word public 'DATA'
.data?
Describes a segment of not initialized data:
_BSS segment word public 'BSS'
This segment usually doesn't join in the program, and settles down behind the
memory end so all variables described in it at the time of loading of the program
have uncertain values.
.const
Describes a segment of unchangeable data:
CONST segment word public 'CONST'
In some operating systems this segment will be loaded so that attempt of record
in it can lead to a mistake.
.fardata segment_name
Order of loading segments.
.alpha
This directive establishes an alphabetic order of loading of segments.
.dosseg; for MASM and WASM
or
dosseg; for MASM and TASM
Establishes an order of loading of segments and often demanded for interaction
of programs on the assembler with programs in languages of high level.
DOSSEG establishes the following order of loading of segments:
1 . All segments of the class 'CODE'.
2 . All segments which aren't belonging to DGROUP group and the class 'CODE'.
3 . Group of segments of DGROUP:
3.1 . All segments of the class 'BEGDATA'.
3.2 . All segments, except the classes 'BEGDATA', 'BSS' and 'STACK'.
3.3 . All segments of the class 'BSS'.
3.4 . All segments of the class 'STACK'.
.seq
Establishes segment loading in that order in which they are described in the
program text. This mode is established by default so the directive .SEQ simply
cancels action .ALPHA or .DOSSEG.
Date: 2015-01-29; view: 1176
|