DCI FEEI TUKE

Assembler 2017

Exam topics

Lecture 1
Lecture 2
Lecture 3
Lecture 4
Lecture 5
Lecture 6
Lecture 7
Lecture 8

Exercise 1
- Compile the example program and study how it works.
- Understand how it calculates the hex form of ASCII code of the input character.
- Add the octal output.
Exercise 2
- Complete the program to print the entered string in CAPITAL form.
- Example:
Enter a string: Hello world!
The string entered in capital: HELLO WORD!
Exercise 3
- Program 1: passing parameters to procedures (Ex03_C02_sub3.asm).
- Study and understand the assembly implementation.
- Modify the program such that the output will be the biggest of numbers entered.
- Program 2: utilization of local variables (Ex03_C03_pfib2.asm).
- Study and understand the assembly implementation.
- Modify the program such that the output will contain also the following Fibonnaci number.
- Example:
Enter positive integer (>1): 50
Largest Fibonacci number less or equal 50 is 34
The following Fibonacci number is 55
Exercise 4
- Program for finding prime numbers up to given limit (primes.asm).
- Study and understand the assembly implementation.
- Complete the program such that the output will be the correct sequence of prime numbers up to given limit.
- Example:
Find prime numbers up to: 20
2
3
5
7
11
13
17
19
Exercise 5
- Program for finding bigger of two numbers, without conditional jumps, using logical operations (Ex05_max.asm).
- Study and understand the assembly implementation.
- Modify the program such that the output will be the smaller of numbers entered.
- Example:
Enter a number: 23
Enter another number: 17
Bigger of the numbers (in case they are different) is: 23
- Program for multiplying two (8-bit, unsigned) numbers using shift operations (Ex06_shlmlt_mr.asm).
- Study and understand the assembly implementation.
- Try to shorten/optimize the multiplying procedure (e.g. using further bit operations like bsf, btc).
Exercise 6
- String processing, combining Assembly code with C.
- mem_mr.asm - contains definitions of string operations (_asm_copy, _asm_find).
- memx_mr.c - calling operations defined (in mem_mr.asm) and testing their functionality.
- Complete the definitions for operations _asm_strlen and _asm_strcpy and use them within mem_mr.c.
- Compilation:
nasm -f win32 mem_mr.asm
gcc -o mem_mr memx_mr.c mem_mr.obj
Exercise 7
- Start with the program from the Exercise 6.
- Update the mem_mr.asm file such that the program will support two additional operations:
    _asm_strcat - appends the string pointed to by src to the end of the string pointed to by dest
    _asm_toupper - changes lower-case letters in a string pointed to by src to upper-case
- Update the memx_mr.c file in a way that the program will use the two additional operations
Exercise 8
- Try to compile and run the "dfirst.asm" program from the Lecture 8. Study and understand the assembly implementation.
- Create a program which takes a string from the user and prints characters of the string in reversed order.
- Use the services of operating system (Linux, MS DOS) to perform input/output operations.
NASM Assembler used within the subject.