Home Random Page


CATEGORIES:

BiologyChemistryConstructionCultureEcologyEconomyElectronicsFinanceGeographyHistoryInformaticsLawMathematicsMechanicsMedicineOtherPedagogyPhilosophyPhysicsPolicyPsychologySociologySportTourism






Directives of memory distribution. Pseudocommands of variable definitions.

Directive memory allocation

Pseudo-command - this is an assembler directive, which leads to the inclusion of data or code into the program, although she is no command processor is not adequate. Definition of pseudo variables indicate the assembler that the appropriate point in the program is variable, determine the type of the variable (byte, word, a real number, etc.), give it an initial value, and are mapped to the variable label that will be used to access this data . Definition of pseudo data written in a general form as follows:

variable_name value d *

where D * - of pseudo one of the following:

DB - determine the byte;

DW - define the word (2 bytes);

DD - define double word (4 bytes);

DF - to determine the 6 bytes (address in 16-bit selector 32-bit offset);

DQ - define quadword (8 bytes);

DT - 10 identify bytes (80-bit data types used FPU).

The value field may contain one or more numbers, strings of characters (taken in single or double quotation marks), the operators? and DUP, separated by commas. All installed so the data will be in the output file, and the name of the variable will match the address of the first of these values. For example, a set of guidelines

text_string db 'Hello world!'

number dw 7

table db 1,2,3,4,5,6,7,8,9,0 Ah, 0Bh, 0Ch, 0Dh, 0Eh, 0Fh

float_number dd 3.5e7

fills 33 bytes of data. The first 12 bytes contain the ASCII-character codes string «Hello world!», And the variable text_string points to the first letter in the string, so the team

mov al, text_string

believes in the AL register by 48h (code Latin letter H). If, instead of the exact value of the specified character?, Is considered to be an uninitialized variable and its value at the time of starting the program could be anyone. If you need to fill up the memory of duplicate data, a special operator DUP, which has the format counter DUP (value). For example, here is the definition:

table_512w dw 512 dup (?)

creates an array of 512 uninitialized words, the first of which is pointed to by table_512w. The argument in the DUP operator can perform multiple values ​​separated by commas, and even additional nested DUP.


Date: 2015-01-29; view: 1109


<== previous page | next page ==>
Use of libraries. Directive INCLUDELIB. | Program organization. Segments
doclecture.net - lectures - 2014-2024 year. Copyright infringement or personal data (0.007 sec.)