department of computer science
college of computing
western delta university
second semester examination 2022/2023 session
CSC202 - assembly language programming time: 2hrs
answer question 1 and any other THREE questions
Question 1
- Write a complete assembly language program that computes circumference of a circle given as
πr
, wherer
is the radius of the circle, using the relevant functions inio.H
(5 marks) - Define the following:
- Register (2 marks)
- Directive (2 marks)
- Give the syntax of an assembly language directive (2 marks)
- State two examples of a directive (2 marks)
- Given the decimal number 27.62510, calculate its binary equivalent (4 marks)
- Given the hexadecimal number 1516, calculate its binary equivalent (4 marks)
- Write an assembly language representation for the following C program segment:
(4 marks)sum = 0, i = 0, x = 10;
while (i <= 10)
{
sum = sum + x;
x = x + 2;
i = i + 2;
}
- Write a complete assembly language program that computes circumference of a circle given as
Question 2
- Identify the addressing mode in the following instructions:
(5 marks)mov ax, 0ah
mov bx, array + 10h
mov ax, [si] + 16
mov ax, [si]
inc cl - Interpret the following instruction:
array DW 100 DUP(0)
(2 marks) - State two limitations of the
MOV
instruction (2 marks)
- Interpret the following instruction:
- State the function of the
movsb
instruction (2 marks) - Write an assembly language program segment to move the string:
"Sessional Examination for 2021/2022 is in Progress"
from its original location to a new location. (4 marks)
- State the function of the
- Identify the addressing mode in the following instructions:
Question 3
- Define an Interrupt handler (2 marks)
- Given that the BIOS keyboard services is
INT 16h
, calculate:- The address of the interrupt vector table (4 marks)
- State the last instruction in an interrupt handler (2 marks)
- State the function of the instruction stated in (bii) (2 marks)
- What is the result of the execution of the instruction stated in (bii) (2 marks)
- Write an assembly language program segment that send a character to the printer using a DOS function call. (3 marks)
Question 4
- Define the following:
- Macro
- Macro processor
- Given that
s = x2y + xy;
- Write a macro to compute
s
(3 marks) - Write a FAR procedure to calculate
s
(4 marks) - Highlight two differences between macro and procedure (4 marks)
- Write a macro to compute
- Define the following:
Question 5
- In a word division using
IDIV
instruction, state the register(s) that represents the following:- Dividend
- Quotient
- Remainder
- Write an assembly language program segment to demonstrate how the following DOS function service is used:
09h
(3 marks) - The following are the scores of Efe in mid-semester test:
56 67 89 82 64
. Write an assembly language program segment that declares the scores, computes the total and average scores. (6 marks)
- In a word division using
Question 6
- State the function of
LEA
. Give one example of assembly instruction illustrating the use ofLEA
(4 marks) - Write an assembly language representation for the following C program segment
(6 marks)y1 = 25;
y2 = 30;
printf("Enter value for variable a: ");
scanf("%d", &a);
if (a < 60)
y1 = y1 + 10;
printf("%d", y1);
else
y2 = y2 - 5;
printf("%d", y1); - Define Interrupt (7 marks)
- Convert 25616 to its decimal equivalent (3 marks)
- State the function of