English

A block of data is stored in memory locations from C200H to C20FH. Write an Assembly Language Program to transfer the block in reverse order to memory locations C300H and onwards. - Computer Science 2

Advertisements
Advertisements

Question

A block of data is stored in memory locations from C200H to C20FH. Write an Assembly Language Program to transfer the block in reverse order to memory locations C300H and onwards.

Code Writing
Advertisements

Solution

Assembly language program:

Memory     Label            Mnemonics                      Comments
address 

C000             LXI H, C200H     ; Set HL as pointer to source
C003             LXI D, C30FH     ; Set DE as pointer to destination
C006             MVI B, 10H       ; Set B as counter (16 bytes)

C008    LOOP     MOV A, M         ; Get data byte from source
C009             STAX D           ; Store data byte at destination
C00A             INX H            ; Increment source pointer
C00B             DCX D            ; Decrement destination pointer
C00C             DCR B            ; Decrement counter
C00D             JNZ LOOP         ; If not zero, repeat loop

C010             HLT              ; Stop execution
shaalaa.com
  Is there an error in this question or solution?
2022-2023 (March) Official
Share
Notifications

Englishहिंदीमराठी


      Forgot password?
Use app×