Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

How to declare the following type of variables in x64 assembly language? The var

ID: 3843238 • Letter: H

Question

How to declare the following type of variables in x64 assembly language? The variable age is of type word and is initialized to 22 Which of the following three sections of an assembly program in nasm has the source code? .data, .bss, .text? What is the purpose of the following: mov Rbx, Rax When a syscall is called which register must have the syscall number? Which syscall is a must for every program? Why? What is the difference in using register with or without the square brackets []? How is the constant Pl with a value of 3.1459 declared in x64 assembly language?

Explanation / Answer

q.35 )

ans :

-> syntax for declaring variables with initialization in x64 assembly language is :

VARIABLE_NAME VARIABLE_TYPE   VALUE

-> given that variable name is "age" , variable type is "word" and value is "22".

-> word type directive is "DW" allocate 2 bytes storage.

so, requied declaration is :

age DW 12

q.36 )

ans :

-> The .data section is used for declaring variables , initializing variables or constants.

-> syntax for declaring .data section is :

->The .bss section is used for declaring variables.

-> syntax for declaring .bss section is :

-> The .text section is used forwriting the source code. This section must start with the declaration statement global _start

-> syntax for declaring .text section is :

q.37)

ans :

-> mov command is used to move source value to destination .

syntax for mov command in assembly language is :

mov destination , source

-> the purpose of

mov Rbx , Rax

instruction is -> to move value of Rax register into Rbx register.

q.38)

ans :

sys_exit system call must use in assembly program, to send an interrupt to exit the program.

-> the code for sys_exit system call in assembly language is :

mov eax , 1

int 80h or int 0x80

q.39)

ans :

->register with bracket means consider memory value at address .

for example [eax] means eax value as address and value in this address as [eax].this is called as register address mode,

i.e eax=100

at 100th address value =2

than [eax ] = 2

->register without bracket means consider value at register .

eax =100 itself.

q.40)

ans :

-> constants are declared in assembly language by using "EQU" command.

-> syntax for constants is :

CONSTANT_NAME EQU CONSTANT_VALUE

-> for example pi=3.1459 is declared as :

pi equ 3.1459

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote