Transferring data from one memory location to another in 8086

PROGRAM NO.9

OBJECT:Write a program to move a block of data from one memory location to another.
INSTRUMENT REQUIRED: 8086 Microprocessor Trainer Kit.
PROGRAM:

MEMORY LOCATION MACHINE CODE OPCODE OPERAND
0200 FD STD  
0201 BE 1F 03 MOV SI,031FH
0204 BF 2F 03 MOV DI,032FH
0207 B9 10 00 MOV CX,0010H
020A F2 REP  
020B A5 MOV SW/SB
020C F4 HLT  

DESCRIPTION:

To solve the given objective we have taken a Block of 10H words located in memory locations from 0310H to 031FH and then bit by bit moved it the memory locations from 0320H to 032FH.

To solve the given objective we have taken the following steps:

  1. Set the direction flag in order to auto decrements the SI and DI registers.
  2. Move the source index (SI) pointer to point to the location of the last number of the block to be moved.
  3. Move the destination index (DI) pointer to point to the memory location where the last number of the block to be moved.
  4. Set CX equal to 10H i.e. the number of numbers to be moved.
  5. Move the number pointed to by SI into the location pointed to by DI and auto decrements CX.
  6. Repeat the fourth step till values in CX does not become zero.
  7. Finally Halt.

INPUT:

MEMORY LOCATION VALUE
0310H 01
0311H 02
0312H 03
0313H 04
0314H 05
0315H 06
0316H 07
0317H 08
0318H 09
0319H 10
031AH 11
031BH 12
031CH 13
031DH 14
031EH 15
031FH 16

OUTPUT:

MEMORY LOCATION VALUE
0320H 01
0321H 02
0322H 03
0323H 04
0324H 05
0325H 06
0326H 07
0327H 08
0328H 09
0329H 10
032AH 11
032BH 12
032CH 13
032DH 14
032EH 15
032FH 16

RESULT: The block of data has been moved successfully from one memory location to another.

COMMENTS:

  1. STD: This instruction sets the direction flag to 1 without affecting other flags.
  1. REP: It decrement CX register and repeats the string instruction until CX register becomes zero.
  1. MOV SW/ SB: These instructions moves 8-bit or 16-bit data from the memory location(s) addressed by SI register to the memory location(s) addressed by D

FLOWCHART:

Transferring data from one memory location to another in 8086


Most Important Question for Exam

1. During a read operation the CPU fetchs__________.




Answer is C)
All of these


2. Which of following is no an 8086/8088 general-purpose register?




Answer is A)
Address Segment (AS)


3. Which Microprocessor accepts the program written for 8086 without any changes?




Answer is A)
8088

4. Which group of instructions do not affect the flags?




Answer is B)
Data Transfer Operations

5. The result of MOVE AL,65 is to store




Answer is A)
Store 0100 0001 in AL

6. FPGA means




Answer is D)
Field Programmable Gate Array

7. Which Languge could be used for programming on FPGA




Answer is C)
VHDL

8. The Program counter in a 8085 microprocessor is a 16 bit register because




Answer is C)
There are 16 address line

9. A Microprocessor is ALU




Answer is A)
Register unit and and control unit on a single chip

10. Basic steps of execution of an instruction is




Answer is A)
Fetch–>decode–>execute

11. Which of the data transfer is not possible in microprocessor




Answer is C)
Memory to memory

12. Which one of the following statement is false?




Answer is A)
Microprocessor has an ALU

13. In microprocessor based system DMA refers to




Answer is B)
Direct memory access for the I/O device

14. The interrupt facility is provide in microprocessor to




Answer is A)
Keep control on the working of the microprocessor

15. Microprocessor differentiates between op code data/address




Answer is D)
The sequence in which memory are fetched by it

16. A Microprocessor without the interrupt facility




Answer is C)
Is not useful for process control system

17. In Microprocessor based system I/O ports are used to interface




Answer is A)
All the I/O devices

18. In a microprocessor based system the stack is always in




Answer is C)
RAM

19. The instruction set of a microprocessor




Answer is D)
Is specified by the manufacturer

20. The multiplexing of address bus and data buses are used in microprocessor




Answer is B)
To reduced the number of pins

21. The stack pointer register in a microprocessor




Answer is A)
Hold the address of the top of stack

22. The address bus of any microprocessor is always




Answer is D)
Undirectional

23. The bus connected between the CPU and main memory that permits transfer of information between main memory and the CPU is known as




Answer is C)
Memory bus

24. In a microprocessor system, suppose. TRAP, HOLD, RESET Pin got activated as the same time while the processor was executing some instructions, then it will first respond to




Answer is A)
None of these

25. When CPU is not fully loaded which of the following method of data transfer is preferred




Answer is A)
None of these

26. In Microprocessor, the SS is called as ___________




Answer is C)
Stack Segment

27. The Index registe are used to hold____________




Answer is C)
Offset address

28. The BIU contains FIFO registe of size_______bytes.




Answer is C)
6

29. The CS register stores instruction ____________in code segment




Answer is B)
Codes

30. The microprocessor determines whether the specified or not by testing the________




Answer is C)
Conditional Flag

Related Link