0
With the help of neat flowchart/algorithm write a program in 8086 assembly to copy an array of 100 numbers initialized in the data segment to extra segment. Assume additional data if any.

Mumbai University > Electronics and Telecommunication > Sem 4 > Microprocessor and peripherals

mumbai university mpa • 566  views
0  upvotes
1

Algorithm:

  1. Initialise array 1 in data segment and store 100 numbers in it.

  2. initialise extra segment and create variable to store 100 numbers.

  3. Initialise code segment

  4. Copy data segment and extra segment memory address to data segment and extra segment register respectively

  5. Load effective address of array 1 to SI

  6. Load effective address of array 2 to DI

  7. initialise counter in CX with the value $(100)_D$ = (64)

  8. clear direction flag

  9. Use string instruction MOVSB to copy string byte from data segment to extra segment

  10. Stop.

Assume: 100 bytes in array 1 from 01 H to 64 H

Data segment

array 1 DB 01H, 02H, 03H, 04H, 05H, 06H, 07H, 08H, 09H, OAH, OBH, OCH, ODK, OEH, OFH, 10H, 11H, 12H, 13H, 14H, 15H, 16H, 17H, 18H, 19H, 1AH, 1BH, 1CH, 1DH, 1EH, 1FH, 20H, 21H, 22H, 23H, 24H, 25H, 26H, 27H, 28H, 29H, 2AH, 2BH, 2CH, 2DH, 2EH, 2FH, 30H, 31H, 32H, 33H, 34H, 35H, 36H, 37H, 38H, 39H, 3AH, 3BH, 3CH, 3DH, 3EH, 3FH, 40H, 41H, 42H, 43H, 44H, 45H, 46H, 47H, 48H, 49H, 50H, 51H, 52H, 53H, 54H, 55H, 56H, 57H, 58H, 59H, 5AH, 5BH, 5CH, 5DH, 5EH, 5FH, 60H, 61H, 62H, 63H, 64H

Data ends

Extra segment

array 2 DB 100 dup (0)

extra ends

Code segment

start: assume CS: CODE, DS: Data, ES: Extra

MOV AX, Data

MOV DS, AX

MOV AX, Extra

MOV ES, AX

LEA SI, array1

LEA DI, array 2

MOV CX, 0064H

cld

rep MOVSB

MOV AX, 4C00 H

INT 21H

Code ends

End start

1  upvotes
Please log in to add an answer.

Next up

Read More Questions

If you are looking for answer to specific questions, you can search them here. We'll find the best answer for you.

Search

Study Full Subject

If you are looking for good study material, you can checkout our subjects. Hundreds of important topics are covered in them.

Know More