COA LAB Assignment Combined
COA LAB Assignment Combined
(EET2211)
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:
For Obj. 2:
For Obj. 3:
For Obj. 4:
For Obj. 5:
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:
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:
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:
Remarks:
Teacher’s Signature
I. OBJECTIVE:
II. PRE-LAB
For Obj. 1:
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.
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
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)
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:
[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:
Ans:
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)
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:
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
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.
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
Soln:
4.What is assembler?
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:
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
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.
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).
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)
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
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
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.
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.
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)
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.
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
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.
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.
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).
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)
Marks:
______/10
Remarks:
Teacher’s Signature
I. OBJECTIVE:
1. Write a program to calculate average of N 16-bit numbers
II. PRE-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
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
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:
For Obj. 2:
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
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.
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).
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.
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.
Load/store architecture.