You are on page 1of 4

IT2104

Task Performance
Assembly Language Basics
Objective(s):

At the end of the exercise, the students should be able to:

▪ Determine the role of assembly language in computers; and


▪ Identify the structure of codes in assembly language.

Instructions:
Part 1 (40 points)
1. Search for two (2) free online assemblers available on the Internet. For each assembler, answer the
following items:
a. What organization/company manages the online assembler? (2 points)

Australian software development company(jdoodle)

OneCompiler

b. Provide the links to the online assembler. (3 points)

https://onecompiler.com/assembly
https://www.jdoodle.com/compile-assembler-nasm-online/

c. Take a screenshot of the initial content of the code editor of the assembler. (5 points)

02 Task Performance 1 *Property of STI


Page 1 of 2
IT2104

d. Run the initial codes in the editor and take a screenshot of the output/result. (5 points)

e. Does the assembler support an x86 architecture? Elaborate on your answer. (5 points)

The jdoodle assembler can be used to create programs for the x86 architecture. It supports 32-
bit code, which can be executed on any x86 processor. The code editor in the assembler
includes sample code for using common registers, such as the accumulator register (eax) and
the base register (ebx).
Part 2 (30 points)
1. Go to https://www.jdoodle.com. At the right portion of the webpage you will see the list of different
programming languages (those that are underlined). Click on the Assembler (NASM). This will direct
you to the Online Assembler – NASM Compiler IDE.
• The Netwide Assembler (NASM) is an assembler that also caters to x86 architecture, such as
the Emu8086. It supports a wide range of object file formats including ELF, COFF, Linux and
NetBSD/FreeBSD, Microsoft 16-bit OBJ and Win32. It encompasses a simple and easy-to-
understand syntax, similar to Intel 8086 but with reduced complexity. NASM was mainly
designed for portability and modularity.
2. Click the Full Screen button (in line with the Execute button) to maximize the assembler's interface.
Then, analyze the assembly codes in the code editor. Click the Execute button and see the output at
the Result section.
3. Answer the following question regarding the initial assembly codes in the editor (5 items x 3 points):
02 Task Performance 1 *Property of STI
Page 2 of 2
IT2104

a. What does the program do?


The program sums the x and y. The syntax for registering the variable is the eax. ebx, edx, and
ecx. The equ is the one that defines symbolic names for values.

b. Is the result of the program correct?

Yes, because eax sub 0 then after declaring all the variables, x value is 5 then y value is 3 to
sum it up it is equal to 8.
c. How much memory was utilized in the program execution?

Memory consumes 344 kilobytes

d. How long did it take to execute the program?

It took 0.906 seconds


e. Under what section were the x and y initialized?

In the .data section, initially, both x and y are initialized with values of 0. After
declaring variables for msg, len, and sum, x is redefined as 5, and y is redefined as 3.

4. Delete the content of the code editor and type the assembly codes below:

02 Task Performance 1 *Property of STI


Page 3 of 2
IT2104

5. Execute the program. Then, answer the following items (5 items x 3 points):
a. What does the program do?

The program inserts the first value of 9 and then 3 then after that it declares division. The res,
length, and message just to print the “The result is”. So overall what the program did was to
perform a division that converts the result to a character and then display the result with the
message.

b. How many sections were used in the program?

There were 3 sections the .text, .data, and .bss. the text is for program’s executable code, the
data is for data defintions and constants, the bss is for unset data storage.

c. Identify at least three (3) mnemonics (opcode/directive/macro) that were used in the program.

mov to move data, div to divide the data, db to define a byte in the data section

d. Identify at least three (3) operands that were used in the program.

ax and bl are the operands for arithmetic instructions. Ecx, edx, ebx, and eax are the operands
that moves values between the register or the memory locations. The [res] it is the one that
refers to the memory location and pointed by the res.

e. In the program above, which lines of codes indicate the storage space allocation for the
message and message length?|

The line message db "The result is " allocates storage for the message in the .data section,
while length equ $ - message calculates and assigns the message length. These lines
indicate storage allocation for the message and its length.

Grading Rubric for Essay:


Criteria Performance Indicator Points
Content Correct ideas, concepts, and/or examples were included. 3
Organization The ideas were presented in an organized manner. 2
TOTAL 5
Note: DO NOT COPY AND PASTE. Students who copy and paste their work from any website or their classmate will automatically receive a failing mark for this assessment task.

02 Task Performance 1 *Property of STI


Page 4 of 2

You might also like