0% found this document useful (0 votes)
32 views5 pages

MPL A7 Non Overlap

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

MPL A7 Non Overlap

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

JSPM’S JAYAWANTRAO SAWANT COLLEGE OF ENGINEERING,

HADAPSAR, PUNE-28

DEPARTMENT OF COMPUTER ENGINEERING


210257 : MICROPROCESSOR LAB
S.E. (2019 Pattern)

ASSIGNMENT NO. 7
Title: To Implement non-overlapped block transfer.

PROBLEM DEFINITION:
Write X86/64 ALP to perform non-overlapped and overlapped block transfer
(with and without string specific instructions). Block containing data can be
defined in the data segment.

WORKING ENVIRONMENT:
1) CPU: Intel I5 Processor
2) OS:- Windows XP (16 bit Execution ), Fedora 18 (32 & 64 bit Execution)
3) Editor: gedit, GNU Editor
4) Assembler: NASM (Netwide Assembler)
5) Linker:-LD, GNU Linker

S/W AND H/W REQUIREMENT:


Software Requirements

1. CPU: Intel I5 Processor


2. OS:- Windows XP (16 bit Execution ), Fedora 18 (32 & 64 bit Execution)
3. Editor: gedit, GNU Editor
4. Assembler: NASM (Netwide Assembler)
Linker:-LD, GNU Linker

INPUT: Input data specified in program.

OUTPUT: Display the data present in destination block.

THEORY:
1. Non-overlapped blocks:
In memory, two blocks are known as non-overlapped when none of the
element is common.

AD
9D Memory Block 2

78
09
FF
Memory Block 1
28
F4
3F
FD
BB
AA
0D

In above example of non-overlapped blocks there is no common element


between block 1 & 2.
While performing block transfer in case of non-overlapped blocks, we
can start transfer from starting element of source block to the starting
element of destination block and then we can transfer remaining elements
one by one.
Instructions needed:
1. MOVSB-Move string bytes.
2. JNE-Jump if not equal
3. AND-AND each bit in abyteorword with correspondingbit in
anotherbyteorword
4. INC-Increments specified byte/word by1
5. DEC-Decrements specified byte/word by1
6. JNZ-Jumps ifnot equal to Zero
7. CMP-Compares to specified bytes or words
8. JBE-Jumps ifbelow ofequal

9. CALL-Transfers the control from callingprogramto procedure.

10. RET-Return from where call is made

11. STD- Set direction flag


12. CLD Clear direction Flag

ALGORITHM:

1) Non –Overlapped Block Transfer:


In non-overlapped block transfer Source Block & destination blocks are different. Here we
can transfer byte by byte data or word by word data from one block to another block.

i) Start
ii) Initialize data section
iii) Initialize RSI to point to source block
iv) Initialize RDI to point to destination block
v) Initialize the counter equal to length of block
vi) Choose from Menu: With String or Without String Operation.
vii) Get byte from source block & copy it into destination block
viii) Increment source & destination pointer
ix) Decrement counter
x) If counter is not zero go to step vi
xi) Display Destination Block
xii) Stop

2) Overlapped Block Transfer.


In Overlapped block transfer there is only one block & within the same
block
We are transferring the data.

i) Start
ii) Initialize data section
iii) Accept the overlapping position from the user
iv) Choose from Menu: With String or Without String Opersation.
v) Initialize RSI to point to the end of source block
vi) Add RSI with overlapping Position & use it as pointer to point to End of
Destination Block.
vii) Initialize the counter equal to length of block
viii) Get byte from source block & copy it into destination block
ix) Decrement source & destination pointer
x) Decrement counter
xi) If counter is not zero go to step vii
xii) Display Destination Block
xiii) Stop
Flowchart:

NON-OVERLAPPED BLOCK TRANSFER

START

Initialize src-_array, count, des_array

Initialize Data segment

Source Index register Base address of src_array

Destn Index register Base address of des__array

Clear the direction flag (DF = 0)

Load the count in CX register

Transfer src_array content to des_array ;

Increment SI & DI
Commands

• To assemble
nasm –f elf 64 hello.nasm -o hello.o
• To link
ld –o hello hello.o
• To execute -
./hello

TEST CASES:
Take any two examples of blocks of data and explain its overlapped & non-
overlapped block transfer.

CONCLUSION

Hence we conclude that we can perform non-overlapped block Transfer


without string instructions.

Oral Question Bank

1. What is difference between overlapped & non-overlapped block Transfer?

2. What is the difference between without & with string instruction Execution?

3. What is the use of direction flag?

4. What is different string instructions used in the program?

5. What is STD,CLD?

You might also like