Comando DD no Assembly

Published: 2019-08-04, Updated: 2017-10-06

Minha Explicação

Basicamente o DD e esses outros ditos abaixo são como declaradores de variáveis que podem ser referenciados com um nome(exatamente como variáveis) a grande diferença é que eles são alocados logo a frente e essa é uma forma mais baixo nível de se fazer isso

Explicação da internet

Declaring Static Data Regions

You can declare static data regions (analogous to global variables) in x86 assembly using special assembler directives for this purpose. Data declarations should be preceded by the .DATA directive. Following this directive, the directives DB, DW, and DD can be used to declare one, two, and four byte data locations, respectively. Declared locations can be labeled with names for later reference — this is similar to declaring variables by name, but abides by some lower level rules. For example, locations declared in sequence will be located in memory next to one another. Example declarations:

.DATA var DB 64 ; Declare a byte, referred to as location var, containing the value 64. var2 DB ? ; Declare an uninitialized byte, referred to as location var2. DB 10 ; Declare a byte with no label, containing the value 10. Its location is var2 + 1. X DW ? ; Declare a 2-byte uninitialized value, referred to as location X. Y DD 30000 ; Declare a 4-byte value, referred to as location Y, initialized to 30000. Unlike in high level languages where arrays can have many dimensions and are accessed by indices, arrays in x86 assembly language are simply a number of cells located contiguously in memory. An array can be declared by just listing the values, as in the first example below. Two other common methods used for declaring arrays of data are the DUP directive and the use of string literals. The DUP directive tells the assembler to duplicate an expression a given number of times. For example, 4 DUP(2) is equivalent to 2, 2, 2, 2.

Some examples:

Z DD 1, 2, 3 ; Declare three 4-byte values, initialized to 1, 2, and 3. The value of location Z + 8 will be 3. bytes DB 10 DUP(?) ; Declare 10 uninitialized bytes starting at location bytes. arr DD 100 DUP(0) ; Declare 100 4-byte words starting at location arr, all initialized to 0 str DB 'hello',0 ; Declare 6 bytes starting at the address str, initialized to the ASCII character values for hello and the null (0) byte.


Rest Commands Desabilitar o windows defender para sempre

Comments