0% found this document useful (0 votes)
34 views3 pages

Solution COAL Mid Term Updated

The document contains four questions related to assembly language programming for 8086 microprocessor. Question 1 classifies the bits of flag register and determines the effect on specific bits. Question 2 evaluates the contents of ax, bx and cx registers after code execution. Question 3 writes an assembly language program to compare values entered by the user. Question 4 calculates physical and logical addresses given segment and offset values.
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)
34 views3 pages

Solution COAL Mid Term Updated

The document contains four questions related to assembly language programming for 8086 microprocessor. Question 1 classifies the bits of flag register and determines the effect on specific bits. Question 2 evaluates the contents of ax, bx and cx registers after code execution. Question 3 writes an assembly language program to compare values entered by the user. Question 4 calculates physical and logical addresses given segment and offset values.
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/ 3

PMAS Arid Agriculture University Rawalpindi

University Institute of Information Technology

Mid Term Examination-Spring-2023


BSSE/BSCS – 4th Semester (M/E)
Computer Organization and Assembly Language
CSC-211
Registration No.________________ Total Time: 75 Minutes
Maximum Points: 12
-----------------------------------------------------------------------------------
Question 01: Flag register of 8086 is of 16 bit. Classify all the bits into 3 three categories. Also determine
the effect of the following on given bits. [3 marks]
Solution:
Classes for Flag Register Bits:
1. Status Flags bits
2. Control Flags Bits
3. Don’t Care Bits
Sr.No Problem AF SF ZF CF OF PF
1. 8FD3h + 6FFFh 1 1 0 0 0 1
2. 8943h – 3422h 0 1 0 0 0 1
3. 01010001 + 11011101 0 0 0 1 1 0
4. FFFDh + CCFFh 1 1 0 1 1 1

Question 02: Consider the following code fragment. What are the contents of the ax, bx and cx registers
after the code fragment has been executed? Show your work. [3
marks]
.data
Var1 dw 5
Var2 dw 6
.code
mov ax, Var1
mov bx, ax
mov cx, ax+2
add bx, Var2
add cx, bx
mov ax, cx
Solution:
AX = 18
BX = 11
CX = 18
Question 03: Consider a C++ program with the following instructions: [3 marks]
int a , b ;
cin >> a ;
cin>> b ;
If(a < b){ cout<< a << " is greater"};
PMAS Arid Agriculture University Rawalpindi
University Institute of Information Technology

If(a > b){ cout<< b << " is greater"};


Write an assembly language program that compares and display the values after comparison.
Solution:
.model small
.stack 100h

.data

MSG db " is greater $"

.code
main proc
mov ax, @data
mov ds, ax

jmp ainput
jmp binput

ainput:
mov ah,1;
int 21h
mov bl,al

binput:
mov ah,1;
int 21h
mov bh,al

cmp bl,bh
jl agreater

agreater:
mov ah,2
mov dl,13
int 21h

mov ah,2
mov dl,10
int 21h

mov ah,2
mov dl,bl
int 21h
mov ah,9
lea dx,MSG
int 21h

cmp bh,bl
jg bgreater
PMAS Arid Agriculture University Rawalpindi
University Institute of Information Technology

jmp exit

bgreater:
mov ah,2
mov dl,13
int 21h

mov ah,2
mov dl,10
int 21h

mov ah,2
mov dl,bh
int 21h
mov ah,9
lea dx,MSG
int 21h

exit:
mov ah, 4ch
int 21h

main endp
end main

Question 04: consider that you have the following logical address for 8086 microprocessor’s instruction.
A4FBh : 4872h
find the physical address using the given logical address and then find the logical address with the
segment = 0008h along with the physical address computed. [3 marks]
Solution:
segment = A4FBh
offset = 4872h
physical address = (segment x 10h) + offset
physical address = A9822h
now, segment = 0008h and physical address = A9822h
So,
Logical address = (physical address) - (segment x 10h)
Logical address = A98A2

*****Good Luck*****

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy