0% found this document useful (0 votes)
16 views4 pages

COAL. Fall 2024, Section A, B Problem Set 2 Instructions

Uploaded by

aneezakiran2007
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
16 views4 pages

COAL. Fall 2024, Section A, B Problem Set 2 Instructions

Uploaded by

aneezakiran2007
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 4

COAL.

Fall 2024, Section A, B

Problem Set 2
____________________________________________________________________________________________________________
Instructions:

This problem set contains 13 questions. Some of these questions are for your practice and some are to be submitted as an assignment.
The list of the questions that are to be submitted as assignment is as follow.

Assignment questions: 2, 3, 6, 7, 9, 10, 13

Due date: 16th September, 2024 (5pm).

Submission format: Soft Copy

Submit at: Google Classroom.

Late Submission: -25% for each day

____________________________________________________________________________________________________________

Physical Address:

1. Solve Q11 to Q 21 Chapter 1 of Bilal Hashmi


2. Consider the value of segment registers as follow

CS= 0AFFh

DS= FFFFh

ES= F001h

SS=01BBh

Answer the following questions

a. If bx=0101h, what is the physical address of [bx]?


b. If bx=0101h what is the physical address of [CS:bx]?
c. If IP= 0100h, from which physical address the next instruction will be fetched?
d. If BP= 0FFFh from which physical address is [BP+2]?
3. For each of the code snippet given below, write value of each flag after logical/arithmetic operation and mention if the jump will
be taken or not

CODE SF OF CF ZF Jump Taken?


MOV AX, 0XF0F0
AND AX, 0X0F0F 0 UNAFF unaffect 1 yes
JZ LABEL1 ECTED ed
MOV AX, 0XF0F0
OR AX, 0XFF0F 1 u u 0 yes
JS LABEL1
MOV AX, 0XF2
SUB AX, 0XFA 1 u 1 0 no
JNS LABEL1
MOV BX, 0XA2
CMP BX, 0XC0
JL LABEL1
MOV AX,5
CMP AX,6
JL L1
MOV AX,5
CMP AX,4
JG L1
MOV DX,0XA523
CMP DX,0XA523
JE L1
MOV DX,0XA523
CMP DX,0XA523
JNE L5
MOV AL,+127 ;
HEXADECIMAL VALUE IS
7FH CMP AL,-128 ;
HEXADECIMAL VALUE IS
80H
JG ISGREATER
MOV AL,+127 ;
HEXADECIMAL VALUE IS
7FH CMP AL,-128 ;
HEXADECIMAL VALUE IS
80H
JA ISABOVE
MOV AL,+127 ;
HEXADECIMAL VALUE IS
7FH CMP AL,-128 ;
HEXADECIMAL VALUE IS
80H
JNG LABEL
MOV AL,+127 ;
HEXADECIMAL VALUE IS
7FH CMP AL,-128 ;
HEXADECIMAL VALUE IS
80H
JNA LABEL
MOV Ax, 0xFFFF
SUB AX,2 ;
JG LABEL
MOV Ax, 0xFFFF
SUB AX,2 ;
JA LABEL

4. What is the highest and the lowest possible signed number that can be stored in 8 bits
5. What is the highest and lowest unsigned number that can be stored in 8 bits
6. What is the highest and the lowest possible signed number that can be stored in 16 bits
7. What is the highest and lowest unsigned number that can be stored in 16 bits

8. Write a program to find square of ‘num’ and saves it in ‘square’. You will find the square of num by adding it num times. The
addition should be performed in a loop.

The basic structure of code is given write you code where specified
[org 0x0100]

; your code should start here

; your code ends here

mov ax, 0x4C00

int 21h

num: dw 16

square: dw 0

9. Write a program in assembly to find the square of each number in array1 and store it in array 2, using loops. The size of array 1
and array 2 is 10. Note that array 1 is unsigned array and you can only use addition to find the square (use of multiplication
instruction is not allowed).

The basic structure of code is given write you code where specified
[org 0x0100]

; your code should start here

; your code ends here

mov ax, 0x4C00

Array1: dw 3,5,7,4,9,2,1,0,12,16

Array 2: dw 0,0,0,0,0,0,0,0,0,0

10. Write a program in assembly to find the maximum number from a signed array, array 1. Write that number in max. The basic
structure of code is given write you code where specified.

[org 0x0100]

; your code should start here

; your code ends here

mov ax, 0x4C00

Array1: dw 3,-5,7,4,-9,2,1,0,12,-16

Max: dw 0

11. How will you modify above code if the array was unsigned?
12. How will you modify the following code using unconditional jump such that it works properly?

num1: dw 1,
num2: db 10
sum: dw 0

[org 0x0100]
mov ax, [num1]
mov bl, [num2]
add ax, bx
mov [sum], ax

mov ax, 0x4c00 ; terminate program


int 0x21

13. Translate the following flow charts to assembly code

You might also like