MP PR - OR Question Bank
MP PR - OR Question Bank
Ans: The data section is used for declaring initialized data or constants. This data doesnot
change at runtime. You can declare various constant values, file names, or buffersize,
etc., in this section.
The syntax for declaring data section is −
section.data
msg1 db ‘hello world’
8. What is the use of .bss section?
The bss section is used for declaring variables. The syntax for declaring bss sectionis −
section.bss
num1 resb 2
The text section is used for keeping the actual code. This section must begin withthe
declaration global _start, which tells the kernel where the program executionbegins.
The syntax for declaring text section is −
section.text
global _start
_start:
Assembly language comment begins with a semicolon (;). It may contain anyprintable
character including blank. It can appear on a line by itself, like –
The executable instructions or simply instructions tell the processor what to do. Each
instruction consists of an operation code (opcode). Each executable instruction generates one
machine language instruction.
The assembler directives or pseudo-ops tell the assembler about the various aspects of the
assembly process. These are non-executable and do not generate machine language
instructions
e.g. DB,DW,DQ,EQU,END,ENDP,ENDS,EQU
3. Macros
When we need to use group of instructions several times throughout programs macro is used.
A macro is a sequence of instructions, assigned by a name and could be used anywhere in the
program.
Syntax:-
%macro macro_name number_of_params
<macro body>
%endmacro
e.g
%macro write 2
mov rax, 1
mov rdi, 1
mov rsi,%1
mov rdx, %2
syscall
%endmacro
Write msg,len
3. Exit
mov rax,60
mov rdi,0
syscall
mov al,[rsi]
cmp al,39h
jbe p1
sub al,07h
jmp p2
p1: sub al,30h
p2: add bl,al
inc rsi
loop up1
ret
23. Why we use Display procedure in ALP?
Ans:- Convert HEX to ASCII
mov rcx,4
mov rdi,result
dup1:
rol bx,4
mov al,bl
and al,0fh
cmp al,09h
jbe p3
add al,07h
jmp p4
p3: add al,30h
p4:mov [rdi],al
inc rdi
loop dup1
24. What are the sizes of following registers?
GDTR, TR, LDTR, IDTR
NOTE:- Prepare for instructions and questions given after each assignments.