English

A block of daa is stored in memory locations from 8400H. The length of the block is stored in 73FFH. Another block of same length is stored from 8500H. Write an assembly language program to

Advertisements
Advertisements

Question

A block of daa is stored in memory locations from 8400H. The length of the block is stored in 73FFH. Another block of same length is stored from 8500H. Write an assembly language program to exchange the contents of these two blocks.

Code Writing
Advertisements

Solution

LDA 73FFH        ; Load count
MOV B, A         ; B = counter

LXI H, 8400H     ; HL -> first block
LXI D, 8500H     ; DE -> second block

LOOP: 
MOV C, M         ; C = [HL] (store first block data)
LDAX D           ; A = [DE] (get second block data)
MOV M, A         ; [HL] = second block data

MOV A, C         ; A = first block data
STAX D           ; [DE] = first block data

INX H            ; Next location of first block
INX D            ; Next location of second block

DCR B            ; Decrement count
JNZ LOOP         ; Repeat till count ≠ 0

HLT              ; Stop
shaalaa.com
  Is there an error in this question or solution?
2025-2026 (March) Official Board Paper
Share
Notifications

Englishहिंदीमराठी


      Forgot password?
Use app×