Professional Documents
Culture Documents
Additional MPL Oral Questions
Additional MPL Oral Questions
Additional MPL Oral Questions
Directive Description
Allocates and initializes single or multiple data bytes. For example, DB 30H,
DB
52H, 35H reserves memory locations for these values.
Represents the beginning of a macro. Defines the name and parameters for
MACRO
reusable code segments.
ENDM Indicates the termination of a macro. Marks the end of the macro definition.
Macro Explaination-
%macro disp 2
mov rax, 01
mov rdi, 01
mov rsi, %1
mov rdx, %2
syscall
%endmacro
1. %macro disp 2: This line defines a macro named disp that takes two arguments.
Macros are reusable code segments that can be expanded inline during assembly.
2. The body of the macro contains the following instructions:
o mov rax, 01: This moves the value 01 into the rax register. The rax register
is commonly used for system call numbers.
o mov rdi, 01: This moves the value 01 into the rdi register. The rdi register
typically holds the first argument for system calls (e.g., file descriptors or
output streams).
o mov rsi, %1: This moves the first argument of the macro (specified by %1)
into the rsi register. The rsi register usually holds the second argument for
system calls (e.g., buffer addresses).
o mov rdx, %2: This moves the second argument of the macro (specified by %2)
into the rdx register. The rdx register often holds the third argument for
system calls (e.g., buffer sizes).
3. Finally, the syscall instruction is used to invoke a system call based on the values set
in the registers.