Professional Documents
Culture Documents
section .text
global main
main:
section .data
OUTPUT:
20171030725
SYS_EXIT equ 1
SYS_READ equ 3
SYS_WRITE equ 4
STDIN equ 0
STDOUT equ 1
segment .data
segment .bss
num1 resb 2
num2 resb 2
res resb 1
section .text
int 0x80
int 0x80
int 0x80
mov edx, 2
int 0x80
int 0x80
; moving the first number to eax register and second number to ebx
mov edx, 1
int 0x80
exit:
int 0x80
OUTPUT:
Enter a digit:
section .text
global _start ;must be declared for linker (ld)
_start: ;tell linker entry point
; writing the name 'Eze prof '
mov edx,9 ;message length
mov ecx, name ;message to write
mov ebx,1 ;file descriptor (stdout)
mov eax,4 ;system call number (sys_write)
int 0x80 ;call kernel
mov [name], dword 'Oti ' ; Changed the name to Oti Prof
; writing the name 'Oti Prof'
mov edx,8 ; message length
mov ecx, name ; message to write
mov ebx,1 ; file descriptor (stdout)
mov eax,4 ;system call number (sys_write)
int 0x80 ;call kernel
mov eax,1 ;system call number (sys_exit)
int 0x80 ;call kernel
section .data
name db 'Eze Prof' , 0xa
OUTPUT:
Eze Prof
Oti Prof
TASK I
Title:
Basic Assembly language syntax
Aim:
To introduce the student to basic structure and syntax of assembly language
program and basic assembly process
Definition:
The text section: it contains the actual code. This section begins with
declaration "global main", which tells the kernel where the program execution
begins.
The data section: This is used to declare initialized data. The data initialized in
this report are Full name and Registration number.
The bss section: This is used to declare variables.
Observation:
1. NASM Environment was used.
2. No presence of variable, .bss section was not employed.
3. The 0xa (ZeroAphaApha) is used to make strings appear in separate line.
Comma (,) must end a string before it is applied.
Conclusion:
The program runs efficiently.
TASK II
Title:
I/O operation in assembly.
Aim:
To expose student to the basics of input/output operation
Definition:
The text section: it contains the actual code. This section begins with
declaration "global main", which tells the kernel where the program execution
begins.
The data section: This is used to declare initialized data. The data initialized in
this report prompt user to input two digits number.
The bss section: This is used to declare variables.
Observation:
1. Reserved directives where used on .bss segment, this take a single operand and
specifies the number of units of space to be reserved.
2. Multiple definition statement was employed.
3. Register eax is used in I/O instruction.
4. Register edx is used for I/O operations.
5. Register ebx is used in indexed addressing.
6. Register ecx stores loop count.
7. ASCII and decimal value where used in calculation operations.
Conclusion:
The program aim was satisfied.
TASK III
Title:
Interpreting Assembly Language program
Aim:
To sharpen the student skill for interpreting assembly program.
Interpretation:
This program was meant to store the name 'Prof Eze ' in the data section of the
memory and then change its value to another name 'Prof Oti' programmatically and
display both names.
Accuracy of Interpretation:
The output was not accurate as program finished executing.
Observation:
1. Only the first word (uncommon names) was switched.
2. The 0xa (ZeroAphaApha) is used to make strings appear in separate line.
Comma (,) must end a string before it is applied.
Conclusion:
The aim of this topic was ascertained as proper modifications was carried out
on the program.
FEDERAL UNIVERSITY OF TECHNOLOGY
OWERRI, IMO STATE (FUTO)
ASSIGNMENT
ON
BY