0% found this document useful (0 votes)
143 views57 pages

COA LAB Assignment Combined

This document provides details about a lab experiment on examining different arithmetic operations on two 16-bit data using the 8086 microprocessor. The objectives are to perform addition, subtraction, multiplication, and division of two 16-bit numbers using direct addressing mode. Students are required to write assembly code to perform the arithmetic operations and observe the outputs. In the pre-lab section, direct addressing mode is explained and sample assembly code is provided for addition. In the post-lab section, questions related to general purpose registers, segmented memory, physical address formation, and a programming problem are asked.

Uploaded by

varun sahani
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)
143 views57 pages

COA LAB Assignment Combined

This document provides details about a lab experiment on examining different arithmetic operations on two 16-bit data using the 8086 microprocessor. The objectives are to perform addition, subtraction, multiplication, and division of two 16-bit numbers using direct addressing mode. Students are required to write assembly code to perform the arithmetic operations and observe the outputs. In the pre-lab section, direct addressing mode is explained and sample assembly code is provided for addition. In the post-lab section, questions related to general purpose registers, segmented memory, physical address formation, and a programming problem are asked.

Uploaded by

varun sahani
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/ 57

Computer Organization and Architecture

(EET2211)

LAB I: Examine & Analyze Different Addressing Modes


of 8086 Microprocessor

Siksha ‘O’ Anusandhan Deemed to be University, Bhubaneswar

Branch: CSE Section:


S. No. Name Registration No. Signature

Marks:
______/10

Remarks:

Teacher’s Signature

I. OBJECTIVE:
1. Addition of two 16bit numbers using immediate addressing mode.
2. Addition of two 16bit numbers using direct addressing mode.
3. Addition of two 16bit numbers using indirect addressing mode.
4. Addition of two 16bit numbers using index addressing mode.
5. Addition of two 16bit numbers using base index addressing mode.

II. PRE-LAB
For Obj. 1:

a. Explain immediate addressing mode briefly.


Ans: The addressing mode in which the data operand is a part of the instruction itself is
known
as immediate addressing mode.
b. Examine & analyze the output obtained from addition of two 16 bit numbers.
Ans: In immediate addressing mode when we are taking 2 values for example 3000h and
5000h, here the values act as the actual values and the output is the sum of the two
numbers i.e. 8000h.
c. Write the assembly code.
Ans: org 100h
mov ax,3000h
mov bx,5000h
add ax,bx
hlt

For Obj. 2:

a. Explain briefly the direct addressing mode.


Ans. The addressing mode in which the effective address of the memory location is
written
directly in the instruction.
b. Examine & analyze the output obtained from addition of two 16 bit numbers.
Ans. Here in direct addressing we add the two 16 bit numbers that present in the given
memory location. For example we add [3000h] and [5000h], which means the
resultant sum is the sum of numbers present in those respective memory addresses.
i.e. [1000h] = 1111h
[1002h] =1234h
Sum = 2345h
c. Write the assembly code.
Ans. org 100h
mov ax,2000h
mov ds,ax
mov ax,[3000h]
mov bx,[3002h]
add ax,bx
mov [3004h],ax
hlt

For Obj. 3:

a. Explain indirect addressing mode briefly.


Ans. This addressing mode allows data to be addressed at any memory location through an
offset address held in any of following registers BP, BX, DI and SI.
b. Examine & analyze the output obtained from addition of two 16 bit numbers.
Ans. Here in indirect addressing mode we add two 16bit number whose values are hold in
the
source index (SI).
e.g. mov si,0500h
mov ax,[si]
inc si
inc si
mov bx,[si]
add ax,bx
[3000h] = 1111h
[3002h] = 1234h
Sum = 2345h

c. Write the assembly code.


Ans. org 100h
mov ax,3000h
mov ds,ax
mov si,0500h
mov ax,[si]
inc si
inc si
mov bx,[si]
add ax,bx
inc si
inc si
mov [si],ax
hlt

For Obj. 4:

a. Explain index addressing mode briefly.


Ans. In this addressing mode, the operands offset address is found by adding the contents
of
SI or DI register and 8 bit/ 16 bit displacements.
b. Examine & analyze the output obtained from addition of two 16 bit numbers.
Ans. Here in index addressing mode we are adding two numbers by incrementing the
address
value in the source index.
i.e. mov ax,[si]
mov bx,[si+2]
add ax,bx
Output [3000h] = 1111h
[3002h] = 1234h
Sum = 2345h
c. Write the assembly code.
Ans. org 100h
mov ax,5000h
mov ds,ax
mov si,1000h
mov ax,[si+0]
mov bx,[si+6]
add ax,bx
mov [si+10],ax
hlt

For Obj. 5:

a. Explain base index addressing mode briefly.


Ans: In this addressing mode, the offset address of the operand is computed by summing
the base register to the contents of an Index register.
b. Examine & analyze the output obtained from addition of two 16 bit numbers.
Ans. Here the two 16bit numbers are added by taking the sum of the values present in the
base register and the index register and stored in the register.
i.e. mov ax,[bx+si]
mov cx,[bx+si]
add ax,cx
Output [3000h] = 1111h
[3002h] = 1234h
Sum = 2345h
C. Write the assembly code.
Ans. org 100h
mov ax,0000h
mov ds,ax
mov bx,2000h
mov si,1000h
mov cx,[bx+si]
mov dx,[bx+si+02]
mov ax,cx
add ax,dx
mov [bx+si+08],ax
hlt

III. LAB:

Assembly Program:
Objective 1:
org 100h
mov ax,3000h
mov bx,5000h
add ax,bx
hlt

Objective 2:
org 100h
mov ax,2000h
mov ds,ax
mov ax,[3000h]
mov bx,[3002h]
add ax,bx
mov [3004h],ax
hlt

Objective 3:
org 100h
mov ax,3000h
mov ds,ax
mov si,0500h
mov ax,[si]
inc si
inc si
mov bx,[si]
add ax,bx
inc si
inc si
mov [si],ax
hlt
Objective 4:
org 100h
mov ax,5000h
mov ds,ax
mov si,1000h
mov ax,[si+0]
mov bx,[si+6]
add ax,bx
mov [si+10],ax
hlt

Objective 5:
org 100h
mov ax,0000h
mov ds,ax
mov bx,2000h
mov si,1000h
mov cx,[bx+si]
mov dx,[bx+si+02]
mov ax,cx
add ax,dx
mov [bx+si+08],ax
hlt
Observations (with screen shots):
Objective 1:

Fig. 1. Execution result of immediate addressing mode of 8086 emulator.


From this result I have observed that the final sum of the two numbers are stored in AX.

Objective 2:
Fig 2: Execution result of direct addressing mode of 8086 emulator.
From this result I have observed that the final sum of the two numbers are stored in AX i.e.
2345.
Objective 3:

Fig 3: Execution result of indirect addressing mode of 8086 emulator.


From this result I have observed that the final sum of the two numbers are stored in AX i.e.
2542.

Objective 4:
Fig 4: Execution result of index addressing mode of 8086 emulator.
From this result I have observed that the final sum of the two numbers are stored in AX i.e.
6116.

Objective 5:

Fig 5: Execution result of base index addressing mode of 8086 emulator.


From this result I have observed that the final sum of the two numbers are stored in AX i.e.
A77A.
Conclusion:
From the above lab experiment we learnt different types of addressing modes
and how they are used to store different values in different memory locations
and how they are fetched to perform the additions of two 16 Bit numbers.

IV. POST LAB:

1. Discuss different general-purpose registers used in 8086 microprocessor.


Ans. EU has 8 general purpose registers, two registers can also be combined to form 16-bit
registers. The valid register pairs are
AX (AL, AH)-> Word multiply, word divide, word I/O
BX (BL, BH)-> Store address information
CX (CL, CH)-> String operation, loops
DX (DL, DH)-> Word multiply, word divide, indirect I/O (used to hold I/O address during I/O
instructions If the result is more than 16 bits, the lower order 16 bits are stored in
accumulator and higher order 6 bits are stored in DX register).

2. Explain the concept of segmented memory. What are its advantages?


Ans. Segmentation is the process in which the main memory of the computer is divided into
different segments and each segment has its own base address. It is basically used to
enhance the speed of execution of the computer system, so that processor is able to fetch
and execute the data from the memory easily and fast.
The main advantages of segmentation memory are as follows:
1) It provides a powerful memory management mechanism.
2) Data related or stack related operations can be performed in different segments.
3) Code related operation can be done in separate code segments.
4) It allows to processes to easily share data.
5) It allows to extend the address ability of the processor, i.e., segmentation allows the
use
of 16-bit registers to give an addressing capability of 1 Megabytes. Without
segmentation, it would require 20-bit registers.
6) It is possible to enhance the memory size of code data or stack segments beyond 64 KB
by allotting more than one segment for each area.
3. Explain the physical address formation in 8086.
Ans. Physical Address=Base Address *10H+Offset
4. Write a program to add two 16 bit numbers 12H and 08H, and store the sum.
Ans. - org 100h
mov ax,0012h
mov bx,0008h
add ax,bx
hlt
Computer Organization and Architecture
(EET2211)

LAB II: Evaluate Different Arithmetic Operations on


two 16 bit data

Siksha ‘O’ Anusandhan Deemed to be University, Bhubaneswar

Branch: CSE Section:


S. No. Name Registration No. Signature
Marks:
______/10

Remarks:

Teacher’s Signature

I. OBJECTIVE:

6. Addition of two 16-bit numbers using direct addressing mode.


7. Subtraction of two 16 bit numbers using direct addressing mode.
8. Multiplication of two 16 bit numbers using direct addressing mode.
9. Division of two 16 bit numbers using direct addressing mode.

II. PRE-LAB

For Obj. 1:

a. Explain direct addressing mode briefly.


Ans. The addressing mode in which the effective address of the memory location is written
directly in the instruction.
b. Examine & analyze the output obtained from addition of two 16-bit numbers.
Ans. mov ax,[3000h]
mov bx,[3002h]
add ax,bx
mov [3004],ax
Here the result of the addition is stored in memory location 3004 i.e.
If 3000h = 5775 & 3002h= 8118 then the sum D88D is stored in 3004 memory
location.
c. Write the assembly code.
Ans. org 100h
mov ax,2000h
mov ds,ax
mov ax,[3000h]
mov bx,[3002h]
add ax,bx
mov [3004h],ax
hlt

For Obj. 2:

a. Examine & analyze the output obtained from subtraction of two 16-bit numbers.
Ans. mov ax,[5000h]
mov bx,[5004h]
sub ax,bx
mov [9004],ax
Here the result of the subtraction is stored in memory location 9004 i.e.
If 5000h = 3721 & 5004h= 1840 then the difference is 1EE1 stored in 9004 memory
location.
b. Write the assembly code.
Ans. org 100h
mov ax,1000h
mov ds,ax
mov ax,[5000h]
mov bx,[5004h]
sub ax,bx
mov [9004h],ax
hlt

For Obj. 3:

a. Examine & analyze the output obtained from multiplication of two 16-bit numbers.
Ans. mov ax,[8000h]
mov bx,[8008h]
mul bx
mov [9006],ax
Here the result of the 1st four bits of the multiplication is stored in memory location
9006 and the rest bits are stored in the DX register since the resultant value exceeds
the 4 bits of storage i.e. If 8000h = 1234 & 8008h= 1111 then the result 136A974 is
splitted with last 4 bits value A974 stored in 9006 memory location and the rest 136 is
stored in DX register.

b. Write the assembly code.


Ans. org 100h
mov ax,4000h
mov ds,ax
mov ax,[8000h]
mov bx,[8008h]
mul bx
mov [9006h],ax
hlt

For Obj. 4:

a. Examine & analyze the output obtained from division of two 16-bit numbers.
Ans. mov ax,[2000h]
mov bx,[2006h]
div bx
mov [3004],ax
Here the result of the diviion is stored in memory location 3004 i.e.
If 2000h = 5000 & 2006h= 0005 then the result is 1000 stored in 3004 memory
location.
b. Write the assembly code.
Ans. org 100h
mov ax,6000h
mov ds,ax
mov ax,[2000h]
mov bx,[2006h]
div bx
mov [3004h],ax
hlt

III. LAB:
Assembly Program:
org 100h
mov ax,1000h
mov ds,ax
mov ax,[3000h]
mov bx,[3002h]
add ax,bx
mov [4004h],ax
mov ax,[3000h]
sub ax,bx
mov [4006h],ax
mov ax,[3000h]
mov bx,[3002h]
mul bx
mov [4008h],ax
mov ax,[3000h]
mov bx,[3002h]
div bx
mov [400Ah],ax
hlt

Observations (with screen shots):


Conclusion:
From the above experiment it is concluded that the result of all the arithmetic
operations that were performed on the 16-Bit numbers gives the correct
results with the dry run after executing it in the emulator.

IV. POST LAB:

1. State and explain the different logical instructions of 8086.


Ans:
Opcode Operand Description
AND D,S Used for adding each bit in a byte/word with the corresponding
bit in another byte/word.
OR D,S Used to multiply each bit in a byte/word with the corresponding
bit in another byte/word.
NOT D Used to invert each bit of a byte or word.
XOR D,S Used to perform Exclusive-OR operation over each bit in a
byte/word with the corresponding bit in another byte/word.
TEST D,S Used to add operands to update flags, without affecting
operands.
SHR D,C Used to shift bits of a byte/word towards the right and put
zero(S) in MSBs.
SHL/SAL D,C Used to shift bits of a byte/word towards left and put zero(S) in
LSBs.
ROR D,C Used to rotate bits of byte/word towards the right, i.e. LSB to
MSB and to Carry Flag [CF].
ROL D,C Used to rotate bits of byte/word towards the left, i.e. MSB to
LSB and to Carry Flag [CF].
RCR D,C Used to rotate bits of byte/word towards the right, i.e. LSB to
CF and CF to MSB.
RCL D,C Used to rotate bits of byte/word towards the left, i.e. MSB to CF
and CF to LSB.

2. Subtract two 16 bit numbers 20H and 06H, and store the difference.
Ans. 20H-06H=1A
3. Explain briefly any five arithmetic instructions.
Ans. ADD − Used to add the provided byte to byte/word to word.
SUB − Used to subtract the byte from byte/word from word.
MUL − Used to multiply unsigned byte by byte/word by word.
DIV − Used to divide the unsigned word by byte or unsigned double word by word.
INC − Used to increment the provided byte/word by 1.
4. Write the function of the following machine control instructions
a) WAIT- Event wait
b) HLT- Halt CPU
c) NOP- No Operation
d) ESC- Escape
Computer Organization and Architecture
(EET2211)

LAB III: Evaluate Different Logical operations on two


16 bit Data

Siksha ‘O’ Anusandhan Deemed to be University, Bhubaneswar

Branch: CSE Section:


S. No. Name Registration No. Signature
Marks:
______/10

Remarks:

Teacher’s Signature

I. OBJECTIVE:
10. AND two 16 bit numbers using direct addressing mode.
11. OR two 16 bit numbers using direct addressing mode.
12. NOT of a 16 bit number using direct addressing mode.
13. XOR of two 16 bit numbers using direct addressing mode.

II. PRE-LAB

For Obj. 1:

a. Explain direct addressing mode briefly.


Ans: The addressing mode in which the effective address of the memory location is
written directly in the instruction.
b. Examine & analyze the output obtained from AND of two 16 bit numbers.
Ans: mov ax,[3000h]
mov bx,[3002h]
and ax,bx
mov [3004h],ax

[3000h] = 3FOFh
[3002h] = 0008h
AND: [3004h] = 0008h
c. Write the assembly code.
Ans:
org 100h
mov ax,2000h
mov ds,ax
mov ax,[3000h]
mov bx,[3002h]
and ax,bx
mov [3004h],ax
hlt
For Obj. 2:

a. Examine & analyze the output obtained from OR of two 16 bit numbers.
Ans: mov ax,[3000h]
mov bx,[3002h]
or ax,bx
mov [3006h],ax

[3000h] = 3FOFh
[3002h] = 0008h
OR: [3006h] = 3F0Fh
b. Write the assembly code.
Ans:
org 100h
mov ax,2000h
mov ds,ax
mov ax,[3000h]
mov bx,[3002h]
or ax,bx
mov [3006h],ax
hlt
For Obj. 3:

a. Examine & analyze the output obtained from NOT of a 16 bit number.
Ans: mov ax,[3000h]
mov bx,[3002h]
NOT ax,bx
mov [3004h],ax

[3000h] = 3FOFh
[3002h] = 0008h
NOT: [3008h] = COFOh
b. Write the assembly code.
Ans:
org 100h
mov ax,2000h
mov ds,ax
mov ax,[3000h]
mov bx,[3002h]
not ax,bx
mov [3008h],ax
hlt

For Obj. 4:

a. Examine & analyze the output obtained from XOR of two 16 bit numbers.
Ans: mov ax,[3000h]
mov bx,[3002h]
XOR ax,bx
mov [3004h],ax

[3000h] = 3FOFh
[3002h] = 0008h
XOR: [3010h] = 3F07h
b. Write the assembly code.
Ans:
org 100h
mov ax,2000h
mov ds,ax
mov ax,[3000h]
mov bx,[3002h]
xor ax,bx
mov [3010h],ax
hlt

III. LAB:
Assembly Program:

org 100h
mov ax,2000h
mov ds,ax
mov ax,[3000h]
mov bx,[3002h]
and ax,bx
mov [3004h],ax
mov ax,[3000h]
or ax,bx
mov [3006h],ax
mov ax,[3000h]
not ax
mov [3008h],ax
mov ax,[3000h]
mov bx,[3002h]
xor ax,bx
mov [3010h],ax
hlt
Observations (with screen shots):

Conclusion:
From the above experiment it is concluded that by using direct addressing
mode the result of all the operations like AND, OR, NOT, XOR that were
performed on the 16-Bit numbers gives the correct results with the dry run
after executing it in the emulator.
IV. POST LAB:

1. Enlist the advantages of assembly language programming over machine language.

Ans: a) It allows complex jobs to run in a simpler way.


b) It is memory efficient, as it requires less memory.
c) It is faster in speed, as its execution time is less.
d) It is mainly hardware-oriented.
2. Write the function of the following arithmetic instructions

a) ADC b) INC c) DEC d) SBB e) DAA

Ans:

e) ADC - Used to add with carry

b) INC - Used to increment the provided byte/word by 1

c) DEC - Used to decrement the provided byte/word by 1

d) SBB - Used to perform subtraction with borrow

e) DAA - Used to adjust the decimal after the addition/subtraction operation

3. Write the function of the following logical instructions

a) SHL/SAL b) SHR c) SAR d) ROR e) ROL

Ans:

a) SHL/SAL - Used to shift bits of a byte/word towards left and put zero(S) in LSBs

b) SHR - Used to shift bits of a byte/word towards the right and put zero(S) in MSBs

c) SAR - Used to shift bits of a byte/word towards the right and copy the old MSB into the
new MSB

d) ROR - Used to rotate bits of byte/word towards the right, i.e., LSB to MSB and to Carry
Flag [CF]

e) ROL - Used to rotate bits of byte/word towards the left, i.e., MSB to LSB and to Carry
Flag [CF]
Computer Organization and Architecture
(EET2211)

LAB IV: Product and Division of Two Numbers without


using Arithmetic Instructions

Siksha ‘O’ Anusandhan Deemed to be University, Bhubaneswar

Branch: CSE Section:


S. No. Name Registration No. Signature

Marks:
______/10

Remarks:

Teacher’s Signature

I. OBJECTIVE:
1. Multiply two 16 bit numbers without using arithmetic instructions.
2. Divide two 16 bit numbers without using arithmetic instructions.

II. PRE-LAB

For Obj. 1:

a. Find the product and quotients of two 16 bit numbers.


Ans. Let the two 16bit numbers be 32(0020h) and 8(03h). Their product is 256 (0100h) and
quotient is 3.
b. Write the assembly code.
Ans. org 100h
mov ax,0020h
mov cl,03h
sal ax,cl
mov [3000h],ax
hlt

For Obj. 2:

a. Find the quotient and remainder obtained from division of two 16 bit numbers.
Ans. Let two number be 200(00c8h) and 4(0004h). Quotient is 50 (00032h) and remainder
is 0.
b. Write the assembly code.
Ans. org 100h
mov ax,0064h
mov cl,02h
sar ax,cl
mov [5000h],ax
hlt

III. LAB:
Assembly Program:
For Objective-1:
org 100h

mov ax,0020h
mov cl,03h
sal ax,cl
mov [3000h],ax
hlt

For Objective-1:
org 100h

mov ax,0064h
mov cl,02h
sar ax,cl
mov [5000h],ax
hlt

Observations (with screen shots):

For Objective-1:

For Objective-2:
Conclusion:
From the above experiment we conclude that the given objective i.e.
multiplication and division of any number can be done, provided the divisor is
a multiple of 2, by shifting the number left or right ‘X’ times where x is the
power to 2 which when calculated gives the divisor.

IV. POST LAB:

4. Briefly discuss the instructions used in objectives 1.

org 100h
mov ax,0020h ( the multiplicand (32) is being stored in ax)
mov cl, 03h (the multiplier (8) is being stored in cl)
sal ax,cl (we are shifting multiplicand towards left 3 places to get the result( 0100h))
mov [3000h],ax ( result stored in ax is being shifted to offset 3000h)
hlt

2.Briefly discuss the instructions used in objectives 2.


org 100h
mov ax,00c8h (divisor (200) is being stored in ax)
mov cl,02h (dividend (4) is being stored in cl)
shr ax,cl (we are shifting divisor towards right 2 places to get the result(0032h))
mov [5000h],ax (result stored in ax is being shifted to offset 5000h)
hlt

3.What is the difference between the microprocessor and microcontroller?

Soln:

 Microprocessor consists of only a Central Processing Unit, whereas Micro Controller


contains a CPU, Memory, I/O all integrated into one chip.
 Microprocessor is used in Personal Computers whereas Micro Controller is used in
an embedded system.
 Microprocessor uses an external bus to interface to RAM, ROM, and other
peripherals, on the other hand, Microcontroller uses an internal controlling bus.
 Microprocessors are based on Von Neumann model Micro controllers are based on
Harvard architecture.
 Microprocessor is complicated and expensive, with a large number of instructions to
process but Microcontroller is inexpensive and straightforward with fewer
instructions to process.

4.What is assembler?

Soln: An assembler is a program that converts assembly language into machine code. It


takes the basic commands and operations from assembly code and converts them
into binary code that can be recognized by a specific type of processor.
Computer Organization and Architecture
(EET2211)

LAB V: Addition of two BCD numbers

Siksha ‘O’ Anusandhan Deemed to be University, Bhubaneswar

Branch: CSE Section:


S. No. Name Registration No. Signature

Marks:
______/10

Remarks:

Teacher’s Signature

I. OBJECTIVE:
1. Write a program to find the sum of two BCD numbers.
II. PRE-LAB

For Obj. 1:

a. Find the sum of two BCD numbers.


Ans: - [1000h]<- 2222h
[1002h]<- 1111h
Result- 3333h
b. Write the assembly code.
Ans. org 100h
mov ax,1000h
mov ds,ax
mov al,[3001h]
mov bl,[3003h]
add al,bl
daa
mov [3005h],al
mov al,[3002h]
mov bl,[3004h]
adc al,bl
daa
mov [3006h],al
mov al,00h
adc al,al
mov [3007h],al
hlt

III. LAB:
Assembly Program:
org 100h
mov ax,1000h
mov ds,ax
mov al,[3001h]
mov bl,[3003h]
add al,bl
daa
mov [3005h],al
mov al,[3002h]
mov bl,[3004h]
adc al,bl
daa
mov [3006h],al
mov al,00h
adc al,al
mov [3007h],al
hlt

Observations (with screen shots):


Conclusion:

It can be concluded that the addition of two BCD numbers when dry run and
executed in system found to be same. Thus, the program to find the sum of
two BCD numbers was executed.

IV. POST LAB:

5. What is the maximum memory size that can be addressed by 8086?

Ans: - In 8086 microprocessor the total memory addressing capability is 1MB. For representing
1MB there are minimum 4 hex digits are required i.e., 20 bits. 8086 microprocessors have
fourteen 16 bit registers (i.e. there are no registers for representing 20 bit address). So, the total
memory can be divided into 16 separate logical segments and each segment capacity is 64KB
(i.e., 16 * 64 KB = 1MB).

6. Which of the following is not a data copy/transfer instruction? Explain.


a) MOV b) PUSH
c) DAS d) POP

Ans: - DAS because it’s used to adjust decimal after subtraction.

3. Write Down the Comparisons between the 8086 and 8088?

Ans: -

8086 8088
Clock Speeds 5MHz, 8MHz, 10MHz 5MHz, 8MHz
Bus Width 16 bits 8 bits
Number of Transistors 29,000 29,000
Feature size 3 6
Addressable Memory 1MB 1MB
Computer Organization and Architecture
(EET2211)

LAB VI: Find 1’s and 2’s complement of a number

Siksha ‘O’ Anusandhan Deemed to be University, Bhubaneswar

Branch: CSE Section:


S. No. Name Registration Signature
No.

Marks:
______/10

Remarks:

Teacher’s Signature
I. OBJECTIVE:

1. Write a program to find 1’s and 2’s complement of a given number without
using logical instructions.

II. PRE-LAB

a. Find 1’s and 2’s complement of a given number.


Ans. NUM: 3456 [6000]
1’S COMPLEMENT: CBA9 [6002]
2’S COMPLEMENT: CBAA [6004]
b. Write the assembly code.
Ans. org 100h

mov ax,1000h
mov ds,ax
mov ax,[5000h]
not ax
mov [5002h],ax
inc ax
mov [5006h],ax
hlt
III. LAB:

Assembly Program:
org 100h
mov ax,1000h
mov ds,ax
mov ax,[5000h]
not ax
mov [5002h],ax
inc ax
mov [5006h],ax
hlt

Observations (with screen shots):


Conclusion:
From the above experiment we conclude that the given objectivei.e., Find 1’s and 2’s
complement of a given number without using logical instructions can be done, first by
setting the value of AX to FFFF (i.e., All 1’s in binary,1111 1111 1111 1111) and then
subtracting the desired number whose complement is to be obtained (stored in BX) from it
which yields the 1’s complement of the number. Now incrementing the obtained result by 1
bit gives the 2’s complement.

IV. POST LAB:

1)Briefly explain the logical address, base segment address and physical address?

Ans-

-Logical address is contained in the 16-bit IP, BP, SP, BX, SI or DI. It is also known as the offset
address or the effective address.

-The base segment address is contained in one of the 16bit contents of the segment registers CS,
DS, ES, SS.

-The physical address or the real address is formed by combining the offset and base segment
addresses. This address is 20bit and is primarily used for the accessingof the memory.

2)Differentiate between CISC and RISC.

RISC CISC
It stands for Reduced Instruction Set Computer It stands for Complex Instruction Set Computer.
It is a Reduced Instruction Set Computer. It is a Complex Instruction Set Computer.
It emphasizes on software to optimize the It emphasizes on hardware to optimize the
instruction set. instruction set.
It uses a limited number of instructions that It uses a large number of instructions that
requires less time to execute the instructions. requires more time to execute the instructions.
RISC has more transistors on memory CISC has transistors to store complex
registers. instructions.
The program written for RISC architecture Program written for CISC architecture tends
needs to take more space in memory. to take less space in memory.
The execution time of RISC is very short. The execution time of CISC is longer.
3)Explain briefly the advantages of pipelining in 8086.
Ans-Pipeline in 8086 is a technique which is used in advanced microprocessors, were the
microprocessor execute a second instruction before the completion of first. That is many
instructions are simultaneously pipelined at different processing stage.

The advantages of pipelining are performance improvement, we are able to pump more
instructions and get improved in processor speed as we are able to execute parts of instructions in
parallel to parts of other instruction.Increase in the number of pipeline stages increases the
number of instructions executed simultaneously. Faster ALU can be designed when pipelining is
used. Pipelined CPU's works at higher clock frequencies than the RAM. Pipelining increases the
overall performance of the CPU.

4)Briefly explain the following:

a) Stack Pointer (SP) b) Base Pointer (BP)

c)Destination Index (DI) d) Source Index (SI)

Ans-a) Stack Pointer (SP) -This is the stack pointer. It is of 16 bits. It points to the topmost item
of the stack. If the stack is empty the stack pointer will be (FFFE)H. Its offset address relative to
stack segment.

b) Base Pointer (BP) -This is the base pointer. It is of 16 bits. It is primary used in accessing
parameters passed by the stack. Its offset address relative to stack segment.

c) Destination Index (DI) - This is the destination index register. It is of 16 bits. It is used in the
pointer addressing of data and as a destination in some string related operations. Its offset is
relative to extra segment.

d) Source Index (SI)- This is the source index register. It is of 16 bits. It is used in the pointer
addressing of data and as a source in some string related operations. Its offset is relative to data
segment.
Computer Organization and Architecture
(EET2211)

LAB VII: Swap the upper nibble of a word with the


lower nibble content of an accumulator

Siksha ‘O’ Anusandhan Deemed to be University, Bhubaneswar

Branch: CSE Section:


S. No. Name Registration No. Signature

Marks:
______/10

Remarks:

Teacher’s Signature

I. OBJECTIVE:
1. Write a program to swap the upper nibble of a word with the lower nibble content of an
accumulator.

II. PRE-LAB

a. Swap the upper nibble of a word with the lower nibble content of an accumulator.

Ans. [1000h] <- 23h


Result- 32h

b. Write the assembly code.


Ans. org 100h
mov al,72h
mov cl,4h
ror al,cl
mov bl,0BDh
rol bl,cl
mov [2000h],al
mov [2002h],bl
hlt

III. LAB:
Assembly Program:

org 100h
mov al,72h
mov cl,4h
ror al,cl
mov bl,0BDh
rol bl,cl
mov [2000h],al
mov [2002h],bl
hlt

Observations (with screen shots):

Conclusion:
It can be concluded that swap the upper nibble of a word with the lower nibble content of
an accumulator when dry run and executed in system found to be same. Thus, the program
to swap the nibbles was executed.

IV. POST LAB:


1. Explain briefly the advantages of memory segmentation in 8086.

Ans: - Advantages of memory segmentation in 8086

It allows to processes to easily share data.

It allows to extend the address ability of the processor, i.e. segmentation allows the use of 16 bit
registers to give an addressing capability of 1 Megabytes. Without segmentation, it would require
20 bit registers.

2. Explain the IAS instruction format.

Ans: - The IAS machine was a binary computer with a 40-bit word, storing two 20-bit
instructions in each word. The memory was 1,024 words (5.1 kilobytes). Negative numbers were
represented in two's complement format. It had two general-purpose registers available: the
Accumulator (AC) and Multiplier/Quotient (MQ).

3. Briefly explain the following flags of 8086:


a) Carry Flag (CF): - Holds the carry after addition or the borrow after subtraction. Also
indicates some error conditions as dictated by some programs and procedures.

b) Parity Flag (PF): - PF=0= odd parity ; PF=1=even parity

c) Adjust Flag (AF): - Holds the carry (half carry) after addition or borrow after subtraction

between bit positions 3 and 4 of the result (e.g. in BCD addition or subtraction)

d) Zero Flag (ZF): - Shows the result of the arithmetic or logic operation.

e) Sign Flag (SF): - Holds the sign of the result after an arithmetic/logic instruction execution.

f) Overflow Flag (OF): - Overflow occurs when signed numbers are added or subtracted. An

overflow indicates the result has exceeded the capacity of the machine.
Computer Organization and Architecture
(EET2211)

LAB VIII: Calculate average of N 8-bit numbers

Siksha ‘O’ Anusandhan Deemed to be University, Bhubaneswar

Branch: CSE Section:


S. No. Name Registration No. Signature

Marks:
______/10

Remarks:

Teacher’s Signature

I. OBJECTIVE:
1. Write a program to calculate average of N 16-bit numbers

II. PRE-LAB

a. Calculate average of N 16-bit numbers.

Ans. [0500h]<- 03h


[0501h]<- 20h
[0502h]<- 15h
[0503h]<- 10h
Result- 15h

b. Write the assembly code.


Ans. org 100h
mov si,0500h
mov di,0600h
mov ax,0000h
mov cl,[si]
mov bl,cl
inc si
again:add al,[si]
adc ah,00h
inc si
dec cl
jnz again
div bl
mov [di],ax
hlt
III. LAB:

Assembly Program:
org 100h
mov si,0500h
mov di,0600h
mov ax,0000h
mov cl,[si]
mov bl,cl
inc si
again:add al,[si]
adc ah,00h
inc si
dec cl
jnz again
div bl
mov [di],ax
hlt

Observations (with screen shots):


Conclusion:
It can be concluded to determine the largest number in an array when dry run and executed
in system found to be same. Thus, the program to determine the largest number in an array
was executed.

IV. POST LAB:


7. What is the maximum internal clock frequency of 8086?

Ans: - The maximum internal clock frequency of8086 is 5MHz.

8. List few applications of microprocessor-based system.

Ans: - The use of microprocessor in toys, entertainment equipment and home applications is
making them more entertaining and full of features. The use of microprocessors is more
widespread and popular. Now the Microprocessors are used in:

Calculators

Accounting system

Games machine

Complex Industrial Controllers

Traffic light Control


Data acquisition systems

9. Briefly explain the following instructions of 8086:


a) JMP: - Used to jump to the provided address to proceed to the next instruction.

b) JZ: - Used to jump if equal/zero flag ZF = 1

c) JNZ: - Used to jump if not equal/zero flag ZF = 0

d)JC: - Used to jump if carry flag CF = 1

e)JNC: - Used to jump if no carry flag (CF = 0)

Computer Organization and Architecture


(EET2211)

LAB IX: Determine the largest and smallest number in


an array

Siksha ‘O’ Anusandhan Deemed to be University, Bhubaneswar

Branch: Section:
S. No. Name Registration No. Signature
Marks:
______/10

Remarks:

Teacher’s Signature

I. OBJECTIVE:
1. Write a program to determine the largest number in an array.
2. Write a program to determine the smallest number in an array.

II. PRE-LAB

For Obj. 1:

a. Determine the largest number in an array.

Ans. [1000h]<- 03h


[1001h]<- 13h
[1002h]<- 22h
[1003h]<- 11h
Result- 22h
b. Write the assembly code.

Ans. org 100h


mov ax,1000h
mov ds,ax
mov si,1500h
mov di,1600h
mov cl,[si]
inc si
mov al,[si]
dec cl
l1: inc si
mov bl,[si]
cmp al,bl
jnc again
mov al,bl
again: dec cl
jnz l1
mov [di],al
hlt

For Obj. 2:

a. Determine the smallest number in an array.

Ans. [1000h]<- 03h


[1001h]<- 13h
[1002h]<- 22h
[1003h]<- 11h
Result- 03h
b. Write the assembly code.

Ans. org 1 00h


mov ax,1000h
mov ds,ax
mov si,1500h
mov di,1600h
mov cl,[si]
inc si
mov al,[si]
dec cl
l1: inc si
mov bl,[si]
cmp al,bl
jc again
mov al,bl
again: dec cl
jnz l1
mov [di],al
hlt

III. LAB:
Assembly Program:
For Obj. 1:
org 100h
mov ax,1000h
mov ds,ax
mov si,1500h
mov di,1600h
mov cl,[si]
inc si
mov al,[si]
dec cl
l1: inc si
mov bl,[si]
cmp al,bl
jnc again;for greater than
mov al,bl
again: dec cl
jnz l1
mov [di],al
hlt
For Obj. 2:
org 100h
mov ax,1000h
mov ds,ax
mov si,1500h
mov di,1600h
mov cl,[si]
inc si
mov al,[si]
dec cl
l1: inc si
mov bl,[si]
cmp al,bl
jc again;for less than
mov al,bl
again: dec cl
jnz l1
mov [di],al
hlt

Observations (with screen shots):


For Obj. 1:
For Obj. 2:
Conclusion:
For Obj. 1:
It can be concluded to determine the largest number in an array when dry run
and executed in system found to be same. Thus, the program to determine the
largest number in an array was executed.

For Obj. 2:
It can be concluded to determine the smallest number in an array when dry
run and executed in system found to be same. Thus, the program to determine
the smallest number in an array was executed.

IV. POST LAB:


10. What is ARM processor?

Ans: - An ARM processor is one of a family of CPUs based on the RISC (reduced instruction set
computer) architecture developed by Advanced RISC Machines (ARM).

11. Differentiate between ARM processor and RISC.

Ans: -

ARM RISC
ARM is proprietary. RISC is open-source.
ARM makes 32-bit and 64-bit RISC multi- RISC processors are designed to perform a
core processors. smaller number of types of computer
instructions so that they can operate at a
higher speed, performing more millions of
instructions per second (MIPS).
ARM has added more complex instructions to RISC approach is more successful in reducing
increase processor performance (at the overall power consumption, sometimes at the
expense of higher power consumption). expense of lower performance.
12. Differentiate between ARM processor and 8086.

Ans: -

ARM 8086
Integrated in designs which were Manufactured on a 3-micron process
manufactured on 28, 16, 14 or 10 nanometer
FinFET nodes
RICS Design CISC Design
Consists of a front end, back end (execution Consists of two main blocks, the BIU and EU
engine) and an un-core memory subsystem
which includes the L2 cache.

4. Differentiate between ARM processor and microcontroller.

Ans: - ARM is core for both microprocessor and micro-controller. ARM is based on CPU
architecture so we generally call it has microprocessor when placed on a chip if ARM is
combined with memories (RAM and ROM) on a single chip we can call it has micro-controller it
has limited memory but when coming to microprocessor RAM and ROM are connected
externally speed will be more.

5. List few applications of ARM processor-based system.

Ans: - ARM processor features include:

Load/store architecture.

An orthogonal instruction set.

Mostly single-cycle execution.

Enhanced power-saving design.

64 and 32-bit execution states for scalable high performance.

Hardware virtualization support.

You might also like