Партнерка на США и Канаду по недвижимости, выплаты в крипто
- 30% recurring commission
- Выплаты в USDT
- Вывод каждую неделю
- Комиссия до 5 лет за каждого referral
Shift operators execute shift of an expression on pointed number of digits (positions).
Example:
Mask_b equ 10011000
…..
mov AL, mask_b shr 3 ;operator “shr”
Comparison operators (return meaning of “truth”, “false”), intended for logical expressions formation. Logical meaning “truth” corresponds to logical 1 (unity), and “false” corresponds to 0.
Example:
tab_size equ 30; a size of the table
….
mov AL, tab_size gt 50; loading of the table size ;in register AL
cmp AL,0; if tab_size <50, then
Index operator [ ]. The translator understands this operator as an indication to add the meaning of the first expression (which is out of [ ]) with the meaning of the second expression.
Example:
mov AX, mas[SI]; transfer of word with an address
;mas+(SI) into the register AX
Operator of redeclaration (redefinition) of the ptr type. It is used for redeclaration or for making more precise the type of label or variable, which have been determined by the expression. The type may have one of the following meanings: byte, word, dword, qword, tbyte, near, far.
Example:
d_wrd dd 0
......
mov AL, byte ptr d_wrd+1; transfer of the second byte
;from the double word
Operator of segment redeclaration ’:’ (colon). The translator understands it as an indication to calculate a physical address in correspondence with the given segment component: “name of the segment register”, “name of the segment” from the directive SEGMENT or “Group name”.
It is important to keep in mind, that the code segment can not (!) be redeclarated. This may be explained by the role of code segment in the sequenced program execution:
Operator of obtaining segment component of an address of expression seg. It returns a physical address of a segment for some expression (the expression may be: label, variable, name of group or any symbolic name).
Operator of obtaining offset of expression offset. It allows to obtain an offset of the expression in bytes (an offset relatively the beginning of those segment, in which this expression is located).
Segmentation directives.
The functional predestination of segments is a bit wider than a simple partition of the program into blocks of code, data and stack. Segmentation supposes as well, the unification of object modules, created by the compiler, which allows to connect (unite) programs, written in different languages. For realizing of such connections special operands in the directive SEGMENT are intended.
</div>The <span style='font-size:10.0pt;font-family:"Courier New"'>segment </span>directive allows six different attributes (items) in the operand field: an align operand, a combine operand, a class operand, a <span style='font-size:10.0pt;font-family: "Courier New"'>readonly</span> operand, a "<span style='font-size:10.0pt;font-family:"Courier New"'>uses</span>" operand, and a size operand. Three of these operands control how DOS loads the segment into memory, the other three control code generation.
Let’s consider some of such operands:
· Attribute of segment alignment (type of alignment). It informs the compiler, that it is necessary to provide an allocation of the segment beginning at the given border (it is important for simplification of access to the data). There are following permissible meanings of this attribute:
§ BYTE. In this case the segment may be allocated starting from an arbitrary address in the main memory;
§ WORD. In this situation the initial (base) address of the segment will be dividable by 2;
§ DWORD. The segment begins with an address dividable by 4;
§ PARA. The segment begins with an address dividable by 16;
§ PAGE. The segment begins with an address dividable by 256;
§ MEMPAGE. The segment begins with an address dividable by 4 Kbytes.
· Attribute of segments combining (combining type). It informs the compiler, that it is necessary to combine segments of different modules, which have the same name. The default the combining is PRIVATE. Meanings of this attribute may be following:
· PRIVATE. In this case the segment will not be united with other segments;
· PUBLIC. It compels the compiler to unite all segments (with the same name) in one continues segment;
· COMMON. In this case all the segments will overlay and use collectively (share) the memory (the size of such segment will be equal to the size of the segment with the largest area).
· STACK. It determines a segment for the stack (there is some analogy with the PUBLIC).
· Attribute of segment class (type of class). It is enclosed in inverted commas (‘’) string, which helps the compiler to determine an order of segments location during compilation a program, which consists from several modules
· Attribute of segment’s size. For microprocessors i80386 and higher segments may be 16- or 32-width, so it may influence on segments sizes and on the order of the physical address formation inside these segments. This attribute may have the following meanings:
· USE16 – it means, that during a physical address formation, can be used only 16-width offset;
· USE32 – it means, that during a physical address formation, can be used only 32-width offset.
Turbo Debugger (TD) is a window medium for debugging programs. It allows to solve the following problems:
q to determine a place of logic error;
q to determine the reason of logic error appearance;
The TD has got the following abilities:
· to execute a program’s trace forward, i. e. a sequential program’s execution, when only one machinery instruction is fulfilled per one step;
· to execute a program’s trace backward, i. e. execution one machinery instruction per one step in the opposite direction;
· survey and change of state of the microprocessor’s hardware during execution program’s instructions.
Model of Memory (used by a program in Assembly) determines a number of segments, segments allocation in the memory, dimensions and properties of some variables used in the program, on default, it determines types of procedures (far or near) and so on.
There are 7 types of Memory Model:
· Tiny; Small; Medium; Compact; Large; Huge; Flat.
1. In the Tiny Model only one segment (name “DGROUP”) is used, so registers CS, DS and SS have got the same ch model corresponds programs, which are stored in files of *.com type. The maximal length of such program can not be more than 64 Kbytes.
2. In the Small Model there are 2 segments: segment of codes and data segment (name “DGROUP”); DS and SS registers have got the similar predestination. This type is more often used.
3. The Compact Model is analogous to the Small, but it permits to use several data segments, DS and SS registers have got the similar predestination.
4. The Medium Model may be considered in some sense as opposite to the Compact one, since in such programs several segments of codes and one common segment of data (stack is also included in this segment) are used. An access to subroutines of these programs is fulfilled with help of far addresses (segment:offset), and to data by using only offset (near addresses).
Remark: as for addresses recording are used two components, then for the address determination it is possible to use only one part of the whole (physical) address, namely – offset, or both components. In the first case the address is called near, and in the second – far.
5.The Large Model is the more common variant of memory organization; several code segments and several data segments may be used in this case. The addressing is executed by using as offsets, so segments.
6. and 7. Models Huge and Flat are used comparatively seldom. The Model Huge is used only for compatibility with high-level languages (in this situation it is possible to use data which need more than 64 Kbytes). It is not recommendable to use such models in Assembly. The Model Flat is identical to the Model Small, but in it 32-width registers are used.
The format of directive MODEL:
MODEL [<modifier>] <type> [<code-name>] [<language>]
If the directive MODEL is used, then the beginning and continuation of segments are determined by simplified directives: CODESEG[name], DATASEG, STACK[size], and some other; in this case the translator makes accessible some identifiers, to which it is possible to address during the program execution in order to obtain information concerning some characteristics of the given Model of Memory (for example, with help of identifier @data the physical address of data segment can be obtained).
Integers.
Unsigned Integers.
It is a simplest type of data: they present the whole diapason (range) of binary numbers, which can be written in one byte, word or double word. For one byte unsigned integers can have meanings from 00h (0) up to FFh (255); for one word: from 0000h (0) up to FFFFh (65 535); for double word: from 00000000h (0) up to (4 294 967 295).
Signed Integers.
When we work with signed integers, one half of the whole diapason is allotted to the positive integers, and the another one is allotted to the negative integers, so the diapason will reduce twice. Moreover a special system of coding is envisaged for avoiding an intersecting of negative and positive numbers, namely, it is accepted to represent negative numbers in so called two’s complemented code (TCC), which is formed from the direct code by substituting 0 by 1 and vice versa and adding a unity to the obtained result.
|
Из за большого объема этот материал размещен на нескольких страницах:
1 2 3 4 5 6 |


