Lab 03
Lab 03
Lab 03
1. Overview
A properly formatted assembly source file consists of several sections;
2. Objectives
This lab aims to provide students with ability:
3. Lab Environment
Students can either practice the labs with Ubuntu linux VM (VirtualBox) or WSL2 (preferable).
On either way, install nasm, gcc, gdb-peda by doing the following commands at linux prompt:
~# sudo apt update
~# sudo apt install git nasm gcc gcc-multilib
~# git clone https://github.com/longld/peda.git ~/peda
~# echo "source ~/peda/peda.py" >> ~/.gdbinit
For writing code, students are recommended to install VSCode with the following extensions:
Extensions Description
4. Tasks
4.1. Compose an ASM program in nano text editor
Initialized variables
Unititialized variable
Compile source code with nasm then load executable file in gdb
To accomplish this task, the students need to refer to the internet resources for arithmetic assembly
instructions
Modify the source file, add code to compute Addition, Subtraction, Multiplication, Quotient, Remainder
of two variables, store the result in variables.
Compile source code, load executable file in gdb then inspect the memories to check the results.
4.5 Do the following (*)
To accomplish this task, the students need to refer to the internet resources for assembly instructions
like memory copying, string operations, …
Modify the source code to do the following:
a) Fill bArr with the value of bNum
b) Copy list to wArr
c) Copy hello string to cArr
d) Print out cArr to console
Compile source code, load executable file in gdb then inspect the memories to check the results.
4.6 Compute the sum of an array
Compute the sum of elements from list array, load the program in gdb to check the result.