Question: 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.
0

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

mumbai university mpa • 233 views
ADD COMMENTlink
modified 11 weeks ago by gravatar for RB RB100 written 5 months ago by gravatar for kazi.tahoor kazi.tahoor0
0

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

ADD COMMENTlink
modified 11 weeks ago by gravatar for Ankit Pandey Ankit Pandey60 written 11 weeks ago by gravatar for RB RB100
Please log in to add an answer.