English

A block of fifteen memory locations begins D200 H. Write an assembly language program to convert each data in the block into its 1's complement. Store the result at locations beginning D300 H. - Computer Science 2

Advertisements
Advertisements

Question

A block of fifteen memory locations begins D200 H. Write an assembly language program to convert each data in the block into its 1's complement. Store the result at locations beginning D300 H.

Short Answer

Solution

Label Mnemonics code Comments
  LXI D, D300 H ; Load D300H in DE pair
LXI H D200 H ; Load D200H in HL pair
MVI B, 0F H ; Move of in B immd
Back: MOV A, M ; Copy M into A
  CMA ; Complement ACI's
STAX D ; Store A into memory via DE
INX H ; Increment HL pair by 1
INX D ; Increment DE pair by 1
DCR B ; decrement B by 1
JNZ Back ; Jump on no zero
HLT ; Halt the process
shaalaa.com
  Is there an error in this question or solution?
2023-2024 (March) Official
Share
Notifications

Englishहिंदीमराठी


      Forgot password?
Use app×